JinwooHwang commented on code in PR #7925:
URL: https://github.com/apache/geode/pull/7925#discussion_r2383074545
##########
build-tools/scripts/src/main/groovy/geode-java.gradle:
##########
@@ -118,13 +118,23 @@ gradle.taskGraph.whenReady({ graph ->
}.findAll { !(it.value?.hasProperty('optional') &&
it.value.optional)})
}
- def incoming =
geodeProject.configurations.runtimeClasspath.getIncoming()
- def resolutionResult = incoming.getResolutionResult()
- def components = resolutionResult.allComponents
-
- upstreamDeps.addAll(components.findAll {componentResult ->
- depMap.containsKey(componentResult.moduleVersion.id.name)
- }.collect {it.moduleVersion.id.name + '-' + it.moduleVersion.version +
'.jar'})
+ // NOTE: Previously this logic resolved the upstream project's
runtimeClasspath via
+ //
geodeProject.configurations.runtimeClasspath.getIncoming().getResolutionResult().
+ // That constitutes cross-project configuration resolution (executed
while configuring
+ // the current project's Jar task) and triggers Gradle's deprecation
warning:
+ // "Resolution of the configuration :otherProject:runtimeClasspath
was attempted from a context different than the project context"
+ // To avoid that, we derive the first-level runtime dependency jar
names directly from
+ // the dependency metadata (depMap) we already collected, without
forcing resolution of
+ // the upstream configuration here. This yields the same set that was
formerly filtered
+ // against the resolved components because depMap only contains
declared (first-level)
+ // non-optional dependencies of the upstream project.
+ depMap.values()
+ .findAll { dep -> !(dep instanceof ProjectDependency) }
+ .each { dep ->
+ if (dep.hasProperty('version') && dep.version) {
+ upstreamDeps.add("${dep.name}-${dep.version}.jar")
Review Comment:
Hi @sboorlagadda . That’s a sharp observation. If a jar lacks versioning in
its filename, we should either have a fallback strategy or at minimum log it.
Skipping silently could lead to subtle issues down the line, and visibility
here is key. Let me get back to it and work on it. Thank you so much for your
help, @sboorlagadda
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]