Skip to content

Commit

Permalink
Fix version naming. Use version-branch-SNAPSHOT for local builds, add…
Browse files Browse the repository at this point in the history
… custom version name property.
  • Loading branch information
riccardobl committed Nov 17, 2019
1 parent e304c5b commit 816ab99
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 32 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Expand Up @@ -75,7 +75,7 @@ jobs:
# Build
# Note: since this is crossbuild we use the buildForPlatforms filter to tell
# the buildscript wich platforms it should build for.
gradle --no-daemon -PbuildForPlatforms=LinuxArm,LinuxArmHF,LinuxArm64 -PbuildNativeProjects=true \
gradle -PuseCommitHashAsVersionName=true --no-daemon -PbuildForPlatforms=LinuxArm,LinuxArmHF,LinuxArm64 -PbuildNativeProjects=true \
:jme3-bullet-native:assemble
- name: Upload natives
Expand All @@ -99,7 +99,7 @@ jobs:

- name: Build
run: |
gradle --no-daemon -PbuildNativeProjects=true \
gradle -PuseCommitHashAsVersionName=true --no-daemon -PbuildNativeProjects=true \
:jme3-android-native:assemble \
:jme3-bullet-native-android:assemble
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
fi
# Build
gradle --no-daemon -PbuildNativeProjects=true -Dmaven.repo.local="$PWD/dist/maven" \
gradle -PuseCommitHashAsVersionName=true --no-daemon -PbuildNativeProjects=true -Dmaven.repo.local="$PWD/dist/maven" \
build \
:jme3-bullet-native:build
Expand Down Expand Up @@ -238,7 +238,7 @@ jobs:
shell: bash
run: |
# Build
gradle -PskipPrebuildLibraries=true build
gradle -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true build
if [ "${{ matrix.deploy }}" = "true" ];
then
Expand All @@ -247,15 +247,15 @@ jobs:
sudo apt-get install -y zip
# Create the zip release and the javadoc
gradle -PskipPrebuildLibraries=true mergedJavadoc createZipDistribution
gradle -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true mergedJavadoc createZipDistribution
# We prepare the release for deploy
mkdir -p ./dist/release/
mv build/distributions/*.zip dist/release/
# Create the maven artifacts
mkdir -p ./dist/maven/
gradle -PskipPrebuildLibraries=true install -Dmaven.repo.local="$PWD/dist/maven"
gradle -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true install -Dmaven.repo.local="$PWD/dist/maven"
# Zip the natives into a single archive (we are going to use this to deploy native snapshots)
echo "Create native zip"
Expand Down
2 changes: 1 addition & 1 deletion common-android-app.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'

group = 'org.jmonkeyengine'
version = jmeVersion + '-' + jmeVersionTag
version = jmeFullVersion

sourceCompatibility = '1.6'

Expand Down
8 changes: 4 additions & 4 deletions common.gradle
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'groovy'
apply plugin: 'maven'

group = 'org.jmonkeyengine'
version = jmePomVersion
version = jmeFullVersion

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
Expand Down Expand Up @@ -51,9 +51,9 @@ jar {
javadoc {
failOnError = false
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.docTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
options.windowTitle = "jMonkeyEngine ${jmeMainVersion} ${project.name} Javadoc"
options.header = "<b>jMonkeyEngine ${jmeMainVersion} ${project.name}</b>"
options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
options.windowTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
options.header = "<b>jMonkeyEngine ${jmeFullVersion} ${project.name}</b>"
options.author = "true"
options.use = "true"
options.charSet = "UTF-8"
Expand Down
17 changes: 9 additions & 8 deletions gradle.properties
@@ -1,11 +1,12 @@
# Version number: Major.Minor.Patch (e.g. 3.1.3)
jmeVersion = 3.3.0
# Version for application and settings folder (no spaces!)
jmeMainVersion = 3.3
# Version label: SNAPSHOT, alpha1, beta1, stable
jmeVersionTag = SNAPSHOT
# Increment this each time jmeVersionTag changes but jmeVersion stays the same
jmeVersionTagID = 6
# Version number: Major.Minor (e.g. 3.3)
jmeVersion = 3.3

# Leave empty to autogenerate
# (use -PjmeVersionName="myVersion" from commandline to specify a custom version name )
jmeVersionName =

# If true, the version name will contain the commit hash
useCommitHashAsVersionName = false

# specify if JavaDoc should be built
buildJavaDoc = true
Expand Down
45 changes: 32 additions & 13 deletions version.gradle
Expand Up @@ -18,8 +18,8 @@ ext {
jmeShortGitHash = ""
jmeBuildDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date())
jmeBranchName = "unknown"
jmeFullVersion = "${jmeVersion}-UNKNOWN"
jmePomVersion = "${jmeVersion}-UNKNOWN"
jmeFullVersion = "${jmeVersion}-SNAPSHOT"
jmeVersionTag="SNAPSHOT"
}

task configureVersionInfo {
Expand All @@ -32,19 +32,38 @@ task configureVersionInfo {
jmeBranchName = grgit.branch.current.name
jmeGitTag = grgit.tag.list().find { it.commit == head }



if (jmeGitTag != null) {
jmeGitTag = jmeGitTag.name
jmeFullVersion = jmeGitTag
jmePomVersion = jmeGitTag
} else if(jmeGitHash!=null&&!jmeGitHash.equals("")){
jmeFullVersion = jmeGitHash
jmePomVersion = jmeGitHash
if(jmeVersionName==""){
if (jmeGitTag != null) {
jmeGitTag = jmeGitTag.name
jmeFullVersion = jmeGitTag
jmeVersionTag = ""
} else {
if(useCommitHashAsVersionName=="true"&&jmeGitHash!=null&&!jmeGitHash.equals("")){
jmeFullVersion = jmeGitHash
jmeVersionTag = ""
}else{
jmeFullVersion="${jmeVersion}-";
if(jmeBranchName!="master")jmeFullVersion+="${jmeBranchName}-";
jmeFullVersion+="SNAPSHOT"
jmeVersionTag="SNAPSHOT"
}
}
}else{
jmeVersionTag=""
jmeFullVersion=jmeVersionName
}

logger.warn("Full Version: ${jmeFullVersion}")
logger.warn("POM Version: ${jmePomVersion}")

println("Revision: ${jmeRevision}")
println("Hash: ${jmeGitHash}")
println("Short Hash: ${jmeShortGitHash}")
println("Tag: ${jmeGitTag}")
println("Build Date: ${jmeBuildDate}")
println("Build Branch: ${jmeBranchName}")
println("Use commit hash as version ${useCommitHashAsVersionName}")
println("Build Tag: ${jmeVersionTag}")
println("Build Version: ${jmeFullVersion}")

} catch (ex) {
// Failed to get repo info
logger.warn("Failed to get repository info: " + ex.message + ". " + \
Expand Down

0 comments on commit 816ab99

Please sign in to comment.