1- /* * Copyright (c) 2014, Francis Galiegue ([email protected] )1+ /*
2+ * Copyright (c) 2014, Francis Galiegue ([email protected] ) 23 *
34 * This software is dual-licensed under:
45 *
1819
1920buildscript {
2021 repositories {
22+ mavenCentral()
2123 maven {
2224 url " http://repo.springsource.org/plugins-release" ;
2325 }
2426 }
2527 dependencies {
28+ classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
2629 classpath(group : " org.springframework.build.gradle" , name : " propdeps-plugin" , version : " 0.0.7" );
2730 }
2831};
2932
33+ plugins {
34+ id(" net.ltgt.errorprone" ) version " 0.8.1" apply false
35+ }
36+
3037configure(allprojects) {
3138 apply(plugin : " propdeps" );
3239 apply(plugin : " propdeps-maven" );
@@ -37,51 +44,45 @@ configure(allprojects) {
3744apply(plugin : " java" );
3845apply(plugin : " maven" );
3946apply(plugin : " signing" );
40- apply(plugin : " osgi " );
47+ apply(plugin : " biz.aQute.bnd.builder " );
4148apply(plugin : " idea" );
4249apply(plugin : " eclipse" );
50+ apply(plugin : " net.ltgt.errorprone" );
51+
52+ apply(from : " project.gradle" );
4353
4454group = " 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" );
4857
4958/*
50- * List of dependencies
59+ * Repositories to use
5160 */
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+ }
6977 }
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/" );
7878}
7979
8080/*
81- * Repositories to use
81+ * Add errorprone checking.
8282 */
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" )
8586}
8687
8788/*
@@ -102,6 +103,20 @@ task sourcesJar(type: Jar, dependsOn: classes) {
102103 from sourceSets. main. allSource;
103104}
104105
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+
105120/*
106121 * Javadoc: we need to tell where the overview.html is, it will not pick it up
107122 * automatically...
@@ -138,8 +153,7 @@ task pom {
138153 */
139154
140155project. 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);
143157 projectURL = sprintf (" https://github.com/java-json-tools/%s" , name);
144158 sonatypeStaging = " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ;
145159 sonatypeSnapshots = " https://oss.sonatype.org/content/repositories/snapshots/" ;
@@ -152,7 +166,7 @@ task checkSigningRequirements {
152166 requiredProperties. each {
153167 if (project. properties[it] == null ) {
154168 noDice = true ;
155- System . err. printf (" property \" %s\" is not defined!" )
169+ System . err. printf (" property \" %s\" is not defined!\n " , it);
156170 }
157171 }
158172 if (noDice)
@@ -228,7 +242,6 @@ uploadArchives {
228242 }
229243}
230244
231- ext. forRelease = ! version. endsWith(" -SNAPSHOT" );
232245signing {
233246 required { forRelease && gradle. taskGraph. hasTask(" uploadArchives" ) };
234247 sign configurations. archives;
0 commit comments