diff --git a/build.sc b/build.sc index 10667ab5532..1ed34737b74 100755 --- a/build.sc +++ b/build.sc @@ -471,6 +471,12 @@ object contrib extends MillModule { object proguard extends MillModule { override def compileModuleDeps = Seq(scalalib) + override def testArgs = T { + Seq( + "-DMILL_SCALA_LIB=" + scalalib.runClasspath().map(_.path).mkString(","), + "-DMILL_PROGUARD_LIB=" + runClasspath().map(_.path).mkString(",") + ) ++ scalalib.worker.testArgs() + } } object tut extends MillModule { diff --git a/contrib/proguard/test/src/ProguardTests.scala b/contrib/proguard/test/src/ProguardTests.scala index 2cac1096dcd..3b1e4b90f76 100644 --- a/contrib/proguard/test/src/ProguardTests.scala +++ b/contrib/proguard/test/src/ProguardTests.scala @@ -12,19 +12,27 @@ import utest.framework.TestPath object ProguardTests extends TestSuite { - object Proguard - extends TestUtil.BaseModule - with scalalib.ScalaModule - with Proguard { + object proguard extends TestUtil.BaseModule with ScalaModule with Proguard { // override build root to test custom builds/modules - override def millSourcePath: Path = TestUtil.getSrcPathStatic() +// override def millSourcePath: Path = TestUtil.getSrcPathStatic() + override def millSourcePath: os.Path = + TestUtil.getSrcPathBase() / millOuterCtx.enclosing.split('.') + override def scalaVersion = "2.12.0" + + def proguardContribClasspath = T{ + mill.modules.Util.millProjectModule("MILL_PROGUARD_LIB", "mill-contrib-proguard", repositoriesTask()) + } + + override def runClasspath: Target[Seq[PathRef]] = T{super.runClasspath() ++ proguardContribClasspath()} + } - val testModuleSourcesPath: Path = os.pwd / 'contrib / 'proguard / 'test / 'resources / "proguard" + val testModuleSourcesPath + : Path = os.pwd / 'contrib / 'proguard / 'test / 'resources / "proguard" def workspaceTest[T](m: TestUtil.BaseModule)(t: TestEvaluator => T)( - implicit tp: TestPath): T = { + implicit tp: TestPath): T = { val eval = new TestEvaluator(m) os.remove.all(m.millSourcePath) os.remove.all(eval.outPath) @@ -34,14 +42,14 @@ object ProguardTests extends TestSuite { } def tests: Tests = Tests { - 'proguard - { - "should download proguard jars" - workspaceTest(Proguard) { eval => - val Right((agg, _)) = eval.apply(Proguard.proguardClasspath) - assert(!agg.isEmpty) + test("Proguard module") { + test("should download proguard jars") - workspaceTest(proguard) { eval => + val Right((agg, _)) = eval.apply(proguard.proguardClasspath) + assert(!agg.iterator.toSeq.isEmpty) } - "create proguarded jar" - workspaceTest(Proguard) { eval => - val Right((path, _)) = eval.apply(Proguard.proguard) + test("should create a proguarded jar") - workspaceTest(proguard) { eval => + val Right((path, _)) = eval.apply(proguard.proguard) assert(os.exists(path.path)) }