build: only update version file when it changed

Avoids recompiling jme3-core on every build
define_list_fix
Kirill Vainer 9 years ago
parent c320c919a5
commit 74e398342f
  1. 40
      jme3-core/build.gradle

@ -17,23 +17,27 @@ sourceSets {
} }
} }
task updateVersionPropertiesFile << { task updateVersionPropertiesFile {
def verfile = file('src/main/resources/com/jme3/system/version.properties') def versionFile = file('src/main/resources/com/jme3/system/version.properties')
verfile.text = "# THIS IS AN AUTO-GENERATED FILE..\n" + def versionFileText = "# THIS IS AN AUTO-GENERATED FILE..\n" +
"# DO NOT MODIFY!\n" + "# DO NOT MODIFY!\n" +
"build.date=${jmeBuildDate}\n" + "build.date=${jmeBuildDate}\n" +
"git.revision=${jmeRevision}\n" + "git.revision=${jmeRevision}\n" +
"git.branch=${jmeBranchName}\n" + "git.branch=${jmeBranchName}\n" +
"git.hash=${jmeGitHash}\n" + "git.hash=${jmeGitHash}\n" +
"git.hash.short=${jmeShortGitHash}\n" + "git.hash.short=${jmeShortGitHash}\n" +
"git.tag=${jmeGitTag}\n" + "git.tag=${jmeGitTag}\n" +
"name.full=jMonkeyEngine ${jmeFullVersion}\n" + "name.full=jMonkeyEngine ${jmeFullVersion}\n" +
"version.full=${jmeFullVersion}\n" + "version.full=${jmeFullVersion}\n" +
"version.number=${jmeVersion}\n" + "version.number=${jmeVersion}\n" +
"version.tag=${jmeVersionTag}" "version.tag=${jmeVersionTag}"
}
compileJava.dependsOn(updateVersionPropertiesFile)
dependencies { outputs.upToDateWhen {
versionFile.text == versionFileText
}
doLast {
versionFile.text = versionFileText
}
} }
processResources.dependsOn updateVersionPropertiesFile
Loading…
Cancel
Save