diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba789e645..bf1c4161d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,6 +145,7 @@ jobs: ./sbt -v --client doc ./sbt -v --client publishLocal ./sbt -v --client test + ./sbt -v --client lmCoursierShaded/test ./sbt -v --client "serverTestProj/test" ./sbt -v --client "all $UTIL_TESTS" - name: Build and test (2) diff --git a/build.sbt b/build.sbt index cf40e37e5..76c58c6ab 100644 --- a/build.sbt +++ b/build.sbt @@ -1338,6 +1338,8 @@ lazy val lmCoursier = project ) .dependsOn(lmCore) +lazy val checkLmcoursierPackage = taskKey[Unit]("") + lazy val lmCoursierShaded = project .in(file("lm-coursier/target/shaded-module")) .settings( @@ -1354,6 +1356,20 @@ lazy val lmCoursierShaded = project ), assembly / assemblyOption ~= { _.withIncludeScala(false) }, conflictWarning := ConflictWarning.disable, + checkLmcoursierPackage := { + val jarFile = assembly.value + IO.withTemporaryDirectory { tmp => + val notLmcoursierPackageClasses = IO + .unzip(jarFile, tmp, _.endsWith(".class")) + .toSeq + .map(f => IO.relativize(tmp, f).getOrElse(sys.error(s"invalid path ${f}"))) + .filterNot(f => f.startsWith("lmcoursier") || f.startsWith("META-INF")) + .sorted + notLmcoursierPackageClasses.foreach(println) + assert(notLmcoursierPackageClasses.isEmpty) + } + }, + Test / test := (Test / test).dependsOn(checkLmcoursierPackage).value, Utils.noPublish, assemblyShadeRules := { val namespacesToShade = Seq(