ahmedabu98 commented on code in PR #29834:
URL: https://github.com/apache/beam/pull/29834#discussion_r1486899431


##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -2587,40 +2587,49 @@ class BeamModulePlugin implements Plugin<Project> {
       def config = it ? it as CrossLanguageUsingJavaExpansionConfiguration : 
new CrossLanguageUsingJavaExpansionConfiguration()
 
       project.evaluationDependsOn(":sdks:python")
-      project.evaluationDependsOn(config.expansionProjectPath)
+      for (path in config.expansionProjectPaths) {
+        project.evaluationDependsOn(path)
+      }
       project.evaluationDependsOn(":runners:core-construction-java")
       project.evaluationDependsOn(":sdks:java:extensions:python")
 
       // Setting up args to launch the expansion service
       def pythonDir = project.project(":sdks:python").projectDir
-      def javaExpansionPort = -1 // will be populated in setupTask
-      def expansionJar = 
project.project(config.expansionProjectPath).shadowJar.archivePath
-      def javaClassLookupAllowlistFile = 
project.project(config.expansionProjectPath).projectDir.getPath()
-      def expansionServiceOpts = [
-        "group_id": project.name,
-        "java_expansion_service_jar": expansionJar,
-        "java_expansion_service_allowlist_file": javaClassLookupAllowlistFile,
-      ]
+      // initialize all expansion ports to -1. Will be populated in setupTask
+      def javaExpansionPorts = config.expansionProjectPaths.inject([:]) { map, 
k -> map[k] = -1; map }
+
       def usesDataflowRunner = 
config.pythonPipelineOptions.contains("--runner=TestDataflowRunner") || 
config.pythonPipelineOptions.contains("--runner=DataflowRunner")
       def javaContainerSuffix = getSupportedJavaVersion()
 
       // 1. Builds the chosen expansion service jar and launches it
       def setupTask = project.tasks.register(config.name+"Setup") {
         dependsOn ':sdks:java:container:' + javaContainerSuffix + ':docker'
-        dependsOn 
project.project(config.expansionProjectPath).shadowJar.getPath()
+        for (path in config.expansionProjectPaths) {
+          dependsOn project.project(path).shadowJar.getPath()
+        }
         dependsOn 'installGcpTest'
         if (usesDataflowRunner) {
           dependsOn 
":sdks:python:test-suites:dataflow:py${project.ext.pythonVersion.replace('.', 
'')}:initializeForDataflowJob"
         }
         doLast {
-          project.exec {
-            // Prepare a port to use for the expansion service
-            javaExpansionPort = getRandomPort()
-            expansionServiceOpts.put("java_port", javaExpansionPort)
-            // setup test env
-            def serviceArgs = 
project.project(':sdks:python').mapToArgString(expansionServiceOpts)
-            executable 'sh'
-            args '-c', ". ${project.ext.envdir}/bin/activate && 
$pythonDir/scripts/run_expansion_services.sh stop --group_id ${project.name} && 
$pythonDir/scripts/run_expansion_services.sh start $serviceArgs"
+          // iterate through list of expansion service paths and build each jar
+          for (path in config.expansionProjectPaths) {
+            project.exec {
+              def expansionJar = project.project(path).shadowJar.archivePath
+              def javaClassLookupAllowlistFile = 
project.project(path).projectDir.getPath()
+              def expansionServiceOpts = [
+                "group_id": project.name,
+                "java_expansion_service_jar": expansionJar,
+                "java_expansion_service_allowlist_file": 
javaClassLookupAllowlistFile,
+              ]
+              // Prepare a port to use for the expansion service
+              javaExpansionPorts[path] = getRandomPort()
+              expansionServiceOpts.put("java_port", javaExpansionPorts[path])
+              // setup test env
+              def serviceArgs = 
project.project(':sdks:python').mapToArgString(expansionServiceOpts)
+              executable 'sh'
+              args '-c', ". ${project.ext.envdir}/bin/activate && 
$pythonDir/scripts/run_expansion_services.sh stop --group_id ${project.name} && 
$pythonDir/scripts/run_expansion_services.sh start $serviceArgs"

Review Comment:
   Ah sorry I thought this was a question for Cham. I'm unfamiliar with this 
"auto-jar-expansion-service" term, can you point me to somewhere I can learn 
about it?



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