GP-0: Fixing Gradle deprecations

This commit is contained in:
Ryan Kurtz
2026-09-25 05:25:08 -04:00
parent ffbc5acf0f
commit c427352201
12 changed files with 24 additions and 24 deletions

View File

@@ -38,25 +38,25 @@ model {
// scenarios. These checks, can be removed when Gradle fixes them, and we advertise a
// minimum Gradle version that includes the fix.
toolChains {
def current = getCurrentPlatformName()
if (isLinux(current)) {
def current = rootProject.getCurrentPlatformName()
if (rootProject.isLinux(current)) {
// https://github.com/gradle/gradle/issues/17660 (fixed in Gradle 8.11)
gcc(Gcc).target(current)
clang(Clang).target(current)
}
if (isFreeBSD(current)) {
if (rootProject.isFreeBSD(current)) {
// https://github.com/gradle/gradle/issues/32895
gcc(Gcc).target(current)
clang(Clang).target(current)
}
if (isOpenBSD(current)) {
if (rootProject.isOpenBSD(current)) {
gcc(Gcc).target(current)
clang(Clang).target(current)
}
if (isWindows(current) && VISUAL_STUDIO_INSTALL_DIR) {
if (rootProject.isWindows(current) && rootProject.VISUAL_STUDIO_INSTALL_DIR) {
// https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
visualCpp(VisualCpp) {
installDir = VISUAL_STUDIO_INSTALL_DIR
installDir = rootProject.VISUAL_STUDIO_INSTALL_DIR
}
}
}
@@ -68,9 +68,9 @@ model {
task CheckToolChain {
// Native C/Cpp plugins will trigger failure if no tool chain found
doFirst {
if (isCurrentWindows()) {
if (rootProject.isCurrentWindows()) {
// ensure that required MS Visual Studio is installed
if (!VISUAL_STUDIO_INSTALL_DIR) {
if (!rootProject.VISUAL_STUDIO_INSTALL_DIR) {
throw new GradleException("Supported Windows native toolchain not found!");
}
}
@@ -131,7 +131,7 @@ def shouldSkipNative(task) {
tasks.addRule("Pattern: buildNatives[_PlatformName]: build all natives for given platform") { String taskName ->
if (taskName.startsWith("buildNatives")) {
String currentPlatform = getCurrentPlatformName()
String currentPlatform = rootProject.getCurrentPlatformName()
String platform = taskName - "buildNatives"
if (platform.length() == 0) {
platform = currentPlatform

View File

@@ -9,7 +9,7 @@
* and SDKs are installed.
****************************************************************************/
if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR") && isCurrentWindows()) {
if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR") && rootProject.isCurrentWindows()) {
// Initialize variables
rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = ""

View File

@@ -54,7 +54,7 @@ task buildTlb(type: Exec) {
outputs.file(tlb)
doFirst {
assert isCurrentX86_64() && isCurrentWindows() : "Can only build TLB on Windows x86"
assert rootProject.isCurrentX86_64() && rootProject.isCurrentWindows() : "Can only build TLB on Windows x86"
file(tlb).parentFile.mkdirs()
def midlCmd = "midl /tlb \"${tlb}\" \"${idl}\""
println "Executing: " + midlCmd

View File

@@ -42,7 +42,7 @@ task configureGenerateProtoPy {
doLast {
def exe = configurations.protocArtifact.first()
if (!isCurrentWindows()) {
if (!rootProject.isCurrentWindows()) {
exe.setExecutable(true)
}
generateProtoPy.commandLine exe

View File

@@ -137,7 +137,7 @@ task zipExtensions(type: Zip, dependsOn:jarTasks) {
rootProject.createInstallationZip {
from (this.project.zipExtensions) {
into {
ZIP_DIR_PREFIX + "/Extensions/Ghidra"
rootProject.ZIP_DIR_PREFIX + "/Extensions/Ghidra"
}
}
doLast {

View File

@@ -35,13 +35,13 @@ if ("win_x86_64".equals(rootProject.getCurrentPlatformName())) {
doFirst {
file("build/os/win_x86_64").mkdirs()
def windowsTargetPlatformVersion = VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: VISUAL_STUDIO_SDK_VERSION_DEFAULT
def windowsTargetPlatformVersion = rootProject.VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: rootProject.VISUAL_STUDIO_SDK_VERSION_DEFAULT
def msbuildCmd = "msbuild ${solutionPathWindows} /p:Configuration=Release /p:WindowsTargetPlatformVersion=${windowsTargetPlatformVersion}"
println "Executing: " + msbuildCmd
new File(solutionBatchFilePath).withWriter { out ->
out.println "call " + VISUAL_STUDIO_VCVARS_CMD
out.println "call " + rootProject.VISUAL_STUDIO_VCVARS_CMD
out.println msbuildCmd
}
}

View File

@@ -194,7 +194,7 @@ model {
linker.args("/SUBSYSTEM:windows", "/DYNAMICBASE", "/NXCOMPAT")
linker.args("shell32.lib");
}
if (isWindows(targetPlatform.name)) {
if (rootProject.isWindows(targetPlatform.name)) {
cppCompiler.define("WIN32")
cCompiler.define("WIN32")

View File

@@ -478,7 +478,7 @@ String generateLibraryDependencyMapping() {
libsFile.withWriter { out ->
subprojects { p ->
p.plugins.withType(JavaPlugin) {
List<String> libs = getExternalRuntimeDependencies(p);
List<String> libs = rootProject.getExternalRuntimeDependencies(p);
if (libs != null) {
out.println "Module: $p.name"
libs.each { path ->

View File

@@ -4,9 +4,9 @@
* 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.
@@ -30,7 +30,7 @@ apply from: "$rootProject.projectDir/gradle/support/extensionCommon.gradle"
rootProject.createInstallationZip {
from (this.project.zipExtensions) {
into {
ZIP_DIR_PREFIX + "/Extensions/Ghidra"
rootProject.ZIP_DIR_PREFIX + "/Extensions/Ghidra"
}
}
doLast {

View File

@@ -69,7 +69,7 @@ task configureGenerateProto {
doLast {
def exe = configurations.protocArtifact.first()
if (!isCurrentWindows()) {
if (!rootProject.isCurrentWindows()) {
exe.setExecutable(true)
}
generateProto.commandLine exe, "--java_out=${generateProto.outdir}", "-I${generateProto.srcdir}"

View File

@@ -20,8 +20,8 @@
******************************************************************************************/
task createPythonVirtualEnvironment(type: Exec) {
def venvDir = "build/venv"
def binDir = isCurrentWindows() ? "Scripts" : "bin"
def suffix = isCurrentWindows() ? ".exe" : "3"
def binDir = rootProject.isCurrentWindows() ? "Scripts" : "bin"
def suffix = rootProject.isCurrentWindows() ? ".exe" : "3"
project.ext.PYTHON3_VENV = "${rootProject.projectDir}/${venvDir}/${binDir}/python${suffix}"
project.ext.PIP3_VENV = "${rootProject.projectDir}/${venvDir}/${binDir}/pip${suffix}"

View File

@@ -115,7 +115,7 @@ def checkExternalLibsInMap(Map<String, String> map, Project project) {
* the map from the Module.manifest file
*********************************************************************************/
def checkExternalPythonWheelsInMap(Map<String, String> map, Project project) {
PYTHON_DEPS.getOrDefault(project, List.of()).each { dep ->
rootProject.PYTHON_DEPS.getOrDefault(project, List.of()).each { dep ->
String name = dep.getName() // get just the filename without the path
String relativePath = "pypkg/dist/"+name;
assert map.containsKey(relativePath) : "No License specified for external python wheel: "+relativePath+ " in module "+project.projectDir