You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "mosche (via GitHub)" <gi...@apache.org> on 2023/06/06 14:04:45 UTC

[GitHub] [beam] mosche commented on a diff in pull request #26320: Select dedicated avro datum reader and writer

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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org