Skip to content

Commit 87748ed

Browse files
authored
Build Reliability Upgrade: Cross-project runtimeClasspath resolution in geode-java.gradle (#7925)
* Cross-project runtimeClasspath resolution * Add logging for dependencies without version information in the JAR manifest generation process
1 parent 58f06bd commit 87748ed

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

build-tools/scripts/src/main/groovy/geode-java.gradle

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,26 @@ gradle.taskGraph.whenReady({ graph ->
123123
}.findAll { !(it.value?.hasProperty('optional') && it.value.optional)})
124124
}
125125

126-
def incoming = geodeProject.configurations.runtimeClasspath.getIncoming()
127-
def resolutionResult = incoming.getResolutionResult()
128-
def components = resolutionResult.allComponents
129-
130-
upstreamDeps.addAll(components.findAll {componentResult ->
131-
depMap.containsKey(componentResult.moduleVersion.id.name)
132-
}.collect {it.moduleVersion.id.name + '-' + it.moduleVersion.version + '.jar'})
126+
// NOTE: Previously this logic resolved the upstream project's runtimeClasspath via
127+
// geodeProject.configurations.runtimeClasspath.getIncoming().getResolutionResult().
128+
// That constitutes cross-project configuration resolution (executed while configuring
129+
// the current project's Jar task) and triggers Gradle's deprecation warning:
130+
// "Resolution of the configuration :otherProject:runtimeClasspath was attempted from a context different than the project context"
131+
// To avoid that, we derive the first-level runtime dependency jar names directly from
132+
// the dependency metadata (depMap) we already collected, without forcing resolution of
133+
// the upstream configuration here. This yields the same set that was formerly filtered
134+
// against the resolved components because depMap only contains declared (first-level)
135+
// non-optional dependencies of the upstream project.
136+
depMap.values()
137+
.findAll { dep -> !(dep instanceof ProjectDependency) }
138+
.each { dep ->
139+
if (dep.hasProperty('version') && dep.version) {
140+
upstreamDeps.add("${dep.name}-${dep.version}.jar")
141+
} else {
142+
// Log warning about missing version but don't add to upstreamDeps (preserves original behavior)
143+
logger.warn("Dependency '${dep.name}' has no version information in project '${geodeProject.name}' and will be skipped from upstream exclusion")
144+
}
145+
}
133146
}
134147
// TODO: can we put our projects on the ClassPath line still?
135148
runtimeSet.removeAll(upstreamDeps)

0 commit comments

Comments
 (0)