@@ -5,6 +5,39 @@ plugins {
55 id ' idea'
66}
77
8+ apply plugin : ' com.jfrog.bintray'
9+ apply plugin : ' maven'
10+ apply plugin : ' maven-publish'
11+
12+ task ciVersion {
13+ description = " Creates a continuous-delivery friendly version number for the service"
14+
15+ def releaseType = project. hasProperty(' releaseType' ) ? project. property(' releaseType' ) : System . getenv(' RELEASE_TYPE' )
16+ def commitHash = project. hasProperty(' commitHash' ) ? project. property(' commitHash' ) : System . getenv(' COMMIT_HASH' )
17+
18+ if (releaseType == ' release' || releaseType == ' r' ) {
19+ project. version = project. version
20+ } else if (releaseType == ' releaseCandidate' || releaseType == ' rc' ) {
21+ project. version = " ${ project.version} -RC" . toString()
22+ } else if (releaseType == ' snapshot' || releaseType == ' s' ) {
23+ if (commitHash) {
24+ project. version = " ${ project.version} -SNAPSHOT-${ commitHash} " . toString()
25+ } else {
26+ project. version = " ${ project.version} -SNAPSHOT" . toString()
27+ }
28+ } else {
29+ logger. info(" Property 'releaseType' was not specified. Defaulting to 'snapshot'" )
30+ if (commitHash) {
31+ project. version = " ${ project.version} -SNAPSHOT-${ commitHash} " . toString()
32+ } else {
33+ project. version = " ${ project.version} -SNAPSHOT" . toString()
34+ }
35+ }
36+
37+ println " Setting CI Version for '${ project.name} ': ${ version} "
38+ }
39+ build. dependsOn ciVersion
40+
841def proteusPrefix = " proteus-java-${ osdetector.os} -${ osdetector.arch} "
942def proteusName = " ${ proteusPrefix} .exe"
1043def artifactStagingPath = " $buildDir /artifacts" as File
@@ -185,13 +218,77 @@ artifacts {
185218 }
186219}
187220
188- publishing {
189- publications {
190- maven(MavenPublication ) {
191- artifactId " ${ project.ext.artifactName} "
192- artifact(pathToPlugin) {
193- classifier osdetector. os + " -" + osdetector. arch
194- builtBy buildArtifacts
221+ // publishing {
222+ // publications {
223+ // maven(MavenPublication) {
224+ // artifactId "${project.ext.artifactName}"
225+ // artifact(pathToPlugin) {
226+ // classifier osdetector.os + "-" + osdetector.arch
227+ // builtBy buildArtifacts
228+ // }
229+ // }
230+ // }
231+ // }
232+
233+
234+ if (" $version " . contains(' SNAPSHOT' )) {
235+ publishing {
236+ publications {
237+ maven(MavenPublication ) {
238+ artifactId " ${ project.ext.artifactName} "
239+ artifact(pathToPlugin) {
240+ classifier osdetector. os + " -" + osdetector. arch
241+ builtBy buildArtifacts
242+ }
243+ }
244+ }
245+ repositories {
246+ maven {
247+ url = version. contains(' SNAPSHOT' ) ? ' https://artifactory.netifiinc.com/artifactory/libs-snapshot-local' : ' https://artifactory.netifiinc.com/artifactory/libs-release-local'
248+ credentials {
249+ username = project. hasProperty(' netifiArtifactoryUsername' ) ? project. property(' netifiArtifactoryUsername' ) : System . getenv(' NETIFI_ARTIFACTORY_USERNAME' )
250+ password = project. hasProperty(' netifiArtifactoryPassword' ) ? project. property(' netifiArtifactoryPassword' ) : System . getenv(' NETIFI_ARTIFACTORY_PASSWORD' )
251+ }
252+ }
253+ }
254+ }
255+ } else {
256+ publishing {
257+ publications {
258+ maven(MavenPublication ) {
259+ artifactId " ${ project.ext.artifactName} "
260+ artifact(pathToPlugin) {
261+ classifier osdetector. os + " -" + osdetector. arch
262+ builtBy buildArtifacts
263+ }
264+ }
265+ }
266+ }
267+
268+ bintray {
269+ user = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
270+ key = project. hasProperty(' bintrayKey' ) ? project. property(' bintrayKey' ) : System . getenv(' f' )
271+
272+ publications = [' maven' ]
273+
274+ // dryRun = true
275+ publish = (osdetector. os == ' osx' )
276+ override = true
277+
278+ pkg {
279+ repo = ' netifi-oss'
280+ name = " ${ artifactName} " . toString()
281+ userOrg = ' netifi'
282+ desc = " ${ project.description} "
283+ websiteUrl = ' https://github.com/netifi-proteus/proteus-java'
284+ issueTrackerUrl = ' https://github.com/netifi-proteus/proteus-java/issues'
285+ vcsUrl = ' https://github.com/netifi-proteus/proteus-java.git'
286+ licenses = [' Apache-2.0' ]
287+ githubRepo = ' netifi-proteus/proteus-java'
288+ githubReleaseNotesFile = ' CHANGELOG.md'
289+
290+ version {
291+ name = " $project . version " . toString()
195292 }
196293 }
197294 }
0 commit comments