From 142d7bebae3ed8f988557294093eff9e516fc7b1 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Thu, 28 Jan 2016 22:06:21 +0100 Subject: [PATCH 1/8] build: upload on bintray from travis when a git tag is set and it starts by jmeMainVersion --- .travis.yml | 3 +++ bintray.gradle | 26 ++++++++++++++++++++++++++ build.gradle | 8 ++++++-- common.gradle | 2 +- gradle.properties | 4 ++++ version.gradle | 6 +++++- 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 bintray.gradle diff --git a/.travis.yml b/.travis.yml index 48e75d0b4..8874544b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,3 +54,6 @@ before_install: # wget http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin -O ndk.bin # 7z x ndk.bin -y > /dev/null # export ANDROID_NDK=`pwd`/android-ndk-r10c + +after_success: + - '[ -n "$TRAVIS_TAG"" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :' diff --git a/bintray.gradle b/bintray.gradle new file mode 100644 index 000000000..74671c6a5 --- /dev/null +++ b/bintray.gradle @@ -0,0 +1,26 @@ +// +// This file is to be applied to some subproject. +// + +apply plugin: 'com.jfrog.bintray' + +bintray { + user = bintray_user + key = bintray_api_key + configurations = ['archives'] + pkg { + repo = 'org.jmonkeyengine' + userOrg = 'jmonkeyengine' + name = project.name + desc = POM_DESCRIPTION + websiteUrl = POM_URL + licenses = ['BSD New'] + vcsUrl = POM_SCM_CONNECTION + labels = ['jmonkeyengine'] + } +} + +bintrayUpload.onlyIf { + (bintray_api_key.length() > 0) && + !(version ==~ /.*SNAPSHOT/) +} diff --git a/build.gradle b/build.gradle index 192bc32d3..2d4fe1e3d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,11 @@ import org.gradle.api.artifacts.* buildscript { repositories { - mavenCentral() + jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.5' } } @@ -17,6 +18,9 @@ apply from: file('upload.gradle') subprojects { if(!project.name.equals('jme3-android-examples')) { apply from: rootProject.file('common.gradle') + if (!['jme3-testdata', 'sdk'].contains(project.name)) { + apply from: rootProject.file('bintray.gradle') + } } else { apply from: rootProject.file('common-android-app.gradle') } @@ -174,4 +178,4 @@ task configureAndroidNDK { // tasks.withType(Test) { // enableAssertions = true // true by default // } -//} \ No newline at end of file +//} diff --git a/common.gradle b/common.gradle index 237ee5e7f..5da5ce9d1 100644 --- a/common.gradle +++ b/common.gradle @@ -5,7 +5,7 @@ apply plugin: 'java' apply plugin: 'maven' -group = 'com.jme3' +group = 'org.jmonkeyengine' version = jmePomVersion sourceCompatibility = '1.6' diff --git a/gradle.properties b/gradle.properties index 4380c31a0..f4c74445a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -37,3 +37,7 @@ POM_SCM_DEVELOPER_CONNECTION=scm:git:git@github.com:jMonkeyEngine/jmonkeyengine. POM_LICENSE_NAME=New BSD (3-clause) License POM_LICENSE_URL=http://opensource.org/licenses/BSD-3-Clause POM_LICENSE_DISTRIBUTION=repo + +# Bintray settings to override in $HOME/.gradle/gradle.properties or ENV or commandline +bintray_user= +bintray_api_key= diff --git a/version.gradle b/version.gradle index 40e934278..55982039b 100644 --- a/version.gradle +++ b/version.gradle @@ -76,7 +76,11 @@ task configureVersionInfo { jmeFullVersion = jmeMainVersion jmePomVersion = jmeVersion - if (jmeBranchName != "master") { + if (jmeGitTag.startsWith(jmeMainVersion)) { + jmeVersionTag = "" + jmePomVersion = jmeGitTag + } + if (jmeBranchName != "master" && jmeVersionTag == "SNAPSHOT") { jmeFullVersion += "-${jmeBranchName}" jmePomVersion += "-${jmeBranchName}" From 2aca942b1bc34f9d3b78e30bafd4d81d4668e727 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Sat, 6 Feb 2016 10:47:57 +0100 Subject: [PATCH 2/8] build: use the same custom pom file for 'install', 'uploadArchives' and 'uploadBintray'. A custom pom with minimal information required to maven central --- bintray.gradle | 5 ++- common.gradle | 90 ++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/bintray.gradle b/bintray.gradle index 74671c6a5..0deafc8cf 100644 --- a/bintray.gradle +++ b/bintray.gradle @@ -8,6 +8,7 @@ bintray { user = bintray_user key = bintray_api_key configurations = ['archives'] + dryRun = false pkg { repo = 'org.jmonkeyengine' userOrg = 'jmonkeyengine' @@ -15,11 +16,13 @@ bintray { desc = POM_DESCRIPTION websiteUrl = POM_URL licenses = ['BSD New'] - vcsUrl = POM_SCM_CONNECTION + vcsUrl = POM_SCM_URL labels = ['jmonkeyengine'] } } +bintrayUpload.dependsOn(writeFullPom) + bintrayUpload.onlyIf { (bintray_api_key.length() > 0) && !(version ==~ /.*SNAPSHOT/) diff --git a/common.gradle b/common.gradle index 5da5ce9d1..a85abe742 100644 --- a/common.gradle +++ b/common.gradle @@ -61,12 +61,84 @@ task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from from javadoc.destinationDir } +def pomConfig = { + name POM_NAME + description POM_DESCRIPTION + url POM_URL + inceptionYear '2016' + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEVELOPER_CONNECTION + } + licenses { + license { + name POM_LICENSE_NAME + url POM_LICENSE_URL + distribution POM_LICENSE_DISTRIBUTION + } + } + // from http://hub.jmonkeyengine.org/introduction/team/ + developers { + developer { + name 'Kirill Vainer' + id 'Momoko_Fan' + } + developer { + name 'Erlend Sogge Heggen' + id 'erlend_sh' + } + developer { + name 'Skye Book' + id 'sbook' + } + developer { + name 'Normen Hansen' + id 'normen' + } + developer { + name 'Ruth Kusterer' + id 'zathras' + } + developer { + name 'Rémy Bouquet' + id 'nehon' + } + developer { + name 'Paul Speed' + id 'pspeed' + } + developer { + name 'Brent Owens' + id 'Sploreg' + } + developer { + name 'Eric Potter' + id 'iwgeric' + } + } +} + +// workaround to be able to use same custom pom with 'maven' and 'bintray' plugin +task writeFullPom { + ext.pomFile = "$mavenPomDir/${project.name}-${project.version}.pom" + outputs.file pomFile + doLast { + pom { + project pomConfig + }.writeTo(pomFile) + } +} +install.dependsOn(writeFullPom) +uploadArchives.dependsOn(writeFullPom) + artifacts { archives jar archives sourcesJar if(buildJavaDoc == "true"){ archives javadocJar } + archives writeFullPom.outputs.files[0] } uploadArchives { @@ -80,23 +152,7 @@ uploadArchives { authentication(userName: "www-updater", privateKey: "private/www-updater.key") } - pom.project { - name POM_NAME - description POM_DESCRIPTION - url POM_URL - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEVELOPER_CONNECTION - } - licenses { - license { - name POM_LICENSE_NAME - url POM_LICENSE_URL - distribution POM_LICENSE_DISTRIBUTION - } - } - } + pom.project pomConfig } } From 80c11a5f0257bd23651ab34b6ead47710564289c Mon Sep 17 00:00:00 2001 From: David Bernard Date: Sat, 6 Feb 2016 11:04:22 +0100 Subject: [PATCH 3/8] build: fix sdk build failure due to writeFullPom --- common.gradle | 1 + sdk/build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/common.gradle b/common.gradle index a85abe742..c8fb251ba 100644 --- a/common.gradle +++ b/common.gradle @@ -129,6 +129,7 @@ task writeFullPom { }.writeTo(pomFile) } } +assemble.dependsOn(writeFullPom) install.dependsOn(writeFullPom) uploadArchives.dependsOn(writeFullPom) diff --git a/sdk/build.gradle b/sdk/build.gradle index 99c850987..1a841ef0e 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -109,6 +109,7 @@ task createBaseXml(dependsOn: configurations.corelibs) <<{ dep.dependencyProject.configurations.archives.allArtifacts.each{ artifact-> if(artifact.classifier == "sources"){ } else if(artifact.classifier == "javadoc"){ + } else if(artifact.file.name.endsWith('.pom')) { } else{ if(!jmeJarFiles.contains(artifact.file)){ jmeJarFiles.add(artifact.file) From 9416387111b88fae4e8ccc7aa9a5cca7789d4097 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 23 Feb 2016 14:32:24 +0100 Subject: [PATCH 4/8] =?UTF-8?q?build:=20release=20version=20defined=20from?= =?UTF-8?q?=20tag=20in=20format=20=E2=80=9CvX.Y.Z=E2=80=9D=20and=20?= =?UTF-8?q?=E2=80=9CvX.Y.Z-M=E2=80=9D.=20Refactor=20to=20clearly=20split?= =?UTF-8?q?=20behaviour=20when=20release=20(based=20on=20tag)=20or=20not?= =?UTF-8?q?=20(SNAPSHOT).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version.gradle | 139 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 47 deletions(-) diff --git a/version.gradle b/version.gradle index 55982039b..501132ac5 100644 --- a/version.gradle +++ b/version.gradle @@ -3,27 +3,31 @@ ===================== Nightly Build Snapshot + * git tag: * Full Version: 3.1-5124 * POM Version: 3.1.0-SNAPSHOT * NBM Revision: 5124 * NBM UC Suffix: nightly/3.1/plugins Nightly Build Snapshot (PBRIsComing branch) + * git tag: * Full Version: 3.1-PBRIsComing-5124 * POM Version: 3.1.0-PBRIsComing-SNAPSHOT * NBM Revision: 5124 * NBM UC Suffix: PBRIsComing-nightly/3.1/plugins Alpha1 Release + * git tag: v3.1.0-alpha1 * Full Version: 3.1-alpha1 * POM Version: 3.1.0-alpha1 - * NBM Revision: 1 + * NBM Revision: 0 * NBM UC Suffix: stable/3.1/plugins Final Release + * git tag: v3.1.0 * Full Version: 3.1 * POM Version: 3.1.0 - * NBM Revision: 5 + * NBM Revision: 0 * NBM UC Suffix: stable/3.1/plugins */ @@ -52,6 +56,63 @@ ext { jmeNbmUcSuffix = "unknown" } +def getReleaseInfo(String tag) { + if (tag == null) { + // not a tagged commit + return null; + } + if (!tag.startsWith("v")) { + // syntax error + return null; + } + tag = tag.substring(1) + + String[] parts = tag.split("-"); + String mainVersion; + boolean prerelease; + String releaseName = null; + + if (parts.length == 2) { + // prerelease + prerelease = true; + mainVersion = parts[0]; + releaseName = parts[1]; + if (releaseName.size() == 0) { + // syntax error + return null; + } + } else if (parts.length == 1) { + // final release + prerelease = false; + mainVersion = parts[0]; + } else { + // error + return null; + } + + if (mainVersion.size() == 0) { + // syntax error + return null; + } + + parts = mainVersion.split("\\."); + if (parts.size() != 3) { + // syntax error + return null; + } + + String baseVersion = parts[0] + "." + parts[1]; + + return [ + "tag" : tag, + "baseVersion" : baseVersion, + "mainVersion" : mainVersion, + "prerelease" : prerelease, + "releaseName" : releaseName, + "releaseSuffix": (prerelease ? "-${releaseName}": "") + ] +} + task configureVersionInfo { try { def grgit = Grgit.open(project.file('.')) @@ -59,56 +120,40 @@ task configureVersionInfo { jmeGitHash = grgit.head().id jmeShortGitHash = grgit.head().abbreviatedId jmeBranchName = grgit.branch.current.name - jmeGitTag = grgit.describe() - if (jmeGitTag == null) jmeGitTag = "" - - if (System.env.TRAVIS_BRANCH != null) { - jmeBranchName = System.env.TRAVIS_BRANCH - } - if (System.env.TRAVIS_TAG != null) { - jmeGitTag = System.env.TRAVIS_TAG - } - if (System.env.TRAVIS_PULL_REQUEST != null && - System.env.TRAVIS_PULL_REQUEST != "false") { - jmeBranchName += "-pr-" + System.env.TRAVIS_PULL_REQUEST - } - - jmeFullVersion = jmeMainVersion - jmePomVersion = jmeVersion - - if (jmeGitTag.startsWith(jmeMainVersion)) { - jmeVersionTag = "" - jmePomVersion = jmeGitTag - } - if (jmeBranchName != "master" && jmeVersionTag == "SNAPSHOT") { - jmeFullVersion += "-${jmeBranchName}" - jmePomVersion += "-${jmeBranchName}" - - jmeNbmUcSuffix = "${jmeBranchName}-" - } else { - jmeNbmUcSuffix = "" - } - - if (jmeVersionTag == "SNAPSHOT") { - jmeNbmUcSuffix += "nightly" + //gtgit.describe doesn't behave like git describe and it doens't support any option + //jmeGitTag = grgit.describe() ?: System.env.TRAVIS_TAG + jmeGitTag = "git describe --tags --exact-match --dirty".execute().text.trim() ?: System.env.TRAVIS_TAG + + def releaseInfo = getReleaseInfo(jmeGitTag) + if (releaseInfo != null) { + jmeFullVersion = "${releaseInfo.baseVersion}${releaseInfo.releaseSuffix}" + jmePomVersion = "${releaseInfo.mainVersion}${releaseInfo.releaseSuffix}" + jmeNbmRevision = "0" + jmeNbmUcSuffix = "stable/${releaseInfo.baseVersion}/plugins" } else { - jmeNbmUcSuffix += "stable" - } - - jmeNbmUcSuffix += "/" + jmeMainVersion + "/plugins" - - if (jmeVersionTag == "SNAPSHOT") { + // SNAPSHOT + jmeFullVersion = jmeMainVersion + jmePomVersion = jmeVersion + if (System.env.TRAVIS_BRANCH != null) { + jmeBranchName = System.env.TRAVIS_BRANCH + } + if (System.env.TRAVIS_PULL_REQUEST != null && + System.env.TRAVIS_PULL_REQUEST != "false") { + jmeBranchName += "-pr-" + System.env.TRAVIS_PULL_REQUEST + } + if (jmeBranchName != "master") { + jmeFullVersion += "-${jmeBranchName}" + jmePomVersion += "-${jmeBranchName}" + jmeNbmUcSuffix = "${jmeBranchName}-" + } else { + jmeNbmUcSuffix = "" + } + jmeNbmUcSuffix += "nightly/" + jmeMainVersion + "/plugins" jmeFullVersion += "-${jmeRevision}" jmePomVersion += "-SNAPSHOT" jmeNbmRevision = jmeRevision - } else if (jmeVersionTag == "") { - jmeNbmRevision = jmeVersionTagID - } else { - jmeFullVersion += "-${jmeVersionTag}" - jmePomVersion += "-${jmeVersionTag}" - jmeNbmRevision = jmeVersionTagID } - + logger.warn("Full Version: ${jmeFullVersion}") logger.warn("POM Version: ${jmePomVersion}") logger.warn("NBM Revision: ${jmeNbmRevision}") From f39ff628643c23fed59d4ff5ebb326db07d51efd Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 23 Feb 2016 14:37:46 +0100 Subject: [PATCH 5/8] =?UTF-8?q?build:=20replace=20developers=20list=20by?= =?UTF-8?q?=20generic=20=E2=80=98jMonkeyEngine=20Team=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.gradle | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/common.gradle b/common.gradle index c8fb251ba..d275c19f5 100644 --- a/common.gradle +++ b/common.gradle @@ -81,40 +81,8 @@ def pomConfig = { // from http://hub.jmonkeyengine.org/introduction/team/ developers { developer { - name 'Kirill Vainer' - id 'Momoko_Fan' - } - developer { - name 'Erlend Sogge Heggen' - id 'erlend_sh' - } - developer { - name 'Skye Book' - id 'sbook' - } - developer { - name 'Normen Hansen' - id 'normen' - } - developer { - name 'Ruth Kusterer' - id 'zathras' - } - developer { - name 'Rémy Bouquet' - id 'nehon' - } - developer { - name 'Paul Speed' - id 'pspeed' - } - developer { - name 'Brent Owens' - id 'Sploreg' - } - developer { - name 'Eric Potter' - id 'iwgeric' + name 'jMonkeyEngine Team' + id 'jMonkeyEngine' } } } From 4815016906529fb05686d52fb8ff210dbd03acc7 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 23 Feb 2016 17:02:30 +0100 Subject: [PATCH 6/8] build: travis move uploadArchives to after_success section --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8874544b0..519094ed7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,6 @@ install: script: - ./gradlew check - ./gradlew createZipDistribution - - "[ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST == 'false' ] && ./gradlew uploadArchives || :" before_deploy: - export RELEASE_DIST=$(ls build/distributions/*.zip) @@ -56,4 +55,5 @@ before_install: # export ANDROID_NDK=`pwd`/android-ndk-r10c after_success: + - '[ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :' - '[ -n "$TRAVIS_TAG"" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :' From 8e866561b80fc076960439d432f6dfe8019bb1d0 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 23 Feb 2016 17:06:34 +0100 Subject: [PATCH 7/8] build: travis fix typo double double quote --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 519094ed7..085c39e53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,4 +56,4 @@ before_install: after_success: - '[ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :' - - '[ -n "$TRAVIS_TAG"" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :' + - '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :' From c0af575487273296ef935b2d7cf670f503bdaa8a Mon Sep 17 00:00:00 2001 From: David Bernard Date: Wed, 24 Feb 2016 22:46:47 +0100 Subject: [PATCH 8/8] =?UTF-8?q?build:=20remove=20=E2=80=9Cgit=20=E2=80=A6?= =?UTF-8?q?=E2=80=9D.execute()=20to=20retrieve=20git=20tag.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version.gradle | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/version.gradle b/version.gradle index 501132ac5..8b2b09074 100644 --- a/version.gradle +++ b/version.gradle @@ -116,13 +116,12 @@ def getReleaseInfo(String tag) { task configureVersionInfo { try { def grgit = Grgit.open(project.file('.')) - jmeRevision = grgit.log(includes:['HEAD']).size() - jmeGitHash = grgit.head().id - jmeShortGitHash = grgit.head().abbreviatedId + def head = grgit.head() + jmeRevision = grgit.log(includes: [head]).size() + jmeGitHash = head.id + jmeShortGitHash = head.abbreviatedId jmeBranchName = grgit.branch.current.name - //gtgit.describe doesn't behave like git describe and it doens't support any option - //jmeGitTag = grgit.describe() ?: System.env.TRAVIS_TAG - jmeGitTag = "git describe --tags --exact-match --dirty".execute().text.trim() ?: System.env.TRAVIS_TAG + jmeGitTag = grgit.tag.list().find { it.commit == head } ?: System.env.TRAVIS_TAG def releaseInfo = getReleaseInfo(jmeGitTag) if (releaseInfo != null) {