From de68f50eb4341987cf5b8bcd54b09662afcadd3c Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Thu, 18 Jul 2019 13:39:17 -0400 Subject: [PATCH] GT-3017: Storing minimum gradle version in application.properties. --- DevGuide.md | 2 +- .../ghidra/framework/ApplicationProperties.java | 4 ++-- Ghidra/application.properties | 2 +- .../wizards/pages/ConfigureGradleWizardPage.java | 2 +- build.gradle | 13 +++---------- gradle/support/loadApplicationProperties.gradle | 1 + 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/DevGuide.md b/DevGuide.md index 9eccaad7f3..64b715c485 100644 --- a/DevGuide.md +++ b/DevGuide.md @@ -13,7 +13,7 @@ You may not need all of these, depending on which portions you are building or d - https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html * Eclipse - It must support JDK 11. Eclipse 2018-12 or later should work. Other IDEs may work, but we have not tested them. - https://www.eclipse.org/downloads/ -* Gradle 5.0 - Later versions may work, but you'll need to modify our version check. +* Gradle 5.0 or later - We use version 5.0, and tested with up to 5.5.1. - https://gradle.org/next-steps/?version=5.0&format=bin * A C/C++ compiler - We use GCC on Linux, Xcode (Clang) on macOS, and Visual Studio 2017 on Windows. - https://gcc.gnu.org/ diff --git a/Ghidra/Framework/Utility/src/main/java/ghidra/framework/ApplicationProperties.java b/Ghidra/Framework/Utility/src/main/java/ghidra/framework/ApplicationProperties.java index bdcfcd9592..75f8aa6858 100644 --- a/Ghidra/Framework/Utility/src/main/java/ghidra/framework/ApplicationProperties.java +++ b/Ghidra/Framework/Utility/src/main/java/ghidra/framework/ApplicationProperties.java @@ -53,9 +53,9 @@ public class ApplicationProperties extends Properties { public static final String APPLICATION_LAYOUT_VERSION_PROPERTY = "application.layout.version"; /** - * The recommended version of gradle used to build the application. + * The minimum version of gradle required to build the application. */ - public static final String APPLICATION_GRADLE_VERSION_PROPERTY = "application.gradle.version"; + public static final String APPLICATION_GRADLE_MIN_PROPERTY = "application.gradle.min"; /** * The minimum major version of Java required to run the application. For example, "8". diff --git a/Ghidra/application.properties b/Ghidra/application.properties index 8748fe6d11..cae14c8c14 100644 --- a/Ghidra/application.properties +++ b/Ghidra/application.properties @@ -2,7 +2,7 @@ application.name=Ghidra application.version=9.1 application.release.name=DEV application.layout.version=1 -application.gradle.version=5.0 +application.gradle.min=5.0 application.java.min=11 application.java.max= application.java.compiler=11 diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/wizards/pages/ConfigureGradleWizardPage.java b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/wizards/pages/ConfigureGradleWizardPage.java index d68bab71a1..5ed3ee9cd2 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/wizards/pages/ConfigureGradleWizardPage.java +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/wizards/pages/ConfigureGradleWizardPage.java @@ -149,7 +149,7 @@ public class ConfigureGradleWizardPage extends WizardPage { GhidraApplicationLayout ghidraLayout = new GhidraApplicationLayout(ghidraDir); ApplicationProperties props = ghidraLayout.getApplicationProperties(); gradleVersion = - props.getProperty(ApplicationProperties.APPLICATION_GRADLE_VERSION_PROPERTY); + props.getProperty(ApplicationProperties.APPLICATION_GRADLE_MIN_PROPERTY); if (gradleVersion != null && !gradleVersion.isEmpty()) { setDescription("Configure Gradle. Version " + gradleVersion + " is expected."); } diff --git a/build.gradle b/build.gradle index f4dcde86da..8d134329f1 100644 --- a/build.gradle +++ b/build.gradle @@ -2,17 +2,16 @@ apply plugin: 'eclipse' apply from: 'gradle/root/eclipse.gradle' apply from: "gradle/support/eclipseLauncher.gradle" - +apply from: "gradle/support/loadApplicationProperties.gradle" /*************************************************************************************** * Make sure the correct version of gradle is being used ***************************************************************************************/ import org.gradle.util.GradleVersion; -final GradleVersion minimum_version = GradleVersion.version('5.0') - +final GradleVersion minimum_version = GradleVersion.version("${rootProject.GRADLE_MINIMUM_VERSION}") if (GradleVersion.current() < minimum_version) { - throw new GradleException("Requires at least $minimum_version, but was ran with $gradle.gradleVersion") + throw new GradleException("Requires at least $minimum_version, but was run with $gradle.gradleVersion") } /*************************************************************************************** @@ -55,12 +54,6 @@ if (file("flatRepo").isDirectory()) { } } -/********************************************************************************* - * load properties from Ghidra/application.properties file - *********************************************************************************/ - -apply from: "gradle/support/loadApplicationProperties.gradle" - /**************************************************************************** * Create a set containing all the platforms we need when building native * artifacts. This is here for convenience and can be used in a build file diff --git a/gradle/support/loadApplicationProperties.gradle b/gradle/support/loadApplicationProperties.gradle index bd6abc89bc..f2e1a799bf 100644 --- a/gradle/support/loadApplicationProperties.gradle +++ b/gradle/support/loadApplicationProperties.gradle @@ -12,6 +12,7 @@ file("Ghidra/application.properties").withReader { reader -> 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.