11buildscript {
2- repositories {
3- jcenter()
4- }
5- dependencies {
6- classpath ' ru.vyarus:gradle-animalsniffer-plugin:1.2.0'
7- classpath " com.smokejumperit.gradle.license:Gradle-License-Report:0.0.2"
8- }
2+ repositories {
3+ jcenter()
4+ }
5+ dependencies {
6+ classpath ' ru.vyarus:gradle-animalsniffer-plugin:1.2.0'
7+ classpath " com.smokejumperit.gradle.license:Gradle-License-Report:0.0.2"
8+ }
99}
1010
1111plugins {
12- id ' java'
13- id ' groovy'
14- id ' osgi'
15- id ' net.saliman.cobertura' version ' 2.4.0'
16- id ' com.github.kt3k.coveralls' version ' 2.7.1'
17- id " com.jfrog.bintray" version " 1.7.3"
18- id ' net.researchgate.release' version ' 2.4.0'
12+ id ' java'
13+ id ' groovy'
14+ id ' osgi'
15+ id ' net.saliman.cobertura' version ' 2.4.0'
16+ id ' com.github.kt3k.coveralls' version ' 2.7.1'
17+ id " com.jfrog.bintray" version " 1.7.3"
18+ id ' net.researchgate.release' version ' 2.4.0'
1919}
2020
2121apply plugin : ' license-report'
@@ -30,163 +30,182 @@ sourceCompatibility = 1.5
3030targetCompatibility = 1.5
3131
3232tasks. withType(JavaCompile ) {
33- options. encoding = ' UTF-8'
33+ options. encoding = ' UTF-8'
3434}
3535
3636repositories {
37- mavenCentral()
37+ mavenCentral()
3838}
3939
4040sourceSets {
41- main {
42- java {
43- srcDirs = [' src/main/java' ]
44- }
45- groovy {
46- srcDirs = []
47- }
48- }
49- test {
50- java {
51- srcDirs = []
52- }
53- groovy {
54- srcDirs = [' src/test/java' ]
55- }
56- }
57- intTest {
58- groovy {
59- compileClasspath + = main. output + test. output
60- runtimeClasspath + = main. output + test. output
61- srcDirs = [' src/integration-test/java' ]
62- }
63- }
41+ main {
42+ java {
43+ srcDirs = [' src/main/java' ]
44+ }
45+ groovy {
46+ srcDirs = []
47+ }
48+ }
49+ test {
50+ java {
51+ srcDirs = []
52+ }
53+ groovy {
54+ srcDirs = [' src/test/java' ]
55+ }
56+ }
57+ intTest {
58+ groovy {
59+ compileClasspath + = main. output + test. output
60+ runtimeClasspath + = main. output + test. output
61+ srcDirs = [' src/integration-test/java' ]
62+ }
63+ }
6464}
6565
6666configurations {
67- intTestCompile. extendsFrom testCompile
68- intTestRuntime. extendsFrom testRuntime
67+ intTestCompile. extendsFrom testCompile
68+ intTestRuntime. extendsFrom testRuntime
6969}
7070
7171task intTest (type : Test ) {
72- testClassesDir = sourceSets. intTest. output. classesDir
73- classpath = sourceSets. intTest. runtimeClasspath
72+ testClassesDir = sourceSets. intTest. output. classesDir
73+ classpath = sourceSets. intTest. runtimeClasspath
7474}
7575
7676compileGroovy {
77- // somehow the groovy compile deletes the java compiled classes from the build directory
78- dependsOn = []
77+ // somehow the groovy compile deletes the java compiled classes from the build directory
78+ dependsOn = []
7979}
8080
8181jar {
82- manifest {
83- instruction ' Bundle-Vendor' , ' Daniel Bechler'
84- instruction ' Bundle-DocURL' , ' https://github.com/SQiShER/java-object-diff'
85- instruction ' Export-Package' , ' {local-packages}'
86- }
82+ manifest {
83+ instruction ' Bundle-Vendor' , ' Daniel Bechler'
84+ instruction ' Bundle-DocURL' , ' https://github.com/SQiShER/java-object-diff'
85+ instruction ' Export-Package' , ' {local-packages}'
86+ }
8787}
8888
8989dependencies {
90- signature ' org.codehaus.mojo.signature:java15:1.0@signature'
91- signature ' org.codehaus.mojo.signature:java16:1.1@signature'
92- signature ' org.codehaus.mojo.signature:java17:1.0@signature'
93- // For Android support:
94- // signature 'net.sf.androidscents.signature:android-api-level-23:6.0_r3@signature'
95- compile group : ' org.slf4j' , name : ' slf4j-api' , version : ' 1.7.18'
96- testCompile group : ' org.codehaus.groovy' , name : ' groovy-all' , version : ' 2.4.7'
97- testCompile group : ' ch.qos.logback' , name : ' logback-core' , version : ' 1.1.6'
98- testCompile group : ' ch.qos.logback' , name : ' logback-classic' , version : ' 1.1.6'
99- testCompile group : ' org.spockframework' , name : ' spock-core' , version : ' 1.0-groovy-2.4'
100- testCompile group : ' cglib' , name : ' cglib-nodep' , version : ' 3.2.1'
101- testCompile group : ' org.objenesis' , name : ' objenesis' , version : ' 2.2'
90+ signature ' org.codehaus.mojo.signature:java15:1.0@signature'
91+ signature ' org.codehaus.mojo.signature:java16:1.1@signature'
92+ signature ' org.codehaus.mojo.signature:java17:1.0@signature'
93+ // For Android support:
94+ // signature 'net.sf.androidscents.signature:android-api-level-23:6.0_r3@signature'
95+ compile group : ' org.slf4j' , name : ' slf4j-api' , version : ' 1.7.18'
96+ testCompile group : ' org.codehaus.groovy' , name : ' groovy-all' , version : ' 2.4.7'
97+ testCompile group : ' ch.qos.logback' , name : ' logback-core' , version : ' 1.1.6'
98+ testCompile group : ' ch.qos.logback' , name : ' logback-classic' , version : ' 1.1.6'
99+ testCompile group : ' org.spockframework' , name : ' spock-core' , version : ' 1.0-groovy-2.4'
100+ testCompile group : ' cglib' , name : ' cglib-nodep' , version : ' 3.2.1'
101+ testCompile group : ' org.objenesis' , name : ' objenesis' , version : ' 2.2'
102102}
103103
104104cobertura {
105- coverageFormats = [' html' , ' xml' ]
106- coverageIgnoreTrivial = true
105+ coverageFormats = [' html' , ' xml' ]
106+ coverageIgnoreTrivial = true
107107}
108108
109109bintray {
110- user = System . getenv(' BINTRAY_USER' )
111- key = System . getenv(' BINTRAY_KEY' )
112- publications = [' mavenJava' ]
113- publish = true
114- override = true
115- pkg {
116- repo = ' maven'
117- name = ' java-object-diff'
118- licenses = [' Apache-2.0' ]
119- vcsUrl = ' https://github.com/SQiShER/java-object-diff.git'
120- githubRepo = ' SQiShER/java-object-diff'
121- githubReleaseNotesFile = ' README.md'
122- version {
123- name = project. version
124- released = new Date ()
125- vcsTag = rootProject. name + ' -' + project. version
126- gpg {
127- sign = true
128- passphrase = System . getenv(' BINTRAY_GPG_PASSPHRASE' )
129- }
130- }
131- }
110+ user = System . getenv(' BINTRAY_USER' )
111+ key = System . getenv(' BINTRAY_KEY' )
112+ publications = [' mavenJava' ]
113+ publish = true
114+ override = true
115+ pkg {
116+ repo = ' maven'
117+ name = ' java-object-diff'
118+ licenses = [' Apache-2.0' ]
119+ vcsUrl = ' https://github.com/SQiShER/java-object-diff.git'
120+ githubRepo = ' SQiShER/java-object-diff'
121+ githubReleaseNotesFile = ' README.md'
122+ version {
123+ name = project. version
124+ released = new Date ()
125+ vcsTag = rootProject. name + ' -' + project. version
126+ gpg {
127+ sign = true
128+ passphrase = System . getenv(' BINTRAY_GPG_PASSPHRASE' )
129+ }
130+ }
131+ }
132132}
133133
134134javadoc {
135- failOnError = false
135+ failOnError = false
136136}
137137
138138task sourcesJar (type : Jar , dependsOn : classes) {
139- classifier = ' sources'
140- from sourceSets. main. allSource
139+ classifier = ' sources'
140+ from sourceSets. main. allSource
141141}
142142
143143task javadocJar (type : Jar , dependsOn : javadoc) {
144- classifier = ' javadoc'
145- from javadoc. destinationDir
144+ classifier = ' javadoc'
145+ from javadoc. destinationDir
146146}
147147
148148artifacts {
149- archives sourcesJar, javadocJar
149+ archives sourcesJar, javadocJar
150150}
151151
152152def pomConfig = {
153- licenses {
154- license {
155- name " The Apache Software License, Version 2.0"
156- url " http://www.apache.org/licenses/LICENSE-2.0.txt"
157- distribution " repo"
158- }
159- }
160- developers {
161- developer {
162- id " sqisher"
163- name " Daniel Bechler"
164- url " https://github.com/SQiShER"
165- }
166- }
153+ licenses {
154+ license {
155+ name " The Apache Software License, Version 2.0"
156+ url " http://www.apache.org/licenses/LICENSE-2.0.txt"
157+ distribution " repo"
158+ }
159+ }
160+ developers {
161+ developer {
162+ id " sqisher"
163+ name " Daniel Bechler"
164+ url " https://github.com/SQiShER"
165+ }
166+ }
167167}
168168
169169publishing {
170- publications {
171- mavenJava(MavenPublication ) {
172- from components. java
173- artifact sourcesJar
174- artifact javadocJar
175- pom. withXml {
176- def root = asNode()
177- root. appendNode(' description' , ' Library to diff and merge Java objects with ease' )
178- root. appendNode(' name' , ' java-object-diff' )
179- root. appendNode(' url' , ' https://github.com/SQiShER/java-object-diff' )
180- root. children(). last() + pomConfig
181- }
182- }
183- }
170+ publications {
171+ mavenJava(MavenPublication ) {
172+ from components. java
173+ artifact sourcesJar
174+ artifact javadocJar
175+ pom. withXml {
176+ def root = asNode()
177+ root. appendNode(' description' , ' Library to diff and merge Java objects with ease' )
178+ root. appendNode(' name' , ' java-object-diff' )
179+ root. appendNode(' url' , ' https://github.com/SQiShER/java-object-diff' )
180+ root. children(). last() + pomConfig
181+ }
182+ }
183+ }
184184}
185185
186186release {
187- tagTemplate = ' $name-$version'
188- failOnCommitNeeded = false
189- failOnPublishNeeded = false
187+ tagTemplate = ' $name-$version'
188+ failOnCommitNeeded = false
189+ failOnPublishNeeded = false
190190}
191191
192- afterReleaseBuild. dependsOn bintrayUpload
192+ @SuppressWarnings (" GroovyAssignabilityCheck" )
193+ static processFileInplace (File file , Closure processText ) {
194+ String text = file. text
195+ file. write(processText(text))
196+ }
197+ 198+ task updateDocs {
199+ doLast {
200+ def updateVersion = { String text ->
201+ text = text. replaceAll(' <version>[^<]+</version>' , " <version>${ version} </version>" )
202+ text = text. replaceAll(' de\\ .danielbechler:java-object-diff:[0-9-A-Z\\ -.]+' , " de.danielbechler:java-object-diff:${ version} " )
203+ return text
204+ }
205+ processFileInplace(file(' README.md' ), updateVersion)
206+ processFileInplace(file(' docs/maven.md' ), updateVersion)
207+ }
208+ }
209+ 210+ afterReleaseBuild. dependsOn bintrayUpload
211+ afterReleaseBuild. dependsOn updateDocs
0 commit comments