16
16
* - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
17
17
*/
18
18
19
+ buildscript {
20
+ repositories {
21
+ mavenCentral()
22
+ }
23
+ dependencies {
24
+ classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
25
+ }
26
+ };
19
27
28
+ plugins {
29
+ id(" net.ltgt.errorprone" ) version " 0.8.1" apply false
30
+ }
20
31
21
32
/*
22
33
* This has to be here... It will not be taken into account in common.gradle!
51
62
apply(plugin : " java" );
52
63
apply(plugin : " maven" );
53
64
apply(plugin : " signing" );
54
- apply(plugin : " osgi " );
65
+ apply(plugin : " biz.aQute.bnd.builder " );
55
66
apply(plugin : " idea" );
56
67
apply(plugin : " eclipse" );
68
+ apply(plugin : " net.ltgt.errorprone" );
57
69
58
70
apply(from : " project.gradle" );
59
71
72
+ group = " com.github.java-json-tools" ;
73
+
74
+ ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
75
+
60
76
/*
61
77
* Repositories to use
62
78
*/
63
79
repositories {
64
80
mavenCentral();
81
+ if (! forRelease) {
82
+ maven {
83
+ url " https://oss.sonatype.org/content/repositories/snapshots"
84
+ }
85
+ }
86
+ /* Allow staging references for last pre-release testing. */
87
+ if (project. properties. containsKey(" sonatypeUsername" )) {
88
+ maven {
89
+ url " https://oss.sonatype.org/service/local/staging/deploy/maven2"
90
+ credentials {
91
+ username = project. properties[" sonatypeUsername" ]
92
+ password = project. properties[" sonatypePassword" ]
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ /*
99
+ * Add errorprone checking.
100
+ */
101
+ dependencies {
102
+ errorprone(" com.google.errorprone:error_prone_core:2.3.3" )
103
+ errorproneJavac(" com.google.errorprone:javac:9+181-r4173-1" )
65
104
}
66
105
67
106
/*
68
107
* Necessary! Otherwise TestNG will not be used...
69
108
*
70
- * Also, we don't want gradle's default HTML report: it does not support
71
- * parameterized tests which I use a _lot_.
72
109
*/
73
110
test {
74
111
useTestNG() {
@@ -84,6 +121,20 @@ task sourcesJar(type: Jar, dependsOn: classes) {
84
121
from sourceSets. main. allSource;
85
122
}
86
123
124
+ /*
125
+ * Lint all the things!
126
+ */
127
+ allprojects {
128
+ gradle. projectsEvaluated {
129
+ tasks. withType(JavaCompile ) {
130
+ options. compilerArgs << " -Xlint:all" << " -Xlint:-serial" << " -Xlint:-deprecation" << " -Werror"
131
+ }
132
+ tasks. withType(Javadoc ) {
133
+ options. addStringOption(' Xwerror' , ' -quiet' )
134
+ }
135
+ }
136
+ }
137
+
87
138
/*
88
139
* Javadoc: we need to tell where the overview.html is, it will not pick it up
89
140
* automatically...
@@ -104,39 +155,42 @@ artifacts {
104
155
archives javadocJar;
105
156
}
106
157
107
- task wrapper ( type : Wrapper ) {
108
- gradleVersion = " 1.11 " ;
109
- distributionUrl = " http ://services.gradle.org/distributions/gradle-${ gradleVersion} -all.zip" ;
158
+ wrapper {
159
+ gradleVersion = " 5.6.3 " ;
160
+ distributionUrl = " https ://services.gradle.org/distributions/gradle-${ gradleVersion} -all.zip" ;
110
161
}
111
162
112
- task pom << {
113
- pom {}. writeTo(" ${ projectDir} /pom.xml" );
163
+ task pom {
164
+ doLast {
165
+ pom {}. writeTo(" ${ projectDir} /pom.xml" );
166
+ }
114
167
}
115
168
116
169
/*
117
170
* SIGNING
118
171
*/
119
172
120
173
project. ext {
121
- gitrwscm
= sprintf (
" [email protected] :fge/%s" , name);
122
- gitroscm = sprintf (" https://github.com/fge/%s.git" , name);
123
- projectURL = sprintf (" https://github.com/fge/%s" , name);
174
+ scmUrl
= sprintf (
" [email protected] :java-json-tools/%s.git" , name);
175
+ projectURL = sprintf (" https://github.com/java-json-tools/%s" , name);
124
176
sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
125
177
sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
126
178
};
127
179
128
- task checkSigningRequirements << {
129
- def requiredProperties = [ " sonatypeUsername" , " sonatypePassword" ];
130
- def noDice = false ;
131
- requiredProperties. each {
132
- if (project. properties[it] == null ) {
133
- noDice = true ;
134
- System . err. printf (" property \" %s\" is not defined!" )
180
+ task checkSigningRequirements {
181
+ doLast {
182
+ def requiredProperties = [ " sonatypeUsername" , " sonatypePassword" ];
183
+ def noDice = false ;
184
+ requiredProperties. each {
185
+ if (project. properties[it] == null ) {
186
+ noDice = true ;
187
+ System . err. printf (" property \" %s\" is not defined!\n " , it);
188
+ }
135
189
}
190
+ if (noDice)
191
+ throw new IllegalStateException (" missing required properties for " +
192
+ " upload" );
136
193
}
137
- if (noDice)
138
- throw new IllegalStateException (" missing required properties for " +
139
- " upload" );
140
194
}
141
195
142
196
uploadArchives {
@@ -172,15 +226,15 @@ uploadArchives {
172
226
uploadArchives. repositories. mavenDeployer
173
227
]* . pom* . whenConfigured { pom ->
174
228
pom. project {
175
- name " ${ name} " ;
229
+ name " ${ project. name} " ;
176
230
packaging " jar" ;
177
- description " ${ description} " ;
231
+ description " ${ project.ext. description} " ;
178
232
url " ${ projectURL} " ;
179
233
180
234
scm {
181
- url " ${ gitrwscm } " ;
182
- connection " ${ gitrwscm } " ;
183
- developerConnection " ${ gitroscm } " ;
235
+ url " ${ scmUrl } " ;
236
+ connection " ${ scmUrl } " ;
237
+ developerConnection " scm:git: ${ scmUrl } " ;
184
238
}
185
239
186
240
licenses {
@@ -198,15 +252,14 @@ uploadArchives {
198
252
199
253
developers {
200
254
developer {
201
- id " fge " ;
202
- name " Francis Galiegue " ;
203
- email " fgaliegue @gmail.com" ;
255
+ id " huggsboson " ;
256
+ name " John Huffaker " ;
257
+ email " jhuffaker+java-json-tools @gmail.com" ;
204
258
}
205
259
}
206
260
}
207
261
}
208
262
209
- ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
210
263
signing {
211
264
required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
212
265
sign configurations. archives;
0 commit comments