From f9a00350c96eb559917096a69dd74dbbacdc52c8 Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Thu, 7 Nov 2024 11:25:31 +0100 Subject: [PATCH] Revert test jar dependency con compile schemas --- README.md | 2 +- plugin/src/sbt-test/sbt-avro/publishing/build.sbt | 10 ++++++---- .../publishing/transitive/src/test/resources/test.avsc | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 03b4045..8887c61 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ If some artifact is meant to be used in the test scope only, you can do the foll ```sbt libraryDependencies += "org" % "name" % "rev" % "avro" classifier "avro" -Compile / avroDependencyIncludeFilter := (Compile / avroDependencyIncludeFilter).value -- moduleFilter(organization = "org", name = "name") +Compile / avroDependencyIncludeFilter ~= { old => old -- moduleFilter(organization = "org", name = "name") } Test / avroDependencyIncludeFilter := configurationFilter("avro") && moduleFilter(organization = "org", name = "name") ``` diff --git a/plugin/src/sbt-test/sbt-avro/publishing/build.sbt b/plugin/src/sbt-test/sbt-avro/publishing/build.sbt index a295d30..76d4dc1 100644 --- a/plugin/src/sbt-test/sbt-avro/publishing/build.sbt +++ b/plugin/src/sbt-test/sbt-avro/publishing/build.sbt @@ -40,6 +40,7 @@ lazy val `transitive`: Project = project Compile / packageAvro / publishArtifact := true, Test / publishArtifact := true, libraryDependencies ++= Seq( + // when using avro scope -> won't be part of the pom dependencies. intransitive "com.github.sbt" % "external" % "0.0.1-SNAPSHOT" % "avro" classifier "avro", ) ) @@ -52,14 +53,15 @@ lazy val root: Project = project name := "publishing-test", crossScalaVersions := Seq("2.13.15", "2.12.20"), libraryDependencies ++= Seq( - "com.github.sbt" % "external" % "0.0.1-SNAPSHOT" % "avro" classifier "avro", // must be explicit + "com.github.sbt" % "external" % "0.0.1-SNAPSHOT" % "avro" classifier "avro", "com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro" classifier "avro", - "com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "avro" classifier "tests", + "com.github.sbt" % "transitive" % "0.0.1-SNAPSHOT" % "test" classifier "tests", "org.specs2" %% "specs2-core" % "4.20.9" % Test ), // add additional avro source test jar - Test / avroDependencyIncludeFilter := - configurationFilter("avro") && artifactFilter(name = "transitive", classifier = "tests"), + // we unfortunatelly must recompile schemas from compile scope when test schema depends on it. + Test / avroDependencyIncludeFilter := (Compile / avroDependencyIncludeFilter).value || + artifactFilter(name = "transitive", classifier = "tests"), // exclude specific avsc file Compile / avroUnpackDependencies / excludeFilter := (Compile / avroUnpackDependencies / excludeFilter).value || "exclude.avsc", diff --git a/plugin/src/sbt-test/sbt-avro/publishing/transitive/src/test/resources/test.avsc b/plugin/src/sbt-test/sbt-avro/publishing/transitive/src/test/resources/test.avsc index f3b0f0e..1a87638 100644 --- a/plugin/src/sbt-test/sbt-avro/publishing/transitive/src/test/resources/test.avsc +++ b/plugin/src/sbt-test/sbt-avro/publishing/transitive/src/test/resources/test.avsc @@ -6,6 +6,10 @@ { "name": "stringField", "type": "string" + }, + { + "name": "referencedTypeField", + "type": "com.github.sbt.avro.test.external.Avsc" } ] }