From 9cc5a7d567e4a3038dbb2f603aa44d1d435967a1 Mon Sep 17 00:00:00 2001
From: Jim Lawson
Date: Sat, 23 Mar 2019 15:50:18 -0700
Subject: Aggregate coverage - aggregate tests but not publishing (#1040)
Discover a working combination of aggregate usage to enable coverage of subproject testing but publish a single Jar.
Use "scalastyle-test-config.xml" for scalastyle config in tests.
Enable "_" in method names and accept method names ending in "_=".
Re-sync scalastyle-test-config.xml with scalastyle-config.xml
This should finally fix #772.---
build.sbt | 24 +++++++++++++-----------
scalastyle-config.xml | 2 +-
scalastyle-test-config.xml | 4 ++--
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/build.sbt b/build.sbt
index f403697f..25b38fe4 100644
--- a/build.sbt
+++ b/build.sbt
@@ -43,6 +43,7 @@ lazy val commonSettings = Seq (
scalacOptions := Seq("-deprecation", "-feature") ++ scalacOptionsVersion(scalaVersion.value),
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
+ (scalastyleConfig in Test) := (baseDirectory in root).value / "scalastyle-test-config.xml",
// Use the root project's unmanaged base for all sub-projects.
unmanagedBase := (unmanagedBase in root).value,
// Since we want to examine the classpath to determine if a dependency on firrtl is required,
@@ -120,11 +121,13 @@ lazy val chiselSettings = Seq (
lazy val coreMacros = (project in file("coreMacros")).
settings(commonSettings: _*).
- settings(publishArtifact := false)
+ // Prevent separate JARs from being generated for coreMacros.
+ settings(skip in publish := true)
lazy val chiselFrontend = (project in file("chiselFrontend")).
settings(commonSettings: _*).
- settings(publishArtifact := false).
+ // Prevent separate JARs from being generated for chiselFrontend.
+ settings(skip in publish := true).
settings(
scalacOptions := scalacOptions.value ++ Seq(
"-deprecation",
@@ -153,9 +156,15 @@ lazy val chisel = (project in file(".")).
settings(commonSettings: _*).
settings(chiselSettings: _*).
settings(publishSettings: _*).
- // Prevent separate JARs from being generated for coreMacros and chiselFrontend.
dependsOn(coreMacros % "compile-internal;test-internal").
dependsOn(chiselFrontend % "compile-internal;test-internal").
+ // We used to have to disable aggregation in general in order to suppress
+ // creation of subproject JARs (coreMacros and chiselFrontend) during publishing.
+ // This had the unfortunate side-effect of suppressing coverage tests and scaladoc generation in subprojects.
+ // The "skip in publish := true" setting in subproject settings seems to be
+ // sufficient to suppress subproject JAR creation, so we can restore
+ // general aggregation, and thus get coverage tests and scaladoc for subprojects.
+ aggregate(coreMacros, chiselFrontend).
settings(
scalacOptions in Test ++= Seq("-language:reflectiveCalls"),
scalacOptions in Compile in doc ++= Seq(
@@ -167,14 +176,7 @@ lazy val chisel = (project in file(".")).
"-doc-title", name.value,
"-doc-root-content", baseDirectory.value+"/root-doc.txt"
),
- // Disable aggregation in general, but enable it for specific tasks.
- // Otherwise we get separate Jar files for each subproject and we
- // go to great pains to package all chisel3 core code in a single Jar.
- // If you get errors indicating coverageReport is undefined, be sure
- // you have sbt-scoverage in project/plugins.sbt
- aggregate := false,
- aggregate in coverageReport := true,
- // Include macro classes, resources, and sources main JAR.
+ // Include macro classes, resources, and sources main JAR since we don't create subproject JARs.
mappings in (Compile, packageBin) ++= (mappings in (coreMacros, Compile, packageBin)).value,
mappings in (Compile, packageSrc) ++= (mappings in (coreMacros, Compile, packageSrc)).value,
mappings in (Compile, packageBin) ++= (mappings in (chiselFrontend, Compile, packageBin)).value,
diff --git a/scalastyle-config.xml b/scalastyle-config.xml
index e12da8c2..67aa8afe 100644
--- a/scalastyle-config.xml
+++ b/scalastyle-config.xml
@@ -95,7 +95,7 @@
-
+
|\|\||&&|:=|<>|<=|>=|!=|===|=/=|<<|>>|##|unary_(~|\-%?|!))$]]>
diff --git a/scalastyle-test-config.xml b/scalastyle-test-config.xml
index bf32aacd..50953819 100644
--- a/scalastyle-test-config.xml
+++ b/scalastyle-test-config.xml
@@ -94,8 +94,8 @@
-
- |\|\||&&|:=|<>|<=|>=|!=|===|<<|>>|##|unary_(~|\-%?|!))$]]>
+
+ |\|\||&&|:=|<>|<=|>=|!=|===|=/=|<<|>>|##|unary_(~|\-%?|!))$]]>
--
cgit v1.2.3