kennknowles commented on code in PR #40450:
URL: https://github.com/apache/beam/pull/40450#discussion_r4209128071


##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -1972,6 +1969,34 @@ class BeamModulePlugin implements Plugin<Project> {
       if ((isRelease(project) || project.hasProperty('publishing')) && 
configuration.publish) {
         project.apply plugin: "maven-publish"
 
+        // Ensure project dependencies in published configurations are 
evaluated even when
+        // org.gradle.configureondemand=true is enabled, without calling 
evaluationDependsOn during
+        // project evaluation (which can trigger circular evaluation between 
subprojects).
+        if (!project.tasks.names.contains('evaluateForPom')) {

Review Comment:
   This line is totally beyond me



##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -2145,12 +2170,42 @@ class BeamModulePlugin implements Plugin<Project> {
 
                 // BOMs, declared with 'platform' or 'enforced-platform', 
appear in <dependencyManagement> section
                 def boms = []
+                def addedBoms = [] as Set
+                // Track emitted (groupId, artifactId, classifiers) 
coordinates across scopes so that
+                // configuration inheritance (e.g. 
runtimeOnly.extendsFrom(provided)) or duplicate
+                // declarations across configurations do not produce duplicate 
<dependency> nodes.
+                def addedDependencies = [] as Set
 
                 def generateDependenciesFromConfiguration = { param ->
                   
project.configurations."${param.configuration}".allDependencies.each {
                     String category = 
it.getAttributes().getAttribute(Category.CATEGORY_ATTRIBUTE)
                     if (Category.ENFORCED_PLATFORM == category || 
Category.REGULAR_PLATFORM == category) {
-                      boms.add(it)
+                      if (addedBoms.add([it.group, it.name])) {
+                        boms.add(it)

Review Comment:
   This part seems generally useful, I guess it avoids duplicate boms?



##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -2145,12 +2170,42 @@ class BeamModulePlugin implements Plugin<Project> {
 
                 // BOMs, declared with 'platform' or 'enforced-platform', 
appear in <dependencyManagement> section
                 def boms = []
+                def addedBoms = [] as Set
+                // Track emitted (groupId, artifactId, classifiers) 
coordinates across scopes so that
+                // configuration inheritance (e.g. 
runtimeOnly.extendsFrom(provided)) or duplicate
+                // declarations across configurations do not produce duplicate 
<dependency> nodes.
+                def addedDependencies = [] as Set
 
                 def generateDependenciesFromConfiguration = { param ->
                   
project.configurations."${param.configuration}".allDependencies.each {
                     String category = 
it.getAttributes().getAttribute(Category.CATEGORY_ATTRIBUTE)
                     if (Category.ENFORCED_PLATFORM == category || 
Category.REGULAR_PLATFORM == category) {
-                      boms.add(it)
+                      if (addedBoms.add([it.group, it.name])) {
+                        boms.add(it)
+                      }
+                      return
+                    }
+
+                    if (it instanceof ProjectDependency) {
+                      def dependencyProject = it.getDependencyProject()
+                      if (dependencyProject.ext.has('includeInJavaBom') && 
!dependencyProject.ext.includeInJavaBom) {

Review Comment:
   I feel like this is hacking into gradle internal magic strings also?



##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -2204,6 +2259,9 @@ class BeamModulePlugin implements Plugin<Project> {
                 generateDependenciesFromConfiguration(
                     configuration: (configuration.shadowClosure ? 'shadow' : 
'implementation'), scope: 'compile')
                 generateDependenciesFromConfiguration(configuration: 
'provided', scope: 'provided')
+                if (!configuration.shadowClosure) {
+                  generateDependenciesFromConfiguration(configuration: 
'runtimeOnly', scope: 'runtime')

Review Comment:
   this kind of seems like the line that actually does the work



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