18
18
*/
19
19
20
20
buildscript {
21
- repositories {
22
- mavenCentral()
23
- }
24
- dependencies {
25
- classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
26
- }
21
+ repositories {
22
+ mavenCentral()
23
+ }
24
+ dependencies {
25
+ classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
26
+ }
27
27
}
28
28
29
29
plugins {
30
30
id(" net.ltgt.errorprone" ) version " 0.8.1" apply false
31
31
}
32
32
33
- apply(plugin : " java" );
34
- apply(plugin : " maven" );
35
- apply(plugin : " signing" );
36
- apply(plugin : " biz.aQute.bnd.builder" );
37
- apply(plugin : " idea" );
38
- apply(plugin : " eclipse" );
39
- apply(plugin : " net.ltgt.errorprone" );
33
+ allprojects {
34
+ apply(plugin : " java" );
35
+ apply(plugin : " maven" );
36
+ apply(plugin : " signing" );
37
+ apply(plugin : " biz.aQute.bnd.builder" );
38
+ apply(plugin : " idea" );
39
+ apply(plugin : " eclipse" );
40
+ apply(plugin : " net.ltgt.errorprone" );
40
41
41
- apply(from : " project.gradle" );
42
+ apply(from : " project.gradle" );
42
43
43
- group = " com.github.java-json-tools" ;
44
+ group = " com.github.java-json-tools" ;
44
45
45
- ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
46
+ ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
46
47
47
- /*
48
- * Repositories to use
49
- */
50
- repositories {
51
- mavenCentral();
52
- if (! forRelease) {
53
- maven {
54
- url " https://oss.sonatype.org/content/repositories/snapshots"
48
+ /*
49
+ * Repositories to use
50
+ */
51
+ repositories {
52
+ mavenCentral();
53
+ if (! forRelease) {
54
+ maven {
55
+ url " https://oss.sonatype.org/content/repositories/snapshots"
56
+ }
55
57
}
56
- }
57
- /* Allow staging references for last pre-release testing. */
58
- if (project . properties . containsKey( " sonatypeUsername " )) {
59
- maven {
60
- url " https://oss.sonatype.org/service/local/staging/deploy/maven2 "
61
- credentials {
62
- username = project. properties[" sonatypeUsername " ]
63
- password = project . properties[ " sonatypePassword " ]
58
+ /* Allow staging references for last pre-release testing. */
59
+ if (project . properties . containsKey( " sonatypeUsername " )) {
60
+ maven {
61
+ url " https://oss.sonatype.org/service/local/staging/deploy/maven2 "
62
+ credentials {
63
+ username = project . properties[ " sonatypeUsername " ]
64
+ password = project. properties[" sonatypePassword " ]
65
+ }
64
66
}
65
67
}
66
68
}
67
- }
68
69
69
- /*
70
- * Add errorprone checking.
71
- */
72
- dependencies {
73
- errorprone(" com.google.errorprone:error_prone_core:2.3.3" )
74
- errorproneJavac(" com.google.errorprone:javac:9+181-r4173-1" )
75
- }
70
+ /*
71
+ * Add errorprone checking.
72
+ */
73
+ dependencies {
74
+ errorprone(" com.google.errorprone:error_prone_core:2.3.3" )
75
+ errorproneJavac(" com.google.errorprone:javac:9+181-r4173-1" )
76
+ }
76
77
77
- /*
78
- * Necessary! Otherwise TestNG will not be used...
79
- *
80
- * Also, we don't want gradle's default HTML report: it does not support
81
- * parameterized tests which I use a _lot_.
82
- */
83
- test {
84
- useTestNG() {
85
- useDefaultListeners = true ;
86
- };
87
- }
78
+ /*
79
+ * Necessary! Otherwise TestNG will not be used...
80
+ *
81
+ * Also, we don't want gradle's default HTML report: it does not support
82
+ * parameterized tests which I use a _lot_.
83
+ */
84
+ test {
85
+ useTestNG() {
86
+ useDefaultListeners = true ;
87
+ };
88
+ }
88
89
89
- /*
90
- * Necessary to generate the source and javadoc jars
91
- */
92
- task sourcesJar (type : Jar , dependsOn : classes) {
93
- classifier = " sources" ;
94
- from sourceSets. main. allSource;
95
- }
90
+ /*
91
+ * Necessary to generate the source and javadoc jars
92
+ */
93
+ task sourcesJar(type : Jar , dependsOn : classes) {
94
+ classifier = " sources" ;
95
+ from sourceSets. main. allSource;
96
+ }
96
97
97
- /*
98
- * Lint all the things!
99
- */
100
- allprojects {
98
+ /*
99
+ * Lint all the things!
100
+ */
101
101
gradle. projectsEvaluated {
102
102
tasks. withType(JavaCompile ) {
103
103
options. compilerArgs << " -Xlint:all" << " -Werror"
@@ -106,136 +106,137 @@ allprojects {
106
106
options. addStringOption(' Xwerror' , ' -quiet' )
107
107
}
108
108
}
109
- }
110
109
111
- /*
112
- * Javadoc: we need to tell where the overview.html is, it will not pick it up
113
- * automatically...
114
- */
110
+ task javadocJar( type : Jar , dependsOn : javadoc) {
111
+ classifier = " javadoc " ;
112
+ from javadoc . destinationDir;
113
+ }
115
114
116
- javadoc {
117
- options. overview = " src/main/java/overview.html" ;
118
- }
115
+ artifacts {
116
+ archives jar;
117
+ archives sourcesJar;
118
+ archives javadocJar;
119
+ }
119
120
120
- task javadocJar ( type : Jar , dependsOn : javadoc) {
121
- classifier = " javadoc " ;
122
- from javadoc . destinationDir ;
123
- }
121
+ wrapper {
122
+ gradleVersion = " 5.6.3 " ;
123
+ distributionUrl = " https://services.gradle.org/distributions/gradle- ${ gradleVersion } -all.zip " ;
124
+ }
124
125
125
- artifacts {
126
- archives jar;
127
- archives sourcesJar ;
128
- archives javadocJar;
129
- }
126
+ task pom {
127
+ doLast {
128
+ pom {} . writeTo( " ${ projectDir } /pom.xml " ) ;
129
+ }
130
+ }
130
131
131
- wrapper {
132
- gradleVersion = " 5.6.3" ;
133
- distributionUrl = " https://services.gradle.org/distributions/gradle-${ gradleVersion} -all.zip" ;
134
- }
132
+ /*
133
+ * SIGNING
134
+ */
135
135
136
- task pom {
137
- doLast {
138
- pom {}. writeTo(" ${ projectDir} /pom.xml" );
139
- }
140
- }
136
+ project. ext {
137
+ description = " JSON Pointer (RFC 6901) and numeric equality for Jackson (2.2.x)" ;
138
+ scmUrl = sprintf (" git@github.com:java-json-tools/%s.git" , rootProject. name)
139
+ projectURL = sprintf (" https://github.com/java-json-tools/%s" , rootProject. name);
140
+ sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
141
+ sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
142
+ };
141
143
142
- /*
143
- * SIGNING
144
- */
144
+ task checkSigningRequirements {
145
+ doLast {
146
+ def requiredProperties = [ " sonatypeUsername" , " sonatypePassword" ];
147
+ def noDice = false ;
148
+ requiredProperties. each {
149
+ if (project. properties[it] == null ) {
150
+ noDice = true ;
151
+ System . err. printf (" property \" %s\" is not defined!" )
152
+ }
153
+ }
154
+ if (noDice)
155
+ throw new IllegalStateException (" missing required properties for " +
156
+ " upload" );
157
+ }
158
+ }
145
159
146
- project. ext {
147
- description = " JSON Pointer (RFC 6901) and numeric equality for Jackson (2.2.x)" ;
148
- scmUrl = sprintf (" git@github.com:java-json-tools/%s.git" , name)
149
- projectURL = sprintf (" https://github.com/java-json-tools/%s" , name);
150
- sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
151
- sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
152
- };
153
-
154
- task checkSigningRequirements {
155
- doLast {
156
- def requiredProperties = [ " sonatypeUsername" , " sonatypePassword" ];
157
- def noDice = false ;
158
- requiredProperties. each {
159
- if (project. properties[it] == null ) {
160
- noDice = true ;
161
- System . err. printf (" property \" %s\" is not defined!" )
160
+ uploadArchives {
161
+ dependsOn(checkSigningRequirements);
162
+ repositories {
163
+ mavenDeployer {
164
+ beforeDeployment {
165
+ MavenDeployment deployment -> signing. signPom(deployment);
166
+ }
167
+
168
+ repository(url : " ${ sonatypeStaging} " ) {
169
+ authentication(
170
+ userName : project. properties[" sonatypeUsername" ],
171
+ password : project. properties[" sonatypePassword" ]
172
+ );
173
+ }
174
+
175
+ snapshotRepository(url : " ${ sonatypeSnapshots} " ) {
176
+ authentication(
177
+ userName : project. properties[" sonatypeUsername" ],
178
+ password : project. properties[" sonatypePassword" ]
179
+ );
180
+ }
162
181
}
163
182
}
164
- if (noDice)
165
- throw new IllegalStateException (" missing required properties for " +
166
- " upload" );
167
183
}
168
- }
169
184
170
- uploadArchives {
171
- dependsOn(checkSigningRequirements);
172
- repositories {
173
- mavenDeployer {
174
- beforeDeployment {
175
- MavenDeployment deployment -> signing. signPom(deployment);
185
+ /*
186
+ * Configure pom.xml on install, uploadArchives
187
+ */
188
+ [
189
+ install. repositories. mavenInstaller,
190
+ uploadArchives. repositories. mavenDeployer
191
+ ]* . pom* . whenConfigured { pom ->
192
+ pom. project {
193
+ name " ${ project.name} " ;
194
+ packaging " jar" ;
195
+ description " ${ project.ext.description} " ;
196
+ url " ${ projectURL} " ;
197
+
198
+ scm {
199
+ url " ${ scmUrl} " ;
200
+ connection " ${ scmUrl} " ;
201
+ developerConnection " scm:git:${ scmUrl} " ;
176
202
}
177
203
178
- repository(url : " ${ sonatypeStaging} " ) {
179
- authentication(
180
- userName : project. properties[" sonatypeUsername" ],
181
- password : project. properties[" sonatypePassword" ]
182
- );
204
+ licenses {
205
+ license {
206
+ name " Lesser General Public License, version 3 or greater" ;
207
+ url " http://www.gnu.org/licenses/lgpl.html" ;
208
+ distribution " repo" ;
209
+ };
210
+ license {
211
+ name " Apache Software License, version 2.0" ;
212
+ url " http://www.apache.org/licenses/LICENSE-2.0" ;
213
+ distribution " repo" ;
214
+ }
183
215
}
184
216
185
- snapshotRepository(url : " ${ sonatypeSnapshots} " ) {
186
- authentication(
187
- userName : project. properties[" sonatypeUsername" ],
188
- password : project. properties[" sonatypePassword" ]
189
- );
217
+ developers {
218
+ developer {
219
+ id " huggsboson" ;
220
+ name " John Huffaker" ;
221
+ email " jhuffaker+java-json-tools@gmail.com" ;
222
+ }
190
223
}
191
224
}
192
225
}
226
+
227
+ signing {
228
+ required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
229
+ sign configurations. archives;
230
+ }
193
231
}
194
232
195
233
/*
196
- * Configure pom.xml on install, uploadArchives
234
+ * Javadoc: we need to tell where the overview.html is, it will not pick it up
235
+ * automatically...
197
236
*/
198
- [
199
- install. repositories. mavenInstaller,
200
- uploadArchives. repositories. mavenDeployer
201
- ]* . pom* . whenConfigured { pom ->
202
- pom. project {
203
- name " ${ project.name} " ;
204
- packaging " jar" ;
205
- description " ${ project.ext.description} " ;
206
- url " ${ projectURL} " ;
207
-
208
- scm {
209
- url " ${ scmUrl} " ;
210
- connection " ${ scmUrl} " ;
211
- developerConnection " scm:git:${ scmUrl} " ;
212
- }
213
-
214
- licenses {
215
- license {
216
- name " Lesser General Public License, version 3 or greater" ;
217
- url " http://www.gnu.org/licenses/lgpl.html" ;
218
- distribution " repo" ;
219
- };
220
- license {
221
- name " Apache Software License, version 2.0" ;
222
- url " http://www.apache.org/licenses/LICENSE-2.0" ;
223
- distribution " repo" ;
224
- }
225
- }
226
237
227
- developers {
228
- developer {
229
- id " huggsboson" ;
230
- name " John Huffaker" ;
231
- email " jhuffaker+java-json-tools@gmail.com" ;
232
- }
233
- }
234
- }
238
+ javadoc {
239
+ options. overview = " src/main/java/overview.html" ;
235
240
}
236
241
237
- signing {
238
- required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
239
- sign configurations. archives;
240
- }
241
242
0 commit comments