11plugins {
2+ id " com.diffplug.blowdryer"
23 id " com.github.ben-manes.versions"
34 id " com.diffplug.gradle.osgi.bndmanifest"
45 id " com.diffplug.gradle.spotless"
56 id " com.jfrog.bintray"
67 id " com.github.spotbugs" version ' 3.0.0'
78}
89
9- repositories {
10- mavenCentral()
11- // SNAPSHOT versions are free to rely on other SNAPSHOT libraries
12- if (project. version. endsWith(' -SNAPSHOT' )) {
13- maven {
14- url ' https://oss.sonatype.org/content/repositories/snapshots/'
15- }
16- configurations. all {
17- resolutionStrategy. cacheChangingModulesFor 0 , ' seconds'
18- }
19- }
20- }
21-
22- // ////////
23- // JAVA //
24- // ////////
2510apply plugin : ' java-library'
26- sourceCompatibility = VER_JAVA
27- targetCompatibility = VER_JAVA
28-
11+ apply from : 干. file(' base/java8.gradle' )
12+ apply from : 干. file(' base/osgi.gradle' )
2913dependencies {
3014 implementation " com.diffplug.durian:durian-core:${ VER_DURIAN} "
3115 implementation " com.diffplug.durian:durian-collect:${ VER_DURIAN} "
@@ -36,41 +20,6 @@ dependencies {
3620 testImplementation " com.diffplug.durian:durian-debug:${ VER_DURIAN_DEBUG} "
3721}
3822
39- // ////////
40- // OSGI //
41- // ////////
42- jar. manifest. attributes (
43- ' Bundle-SymbolicName' : ' com.diffplug.durian.rx' ,
44- ' Bundle-Description' : project. description,
45- ' Export-Package' : ' com.diffplug.common.rx.*' ,
46- ' Bundle-RequiredExecutionEnvironment' : ' JavaSE-1.8' ,
47- ' Bundle-Vendor' : ' DiffPlug' ,
48- ' Bundle-DocURL' : " https://github.com/${ project.org} /${ project.name} " ,
49- ' Bundle-License' : " https://github.com/${ project.org} /${ project.name} /blob/v${ project.version} /LICENSE" ,
50- ' -removeheaders' : ' Bnd-LastModified,Bundle-Name,Created-By,Tool' ,
51- )
52- // copy the manifest into the WC
53- osgiBndManifest {
54- copyTo ' src/main/resources/META-INF/MANIFEST.MF'
55- }
56-
57- // ///////////
58- // ECLIPSE //
59- // ///////////
60- apply plugin : ' eclipse'
61- eclipse {
62- classpath {
63- downloadSources true
64- downloadJavadoc true
65- }
66- jdt {
67- sourceCompatibility VER_JAVA
68- targetCompatibility VER_JAVA
69- }
70- }
71- // always create fresh projects
72- tasks. eclipse. dependsOn(cleanEclipse)
73-
7423// //////////
7524// FORMAT //
7625// //////////
@@ -157,92 +106,3 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
157106 classifier = ' javadoc'
158107 from javadoc. destinationDir
159108}
160-
161- // //////////////
162- // PUBLISHING //
163- // //////////////
164- def isSnapshot = project. version. endsWith(' -SNAPSHOT' )
165- // pulls the credentials from either the environment variable or gradle.properties
166- def cred = {
167- if (System . env[it] != null ) {
168- return System . env[it]
169- } else if (project. hasProperty(it)) {
170- return project[it]
171- } else {
172- return ' unknown_' + it
173- }
174- }
175-
176- publishing {
177- publications {
178- mavenJava(MavenPublication ) {
179- from components. java
180- artifact sourcesJar
181- artifact javadocJar
182- pom. withXml {
183- // findbugs annotations should have scope "provided"
184- asNode(). dependencies. ' *' . findAll() { it. groupId. text() == ' com.google.code.findbugs' }. each() { it. scope* . value = ' provided' }
185- // add MavenCentral requirements to the POM
186- asNode(). children(). last() + {
187- resolveStrategy = Closure . DELEGATE_FIRST
188- name project. name
189- description project. description
190- url " https://github.com/${ project.org} /${ project.name} "
191- scm {
192- url " https://github.com/${ project.org} /${ project.name} "
193- connection " scm:git:git://github.com/${ project.org} /${ project.name} "
194- developerConnection
" scm:git:ssh:[email protected] /${ project.org} /${ project.name} " 195- }
196- licenses {
197- license {
198- name ' The Apache Software License, Version 2.0'
199- url ' http://www.apache.org/license/LICENSE-2.0.txt'
200- distribution ' repo'
201- }
202- }
203- developers {
204- developer {
205- id ' nedtwigg'
206- name ' Ned Twigg'
207- 208- }
209- }
210- }
211- }
212- }
213- }
214- if (isSnapshot) {
215- // upload snapshots to oss.sonatype.org
216- repositories { maven {
217- url = ' https://oss.sonatype.org/content/repositories/snapshots'
218- credentials {
219- username = cred(' nexus_user' )
220- password = cred(' nexus_pass' )
221- }
222- } }
223- }
224- }
225-
226- if (! isSnapshot) {
227- // upload releases to bintray and then mavenCentral
228- bintray {
229- user = cred(' bintray_user' )
230- key = cred(' bintray_pass' )
231- publications = [' mavenJava' ]
232- publish = true
233- pkg {
234- repo = ' opensource'
235- name = project. name
236- userOrg = project. org
237- version {
238- name = project. version
239- mavenCentralSync {
240- user = cred(' nexus_user' )
241- password = cred(' nexus_pass' )
242- }
243- }
244- }
245- }
246- publish. dependsOn(bintrayUpload)
247- bintrayUpload. dependsOn([' generatePomFileForMavenJavaPublication' , jar, sourcesJar, javadocJar])
248- }
0 commit comments