ghidra/gradle/support/loadApplicationProperties.gradle

40 lines
1.9 KiB
Groovy

/*****************************************************************************************
*
* Reads the Ghidra/application.properties file and sets properties for the version,
* release name, and distro prefix (ghidra_<version>)
*
*****************************************************************************************/
def ghidraProps = new Properties()
file("Ghidra/application.properties").withReader { reader ->
ghidraProps.load(reader)
version = ghidraProps.getProperty('application.version')
project.ext.RELEASE_VERSION = version
project.ext.RELEASE_NAME = ghidraProps.getProperty('application.release.name')
project.ext.JAVA_COMPILER = ghidraProps.getProperty('application.java.compiler')
project.ext.GRADLE_MINIMUM_VERSION = ghidraProps.getProperty('application.gradle.min')
project.ext.DISTRO_PREFIX = "ghidra_${version}_${RELEASE_NAME}"
// Build dates may or may not be already present in the application.properties file.
// If they are not present, we will set the dates so Gradle can use them, and we will
// indicate that the build dates need to be injected into the build's final
// application.properties file when it is copied.
project.ext.BUILD_DATE = ghidraProps.getProperty('application.build.date')
project.ext.BUILD_DATE_SHORT = ghidraProps.getProperty('application.build.date.short')
project.ext.BUILD_DATES_NEEDED = false
if (BUILD_DATE == null) {
project.ext.BUILD_DATE = getCurrentDateTimeLong()
project.ext.BUILD_DATE_SHORT = getCurrentDate()
project.ext.BUILD_DATES_NEEDED = true
}
// If the properties contain an entry for the git revision, then it
// must have been set by the extractor, so don't change it. If not, we will
// need to set it in the assembleDistribution task
project.ext.GIT_REV = ghidraProps.getProperty('application.revision.ghidra')
project.ext.GIT_REVS_NEEDED = false;
if (GIT_REV == null) {
project.ext.GIT_REVS_NEEDED = true
}
}