summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Lawson2019-03-23 15:50:18 -0700
committerJack Koenig2019-03-23 15:50:18 -0700
commit9cc5a7d567e4a3038dbb2f603aa44d1d435967a1 (patch)
tree9719c49debc6ae46f1f32704678d47909a742cb0
parentc6b34ead5878d2b8a64ea0a4b887e84fc39fff1d (diff)
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.
-rw-r--r--build.sbt24
-rw-r--r--scalastyle-config.xml2
-rw-r--r--scalastyle-test-config.xml4
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 @@
</check>
<check level="warning" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true">
<parameters>
- <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>
+ <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9_]*(_=)?$]]></parameter>
<parameter name="ignoreRegex"><![CDATA[^(\+[&%]?|\-[&%]?|\*|/|%|&|\||\^|<|>|\|\||&&|:=|<>|<=|>=|!=|===|=/=|<<|>>|##|unary_(~|\-%?|!))$]]></parameter>
</parameters>
</check>
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 @@
</check>
<check level="warning" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true">
<parameters>
- <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>
- <parameter name="ignoreRegex"><![CDATA[^(\+[&%]?|\-[&%]?|\*|/|%|&|\||\^|<|>|\|\||&&|:=|<>|<=|>=|!=|===|<<|>>|##|unary_(~|\-%?|!))$]]></parameter>
+ <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9_]*(_=)?$]]></parameter>
+ <parameter name="ignoreRegex"><![CDATA[^(\+[&%]?|\-[&%]?|\*|/|%|&|\||\^|<|>|\|\||&&|:=|<>|<=|>=|!=|===|=/=|<<|>>|##|unary_(~|\-%?|!))$]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="true">