ghidra/gradle/support/loadApplicationProperties.gradle

55 lines
2.5 KiB
Groovy

/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*****************************************************************************************
*
* 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_MIN = ghidraProps.getProperty('application.gradle.min')
project.ext.GRADLE_MAX = ghidraProps.getProperty('application.gradle.max')
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
}
}