com-lihaoyi / mill

Your shiny new Java/Scala build tool!
https://mill-build.com/
MIT License
2k stars 308 forks source link

Scoverage: `xmlCoberturaReportAll` can not be found. #3136

Closed WeissP closed 2 months ago

WeissP commented 2 months ago

I am trying to generate XML scoverage report in Cobertura format via command xmlCoberturaReportAll, however it can not be found, which contradicts the information provided in the documentation.

To reproduce:

  1. download example 1-simple-scala
  2. change build.sc to
    
    import $ivy.`com.lihaoyi::mill-contrib-scoverage:`
    import mill.contrib.scoverage.ScoverageModule
    import mill._, scalalib._

object foo extends RootModule with ScalaModule with ScoverageModule { def scalaVersion = "2.13.11" def scoverageVersion = "2.0.10" def ivyDeps = Agg( ivy"com.lihaoyi::scalatags:0.12.0", ivy"com.lihaoyi::mainargs:0.6.2" )

object test extends ScalaTests with ScoverageTests { def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11") def testFramework = "utest.runner.Framework" } }

3. run `mill test`
4. run `mill scoverage.xmlCoberturaReportAll`

The following is the result of `mill resolve scoverage._`, note that `xmlReport` and `htmlReport` can be found. Does this mean I need to install extra dependencies?

scoverage.allIvyDeps scoverage.allScalacOptions scoverage.allSourceFiles scoverage.allSources scoverage.ammoniteReplClasspath scoverage.ammoniteVersion scoverage.artifactId scoverage.artifactName scoverage.artifactNameParts scoverage.artifactScalaVersion scoverage.artifactSuffix scoverage.assembly scoverage.bspCompileClassesPath scoverage.bspCompileClasspath scoverage.bspCompiledClassesAndSemanticDbFiles scoverage.bspLocalClasspath scoverage.bspTransitiveCompileClasspath scoverage.bspTransitiveLocalClasspath scoverage.compile scoverage.compileClasspath scoverage.compileIvyDeps scoverage.compileResources scoverage.compiledClassesAndSemanticDbFiles scoverage.console scoverage.consoleReport scoverage.crossFullScalaVersion scoverage.data scoverage.docJar scoverage.docJarUseArgsFile scoverage.docResources scoverage.docSources scoverage.finalMainClass scoverage.finalMainClassOpt scoverage.forkArgs scoverage.forkEnv scoverage.forkWorkingDir scoverage.generatedSources scoverage.htmlReport scoverage.ideaCompileOutput scoverage.ivyDeps scoverage.ivyDepsTree scoverage.jar scoverage.javacOptions scoverage.javadocOptions scoverage.launcher scoverage.localClasspath scoverage.localCompileClasspath scoverage.mainClass scoverage.mandatoryIvyDeps scoverage.mandatoryScalacOptions scoverage.manifest scoverage.platformSuffix scoverage.prepareOffline scoverage.prependShellScript scoverage.repl scoverage.resolvedAmmoniteReplIvyDeps scoverage.resolvedIvyDeps scoverage.resolvedRunIvyDeps scoverage.resolvedSemanticDbJavaPluginIvyDeps scoverage.resources scoverage.run scoverage.runBackground scoverage.runClasspath scoverage.runIvyDeps scoverage.runLocal scoverage.runMain scoverage.runMainBackground scoverage.runMainLocal scoverage.runUseArgsFile scoverage.scalaCompilerClasspath scoverage.scalaDocClasspath scoverage.scalaDocOptions scoverage.scalaDocPluginClasspath scoverage.scalaDocPluginIvyDeps scoverage.scalaLibraryIvyDeps scoverage.scalaOrganization scoverage.scalaVersion scoverage.scalacOptions scoverage.scalacPluginClasspath scoverage.scalacPluginIvyDeps scoverage.semanticDbData scoverage.semanticDbEnablePluginScalacOptions scoverage.semanticDbJavaVersion scoverage.semanticDbPluginClasspath scoverage.semanticDbPluginIvyDeps scoverage.semanticDbScalaVersion scoverage.semanticDbVersion scoverage.showModuleDeps scoverage.sourceJar scoverage.sources scoverage.transitiveCompileClasspath scoverage.transitiveCompileIvyDeps scoverage.transitiveIvyDeps scoverage.transitiveLocalClasspath scoverage.unmanagedClasspath scoverage.upstreamAssembly scoverage.upstreamAssemblyClasspath scoverage.upstreamCompileOutput scoverage.xmlReport scoverage.zincReportCachedProblems

lefou commented 2 months ago

You discovered a typo in the documentation. The target is xmlCoberturaReport, not xmlCoberturaReportAll.

Also, please compare the version of the documentation with the Mill version you use locally. This is a pretty recent addition, so make sure to use a recent Mill version. E..g the latest current Mill snapshot release is 0.11.7-70-654f58.

WeissP commented 2 months ago

I have updated mill to 0.11.7, but the command still can't be found.

mill --version
Mill Build Tool version 0.11.7
Java version: 11.0.19, vendor: Oracle Corporation, runtime: /nix/store/n17ckjsgngxyyz6x900w589d92kpn116-openjdk-11.0.19+7/lib/openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "Linux", version: 6.6.28, arch: amd64

Then I have invoked following commands

mill clean
mill test
mill scoverage.xmlCoberturaReport

The result was the same as before.

lefou commented 2 months ago

As said before, you may need to use the version which the documentation is referring to. This is currently 0.11.7-70-654f58.

image

lefou commented 2 months ago

The Cobertura support was added after 0.11.7.

WeissP commented 2 months ago

Oh sorry, I just realized how new this feature is. I guess I will wait until the provided bootstrap script is updated to include this feature (unless there is a fairly simple way to install mill in such a version, even in Ci?).

For now I will close the issue, if it still doesn't work after being updated, I will reopen it. Thanks a lot for you help!

lefou commented 2 months ago

Oh, since you already use a bootstrap script, using a specific version is fairly easy. https://mill-build.com/mill/Installation_IDE_Support.html#_overriding_mill_versions

lefou commented 2 months ago

Reopening, since the documentation is wrong and needs to be fixed.

WeissP commented 2 months ago

Oh, since you already use a bootstrap script, using a specific version is fairly easy. https://mill-build.com/mill/Installation_IDE_Support.html#_overriding_mill_versions

Oh I didn't know mill can be updated so easily, now it works. Thanks!