1
- /* * Copyright (c) 2014, Francis Galiegue ([email protected] )
1
+ /*
2
+ * Copyright (c) 2014, Francis Galiegue ([email protected] )
2
3
*
3
4
* This software is dual-licensed under:
4
5
*
18
19
19
20
buildscript {
20
21
repositories {
22
+ mavenCentral()
21
23
maven {
22
24
url " http://repo.springsource.org/plugins-release" ;
23
25
}
24
26
}
25
27
dependencies {
28
+ classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
26
29
classpath(group : " org.springframework.build.gradle" , name : " propdeps-plugin" , version : " 0.0.7" );
27
30
}
28
31
};
29
32
33
+ plugins {
34
+ id(" net.ltgt.errorprone" ) version " 0.8.1" apply false
35
+ }
36
+
30
37
configure(allprojects) {
31
38
apply(plugin : " propdeps" );
32
39
apply(plugin : " propdeps-maven" );
@@ -37,51 +44,45 @@ configure(allprojects) {
37
44
apply(plugin : " java" );
38
45
apply(plugin : " maven" );
39
46
apply(plugin : " signing" );
40
- apply(plugin : " osgi " );
47
+ apply(plugin : " biz.aQute.bnd.builder " );
41
48
apply(plugin : " idea" );
42
49
apply(plugin : " eclipse" );
50
+ apply(plugin : " net.ltgt.errorprone" );
51
+
52
+ apply(from : " project.gradle" );
43
53
44
54
group = " com.github.java-json-tools" ;
45
- version = " 1.11-SNAPSHOT" ;
46
- sourceCompatibility = " 1.6" ;
47
- targetCompatibility = " 1.6" ; // defaults to sourceCompatibility
55
+
56
+ ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
48
57
49
58
/*
50
- * List of dependencies
59
+ * Repositories to use
51
60
*/
52
- dependencies {
53
- provided(group : " com.google.code.findbugs" , name : " jsr305" , version : " 2.0.1" );
54
- compile(group : " com.github.java-json-tools" , name : " jackson-coreutils" , version : " 1.9" );
55
- testCompile(group : " org.testng" , name : " testng" , version : " 6.8.7" ) {
56
- exclude(group : " junit" , module : " junit" );
57
- exclude(group : " org.beanshell" , module : " bsh" );
58
- exclude(group : " org.yaml" , module : " snakeyaml" );
59
- };
60
- testCompile(group : " org.mockito" , name : " mockito-core" , version : " 1.9.5" );
61
- testCompile(group : " org.assertj" , name : " assertj-core" , version : " 1.7.0" );
62
- }
63
-
64
- javadoc. options {
65
- def currentJavaVersion = org.gradle.api.JavaVersion . current()
66
- // FIXME: https://github.com/gradle/gradle/issues/11182
67
- if (currentJavaVersion. compareTo(org.gradle.api.JavaVersion . VERSION_1_9 ) >= 0 ) {
68
- addStringOption(" -release" , " 6" );
61
+ repositories {
62
+ mavenCentral();
63
+ if (! forRelease) {
64
+ maven {
65
+ url " https://oss.sonatype.org/content/repositories/snapshots"
66
+ }
67
+ }
68
+ /* Allow staging references for last pre-release testing. */
69
+ if (project. properties. containsKey(" sonatypeUsername" )) {
70
+ maven {
71
+ url " https://oss.sonatype.org/service/local/staging/deploy/maven2"
72
+ credentials {
73
+ username = project. properties[" sonatypeUsername" ]
74
+ password = project. properties[" sonatypePassword" ]
75
+ }
76
+ }
69
77
}
70
- links(" https://docs.oracle.com/javase/6/docs/api/" );
71
- links(" https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.1/" );
72
- links(" https://fasterxml.github.com/jackson-databind/javadoc/2.2.0/" );
73
- links(" https://fasterxml.github.com/jackson-core/javadoc/2.2.0/" );
74
- links(" https://fasterxml.github.com/jackson-annotations/javadoc/2.2.0/" );
75
- links(" https://www.javadoc.io/doc/com.google.guava/guava/16.0.1/" );
76
- links(" https://fge.github.io/msg-simple/" );
77
- links(" https://fge.github.io/jackson-coreutils/" );
78
78
}
79
79
80
80
/*
81
- * Repositories to use
81
+ * Add errorprone checking.
82
82
*/
83
- repositories {
84
- mavenCentral();
83
+ dependencies {
84
+ errorprone(" com.google.errorprone:error_prone_core:2.3.3" )
85
+ errorproneJavac(" com.google.errorprone:javac:9+181-r4173-1" )
85
86
}
86
87
87
88
/*
@@ -102,6 +103,20 @@ task sourcesJar(type: Jar, dependsOn: classes) {
102
103
from sourceSets. main. allSource;
103
104
}
104
105
106
+ /*
107
+ * Lint all the things!
108
+ */
109
+ allprojects {
110
+ gradle. projectsEvaluated {
111
+ tasks. withType(JavaCompile ) {
112
+ options. compilerArgs << " -Xlint:all" << " -Xlint:-serial" << " -Werror"
113
+ }
114
+ tasks. withType(Javadoc ) {
115
+ options. addStringOption(' Xwerror' , ' -quiet' )
116
+ }
117
+ }
118
+ }
119
+
105
120
/*
106
121
* Javadoc: we need to tell where the overview.html is, it will not pick it up
107
122
* automatically...
@@ -138,8 +153,7 @@ task pom {
138
153
*/
139
154
140
155
project. ext {
141
- description = " JSON Patch (RFC 6902) and JSON Merge Patch (RFC 7386) implementation in Java" ;
142
- scmUrl
= sprintf (
" [email protected] :java-json-tools/%s.git" , name)
156
+ scmUrl
= sprintf (
" [email protected] :java-json-tools/%s.git" , name);
143
157
projectURL = sprintf (" https://github.com/java-json-tools/%s" , name);
144
158
sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
145
159
sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
@@ -152,7 +166,7 @@ task checkSigningRequirements {
152
166
requiredProperties. each {
153
167
if (project. properties[it] == null ) {
154
168
noDice = true ;
155
- System . err. printf (" property \" %s\" is not defined!" )
169
+ System . err. printf (" property \" %s\" is not defined!\n " , it);
156
170
}
157
171
}
158
172
if (noDice)
@@ -228,7 +242,6 @@ uploadArchives {
228
242
}
229
243
}
230
244
231
- ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
232
245
signing {
233
246
required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
234
247
sign configurations. archives;
0 commit comments