Browse Source

Added a better version handling, which fixes that non-tagged commits only worked on the master branch. This however makes the build platform specific to unix (or git shell environment), much like it already is because of build_engine and fix_engine

MeFisto94 6 years ago
parent
commit
5c5e3ec02c
1 changed files with 19 additions and 2 deletions
  1. 19 2
      build.gradle

+ 19 - 2
build.gradle

@@ -47,8 +47,25 @@ if (System.getenv('TRAVIS') != null) {
         }
     }
 } else {
-    // This is the engine version that will be used per default on every regular commit
-    ext.jmeEngineVersion = "3.3.0-SNAPSHOT"
+	new ByteArrayOutputStream().withStream { os ->
+		def result = exec {
+			executable = 'git'
+			args = ['rev-parse', '--abbrev-ref', 'HEAD'];
+			standardOutput = os
+		}
+		ext.branch = os.toString().trim()
+	}
+	
+	// If the Branch isn't master, specify the branch name.
+	// @TODO: One could use the same technique like the engine (grgit?)
+	if (ext.branch == "master") {
+		ext.branchSpec = ""
+	} else {
+		ext.branchSpec = "-" + ext.branch;
+	}
+	
+	// This is the engine version that will be used per default on every regular commit
+	ext.jmeEngineVersion = "3.3.0" + ext.branchSpec + "-SNAPSHOT"
 }
 
 configurations {