From c4a65baab92890d2d5682329a87469bec605fe5d Mon Sep 17 00:00:00 2001 From: Nik Vanderhoof Date: Sat, 18 May 2019 23:22:13 -0400 Subject: Add support for Scoverage (#571) * Add initial work for ScoverageModule * style: Move package scoverage from lib to contrib Suggested by @lefou > I think, it would be better to add under `mill.contrib.scoverage`. Pull request: #571 * Initial changes to non-hardcoded scoverage version * Using task context api to specify dataDir Now measurement data will be written to: PROJECT_ROOT/out/MODULE/scoverage/data/ and the html report will be written to: PROJECT_ROOT/out/MODULE/scoverage/data/htmlReport/ * Remove wild card imports in scoverage Also remove scoverage dependency from build.sc * Move htmlReport into worker Based on what I've seen in scalalib, scalajslib, scalanativelib, playlib, and twirllib modules. Still need to add tests * Add basic docs + tests for scoverage I still am working on testing the actual generation of reports. * Use cross-module for scoverage worker Now we can support multiple versions of scoverage by adding them to the crossmodule list. Also now running the local publish script succeeds. * Add scoverage to ci tests * Add detailed ScoverageModule documentation * Test scoverage dataDir * Remove
 tags in scaladoc

* Add scoverage dependency in less hacky way

* Modify scoverage tests to check classpaths

* Put docs in alphabetical order

* Test classpaths for scoverage runtime

* Remove abstract def test: ScoverageTests

* Construct classloader differently

* Revert "Construct classloader differently"

This reverts commit fccf9a94cc38fb9e2be58a9ff90b00b65f339db6.

* Revert "Construct classloader differently"

Also fixes unfound error in html report

This reverts commit fccf9a94cc38fb9e2be58a9ff90b00b65f339db6.

* Fix classpath for scoverage worker
---
 build.sc | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

(limited to 'build.sc')

diff --git a/build.sc b/build.sc
index fd5d4e29..215e8d37 100755
--- a/build.sc
+++ b/build.sc
@@ -287,6 +287,31 @@ object contrib extends MillModule {
     def moduleDeps = Seq(scalalib)
   }
 
+  object scoverage extends MillModule {
+    def moduleDeps = Seq(scalalib, scoverage.api)
+
+    def testArgs = T {
+      val mapping = Map(
+        "MILL_SCOVERAGE_REPORT_WORKER_1_3_1" -> worker("1.3.1").compile().classes.path
+      )
+      scalalib.worker.testArgs() ++
+        scalalib.backgroundwrapper.testArgs() ++
+        (for ((k, v) <- mapping) yield s"-D$k=$v")
+    }
+
+    object api extends MillApiModule {
+      def moduleDeps = Seq(scalalib)
+    }
+
+    object worker extends Cross[WorkerModule]("1.3.1")
+
+    class WorkerModule(scoverageVersion: String) extends MillApiModule {
+      def moduleDeps = Seq(scoverage.api)
+
+      def ivyDeps = Agg(ivy"org.scoverage::scalac-scoverage-plugin:${scoverageVersion}")
+    }
+  }
+
   object buildinfo extends MillModule {
     def moduleDeps = Seq(scalalib)
     // why do I need this?
@@ -436,7 +461,7 @@ def launcherScript(shellJvmArgs: Seq[String],
 }
 
 object dev extends MillModule{
-  def moduleDeps = Seq(scalalib, scalajslib, scalanativelib, contrib.scalapblib, contrib.tut)
+  def moduleDeps = Seq(scalalib, scalajslib, scalanativelib, contrib.scalapblib, contrib.tut, contrib.scoverage)
 
   def forkArgs =
     (
-- 
cgit v1.2.3