GP-6719 Corrected gradle test code for Gradle 9 compatibility

This commit is contained in:
ghidra1
2026-05-05 10:15:20 -04:00
parent c28ef3122e
commit daa0bc243a
+16 -2
View File
@@ -319,6 +319,20 @@ def getCurrentDateTimeLong() {
return formattedDate
}
/*********************************************************************************
* Returns the project object from the given projectDependency
*********************************************************************************/
def getDependencyProject(p, projectDependency) {
if (projectDependency.hasProperty("path")) {
// Supported by Gradle 8.11 and later
return p.project(projectDependency.path)
}
else {
// Supported in Gradle 8.5, removed in Gradle 9
return projectDependency.dependencyProject
}
}
/*********************************************************************************
* Returns true if 'project' has a direct or transitive API project dependency
* on the project with path 'targetPath'. The 'targetPath' should be specified
@@ -335,11 +349,11 @@ boolean hasApiProjectDependency(Project project, String targetPath) {
.allDependencies
.withType(org.gradle.api.artifacts.ProjectDependency)
if (apiDeps.any { it.dependencyProject.path == targetPath }) {
if (apiDeps.any { getDependencyProject(p, it).path == targetPath }) {
return true
}
return apiDeps.any { dep -> walk(dep.dependencyProject) }
return apiDeps.any { walk(getDependencyProject(p, it)) }
}
walk(project)