diff --git a/avro-builder/tests/codegen-111/build.gradle b/avro-builder/tests/codegen-111/build.gradle index 7e77aad3..6c678519 100644 --- a/avro-builder/tests/codegen-111/build.gradle +++ b/avro-builder/tests/codegen-111/build.gradle @@ -54,7 +54,7 @@ compileJava.dependsOn runOwnCodegen dependencies { codegen project(":avro-builder:builder") - implementation ("org.apache.avro:avro:1.11.3") { + implementation ("org.apache.avro:avro:1.11.4") { exclude group: "org.mortbay.jetty" exclude group: "org.apache.velocity" exclude group: "commons-lang" diff --git a/avro-builder/tests/tests-allavro/build.gradle b/avro-builder/tests/tests-allavro/build.gradle index 31fbe9a1..c58cb084 100644 --- a/avro-builder/tests/tests-allavro/build.gradle +++ b/avro-builder/tests/tests-allavro/build.gradle @@ -138,10 +138,10 @@ dependencies { exclude group: "org.slf4j" } - avro111 ("org.apache.avro:avro:1.11.3") { + avro111 ("org.apache.avro:avro:1.11.4") { exclude group: "org.slf4j" } - avro111 ("org.apache.avro:avro-compiler:1.11.3") { + avro111 ("org.apache.avro:avro-compiler:1.11.4") { exclude group: "org.slf4j" } } diff --git a/fastserde/avro-fastserde-tests111/build.gradle b/fastserde/avro-fastserde-tests111/build.gradle index b9d90db2..c30c4078 100644 --- a/fastserde/avro-fastserde-tests111/build.gradle +++ b/fastserde/avro-fastserde-tests111/build.gradle @@ -32,7 +32,7 @@ dependencies { testImplementation "org.apache.commons:commons-lang3:3.4" testImplementation "com.sun.codemodel:codemodel:2.6" - testImplementation ("org.apache.avro:avro:1.11.3") { + testImplementation ("org.apache.avro:avro:1.11.4") { exclude group: "org.slf4j" } @@ -44,8 +44,19 @@ dependencies { testImplementation 'org.slf4j:slf4j-simple:1.7.14' codegen project(":helper:helper") - codegen "org.apache.avro:avro-tools:1.11.3" - codegen "org.apache.avro:avro-compiler:1.11.3" + + // trevni-avro and trevni-core no longer publish -test jars, but avro-tools still tries to pull in these test jars + // gradle does not support custom resolution strategy for classifier. The blocks below are to do a workaround by + // excluding trevni-avro and trevni-core first and then add them back without the test classifier + codegen ("org.apache.avro:avro-tools:1.11.4") { + exclude group: "org.apache.avro", module: "trevni-avro" + exclude group: "org.apache.avro", module: "trevni-core" + } + codegen ("org.apache.avro:trevni-avro:1.11.4") { + exclude group: "org.apache.avro", module: "trevni-core" + } + codegen "org.apache.avro:trevni-core:1.11.4" + codegen "org.apache.avro:avro-compiler:1.11.4" } test { diff --git a/helper/impls/helper-impl-111/build.gradle b/helper/impls/helper-impl-111/build.gradle index 33763fe0..476a55ef 100644 --- a/helper/impls/helper-impl-111/build.gradle +++ b/helper/impls/helper-impl-111/build.gradle @@ -12,7 +12,7 @@ plugins { dependencies { implementation (project(":helper:helper-common")) - compileOnly ("org.apache.avro:avro:1.11.3") + compileOnly ("org.apache.avro:avro:1.11.4") testImplementation project(":test-common") testImplementation("org.mockito:mockito-inline:4.11.0") } diff --git a/helper/impls/helper-impl-111/src/main/java/com/linkedin/avroutil1/compatibility/avro111/Avro111Utils.java b/helper/impls/helper-impl-111/src/main/java/com/linkedin/avroutil1/compatibility/avro111/Avro111Utils.java index a0466913..1b144b43 100644 --- a/helper/impls/helper-impl-111/src/main/java/com/linkedin/avroutil1/compatibility/avro111/Avro111Utils.java +++ b/helper/impls/helper-impl-111/src/main/java/com/linkedin/avroutil1/compatibility/avro111/Avro111Utils.java @@ -7,8 +7,10 @@ package com.linkedin.avroutil1.compatibility.avro111; import java.lang.reflect.Field; +import java.lang.reflect.Method; import org.apache.avro.generic.GenericDatumReader; import org.apache.avro.specific.SpecificData; +import org.apache.avro.specific.SpecificDatumReader; /** @@ -20,6 +22,8 @@ public class Avro111Utils { private final static boolean IS_AT_LEAST_1_11_2; private final static boolean IS_AT_LEAST_1_11_3; + private final static boolean IS_AT_LEAST_1_11_4; + static { Class[] inners = GenericDatumReader.class.getDeclaredClasses(); //never null boolean found = false; @@ -55,6 +59,19 @@ public class Avro111Utils { //expected in avro < 1.11.3 } IS_AT_LEAST_1_11_3 = found; + + found = false; + //added in https://issues.apache.org/jira/browse/AVRO-3985 + //see https://github.com/apache/avro/pull/2980/files#diff-95af304493048b22c3dda8fbfc7efb0e0c1c5e876f0234c2b8d0635bb2bcb494R151 + Method[] methods = SpecificDatumReader.class.getDeclaredMethods(); + for (Method method : methods) { + if ("getTrustedPackages".equals(method.getName())) { + found = true; + break; + } + } + + IS_AT_LEAST_1_11_4 = found; } private Avro111Utils() { @@ -72,4 +89,8 @@ public static boolean isAtLeast1112() { public static boolean isAtLeast1113() { return IS_AT_LEAST_1_11_3; } + + public static boolean isAtLeast1114() { + return IS_AT_LEAST_1_11_4; + } } diff --git a/helper/tests/codegen-111/build.gradle b/helper/tests/codegen-111/build.gradle index 8271f36d..25ace2a9 100644 --- a/helper/tests/codegen-111/build.gradle +++ b/helper/tests/codegen-111/build.gradle @@ -161,15 +161,25 @@ compileJava.dependsOn runVanillaAvroCodegen, runCompatAvroCodegen, runCompatAvro jar.dependsOn runResourceGeneration dependencies { - codegen "org.apache.avro:avro-tools:1.11.3" - codegen "org.apache.avro:avro-compiler:1.11.3" + // trevni-avro and trevni-core no longer publish -test jars, but avro-tools still tries to pull in these test jars + // gradle does not support custom resolution strategy for classifier. The blocks below are to do a workaround by + // excluding trevni-avro and trevni-core first and then add them back without the test classifier + codegen ("org.apache.avro:avro-tools:1.11.4") { + exclude group: "org.apache.avro", module: "trevni-avro" + exclude group: "org.apache.avro", module: "trevni-core" + } + codegen ("org.apache.avro:trevni-avro:1.11.4") { + exclude group: "org.apache.avro", module: "trevni-core" + } + codegen "org.apache.avro:trevni-core:1.11.4" + codegen "org.apache.avro:avro-compiler:1.11.4" codegen files('../codegenClasspath') codegen project(":helper:tests:helper-tests-common") codegen project(":helper:helper") //required because generated code depends on the helper implementation project(":helper:helper") - implementation "org.apache.avro:avro:1.11.3" + implementation "org.apache.avro:avro:1.11.4" //this block required for resource generation code implementation project(":helper:tests:helper-tests-common") diff --git a/helper/tests/helper-tests-111/build.gradle b/helper/tests/helper-tests-111/build.gradle index dd323a63..14295cd0 100644 --- a/helper/tests/helper-tests-111/build.gradle +++ b/helper/tests/helper-tests-111/build.gradle @@ -40,8 +40,8 @@ dependencies { exclude group: "org.apache.avro" } - testImplementation "org.apache.avro:avro:1.11.3" - testImplementation "org.apache.avro:avro-compiler:1.11.3" + testImplementation "org.apache.avro:avro:1.11.4" + testImplementation "org.apache.avro:avro-compiler:1.11.4" testImplementation "com.google.guava:guava:28.2-jre" testImplementation "org.mockito:mockito-core:3.2.4" } diff --git a/helper/tests/helper-tests-111/src/test/java/com/linkedin/avroutil1/compatibility/avro111/Avro111UtilsTest.java b/helper/tests/helper-tests-111/src/test/java/com/linkedin/avroutil1/compatibility/avro111/Avro111UtilsTest.java index 68e98bc3..56ae6f7c 100644 --- a/helper/tests/helper-tests-111/src/test/java/com/linkedin/avroutil1/compatibility/avro111/Avro111UtilsTest.java +++ b/helper/tests/helper-tests-111/src/test/java/com/linkedin/avroutil1/compatibility/avro111/Avro111UtilsTest.java @@ -14,19 +14,25 @@ public class Avro111UtilsTest { @Test public void testAvro1111Detection() throws Exception { - //at time of writing we use 1.11.3 + //at time of writing we use 1.11.4 Assert.assertTrue(Avro111Utils.isAtLeast1111()); } @Test public void testAvro1112Detection() throws Exception { - //at time of writing we use 1.11.3 + //at time of writing we use 1.11.4 Assert.assertTrue(Avro111Utils.isAtLeast1112()); } @Test public void testAvro1113Detection() throws Exception { - //at time of writing we use 1.11.3 + //at time of writing we use 1.11.4 Assert.assertTrue(Avro111Utils.isAtLeast1113()); } + + @Test + public void testAvro1114Detection() throws Exception { + //at time of writing we use 1.11.4 + Assert.assertTrue(Avro111Utils.isAtLeast1114()); + } } diff --git a/helper/tests/helper-tests-allavro/build.gradle b/helper/tests/helper-tests-allavro/build.gradle index 807357a4..2d76b2ac 100644 --- a/helper/tests/helper-tests-allavro/build.gradle +++ b/helper/tests/helper-tests-allavro/build.gradle @@ -156,13 +156,13 @@ dependencies { exclude group: "org.slf4j" } - avro111 ("org.apache.avro:avro:1.11.3") { + avro111 ("org.apache.avro:avro:1.11.4") { exclude group: "org.slf4j" } - avro111 ("org.apache.avro:avro-compiler:1.11.3") { + avro111 ("org.apache.avro:avro-compiler:1.11.4") { exclude group: "org.slf4j" } - avro111NoCompiler ("org.apache.avro:avro:1.11.3") { + avro111NoCompiler ("org.apache.avro:avro:1.11.4") { exclude group: "org.slf4j" } }