Skip to content

Commit

Permalink
Revert test jar dependency con compile schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Nov 7, 2024
1 parent 07a2d88 commit f9a0035
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```

Expand Down
10 changes: 6 additions & 4 deletions plugin/src/sbt-test/sbt-avro/publishing/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
)
Expand All @@ -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",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
{
"name": "stringField",
"type": "string"
},
{
"name": "referencedTypeField",
"type": "com.github.sbt.avro.test.external.Avsc"
}
]
}

0 comments on commit f9a0035

Please sign in to comment.