JinwooHwang commented on code in PR #7925:
URL: https://github.com/apache/geode/pull/7925#discussion_r2383134799


##########
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,
   I've incorporated your suggestion to reflect the skipped dependency. Thanks 
for the thoughtful input—much appreciated! Please let me know if there's 
anything else I missed. Thank you.



-- 
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]

Reply via email to