mosche commented on code in PR #26320:
URL: https://github.com/apache/beam/pull/26320#discussion_r1219719604


##########
sdks/java/extensions/avro/build.gradle:
##########
@@ -63,67 +74,91 @@ dependencies {
   testImplementation library.java.junit
   testRuntimeOnly project(path: ":runners:direct-java", configuration: 
"shadow")
   testRuntimeOnly library.java.slf4j_jdk14
-  avroVersions.each {
-    "avroVersion$it.key" "org.apache.avro:avro:$it.value"
-    "avroVersion$it.key" "org.apache.avro:avro-tools:$it.value"
+  avroVersions.each { k,v ->
+    "avroVersion$k"(project(path: ":sdks:java:core", configuration: 
"shadowTest")) {
+      // Exclude Avro dependencies from "core" since Avro support moved to 
this extension
+      exclude group: "org.apache.avro", module: "avro"
+    }
+    "avroVersion$k" library.java.junit
+    "avroVersion$k" project(path: ":runners:direct-java", configuration: 
"shadow")
+    "avroVersion$k" library.java.slf4j_jdk14
+    "avroVersion$k" "org.tukaani:xz:1.9" // makes as provided since 1.9
+    "avroVersion$k" library.java.zstd_jni // makes as provided since 1.9
+    "avroVersion${k}Generate" "org.apache.avro:avro-tools:$v"
   }
 }
 
-avroVersions.each { kv ->
-  configurations."avroVersion$kv.key" {
-    resolutionStrategy {
-      force "org.apache.avro:avro:$kv.value"
+task printSourceSetInformation(){
+
+  doLast{
+    sourceSets.each { srcSet ->
+      println "["+srcSet.name+"]"
+      print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
+      print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
+      print "-->Compile classpath:\n"
+      srcSet.runtimeClasspath.files.each {
+        print "  "+it.path+"\n"
+      }
+      println ""
     }
   }
+}
+
+avroVersions.each { k, v ->
+  configurations."avroVersion$k" {
+    resolutionStrategy.force "org.apache.avro:avro:$v", 
"org.apache.avro:avro:$v:tests", library.java.joda_time
+  }
 
   sourceSets {
-    "avro${kv.key}" {
+    "avro$k" {
       java {
-        srcDirs "build/generated/sources/avro${kv.key}/test/java"
+        srcDirs "src/test/java", "build/generated/sources/avro$k/test/java"
       }
 
-      compileClasspath = configurations."avroVersion$kv.key" + 
sourceSets.test.output + sourceSets.test.compileClasspath
-      runtimeClasspath += compileClasspath + sourceSets.test.runtimeClasspath

Review Comment:
   Thanks a lot, that's a great improvement 👍 



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