-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
113 lines (95 loc) · 2.6 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply from: 'http://tellurianring.com/projects/gradle-plugins/gradle-release/apply.groovy'
group = 'be.olsson.bencoder'
description = "Small library to decode and encode bencoded data"
targetCompatibility = "1.5"
sourceCompatibility = "1.5"
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}
release {
tagPrefix = 'bencoder'
}
createReleaseTag.dependsOn uploadArchives
signing {
sign configurations.archives
}
buildscript {
repositories {
mavenCentral()
}
println "buildscript: " + version
}
uploadArchives {
println "uploadArchives: " + version
repositories {
println "repositories: " + version
mavenDeployer {
println "mavenDeployer: " + version
pom.artifactId = 'bencoder'
configuration = configurations.archives
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: nexusUsername, password: nexusPassword)
}
pom.project {
url 'http://github.com/tobias-/bencode'
inceptionYear '2003'
name 'Bencoder'
description project.description
scm {
url 'scm:git:https://github.com/tobias-/bencode.git'
connection 'scm:git:ssh://[email protected]/tobias-/bencode.git'
}
licenses {
license {
name 'Unlicense'
comments new File('UNLICENSE').getText()
url 'http://unlicense.org/'
distribution 'repo'
}
}
developers {
developer {
id 'tobias-'
name 'Tobias Olsson'
email '[email protected]'
}
}
}
pom.withXml { root ->
def children = root.asNode().children()
def versionIndex = children.indexOf(children.find {it.name().localPart == 'version'})
children.add(versionIndex + 1, new Node(null, 'packaging', 'jar'))
}
pom.packaging = 'jar'
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
def password = System.console().readPassword("PGP Private Key Password: ")
allprojects { ext."signing.password" = password }
allprojects { ext."signing.keyId" = "A043AF3C" }
allprojects { ext."signing.secretKeyRingFile" = System.env.HOME + "/.gnupg/secring.gpg" }
}
}