Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoverage: Issue when also using BuildInfoModule #640

Closed
lefou opened this issue Jun 25, 2019 · 5 comments · Fixed by #647
Closed

Scoverage: Issue when also using BuildInfoModule #640

lefou opened this issue Jun 25, 2019 · 5 comments · Fixed by #647
Labels
solved The issue was fixed/resolved
Milestone

Comments

@lefou
Copy link
Member

lefou commented Jun 25, 2019

When I add ScoverageModule to a project, that also uses the BuildInfo module to genrate a BuildInfo.scala file, the file generator is not properly invoked.

The compile step fails, because there is no generated BuildInfo.scala.

$ mill core.test
[42/72] core.scoverage.compile 
[info] Compiling 2 Scala sources to /home/lefou/work/opensource/mill-osgi/out/core/scoverage/compile/dest/classes ...
[error] /home/lefou/work/opensource/mill-osgi/core/src/de/tobiasroeser/mill/osgi/OsgiBundleModule.scala:7:34: object internal is not a member of package de.tobiasroeser.mill.osgi
[error] import de.tobiasroeser.mill.osgi.internal.BuildInfo
[error]                                  ^
[error] /home/lefou/work/opensource/mill-osgi/core/src/de/tobiasroeser/mill/osgi/OsgiBundleModule.scala:149:116: not found: value BuildInfo
[error]       log.error(s"Your used mill version is most probably too old. In case of errors use (at least) mill version ${BuildInfo.millVersion}.")
[error]                                                                                                                    ^
[error] /home/lefou/work/opensource/mill-osgi/core/src/de/tobiasroeser/mill/osgi/OsgiBundleModule.scala:269:97: not found: value BuildInfo
[error]   protected[osgi] def checkMillVersion(millVersion: Option[String]): Boolean = checkMillVersion(BuildInfo.millVersion, millVersion)
[error]                                                                                                 ^
[error] three errors found
1 targets failed
core.scoverage.compile Compilation failed

Here is the target execution plan with scoverage:

$ mill.scalalib.ZincWorkerModule.scalalibClasspath
core.test.forkArgs
core.test.forkEnv
core.test.testFrameworks
core.test.resources
mill.scalalib.ZincWorkerModule.classpath
mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath
mill.scalalib.ZincWorkerModule.worker
mill.scalalib.ZincWorkerModule.worker
core.scoverage.upstreamCompileOutput
core.sources
core.scoverage.generatedSources
core.scoverage.allSources
core.scoverage.allSourceFiles
core.scoverage.transitiveLocalClasspath
core.resources
core.scoverage.unmanagedClasspath
core.scalaVersion
core.scoverage.scalaVersion
core.scoverage.platformSuffix
core.compileIvyDeps
core.scoverage.compileIvyDeps
core.scoverage.scalaOrganization
core.scoverage.scalaLibraryIvyDeps
core.ivyDeps.overriden.ammonite.$file.build.MillOsgiModule.ivyDeps
core.ivyDeps
core.scoverageVersion
core.scoverageRuntimeDep
core.scoverage.ivyDeps
core.scoverage.transitiveIvyDeps
core.scoverage.compileClasspath
core.scoverage.javacOptions
core.scalacOptions
core.scoverage.selfDir
core.scoverage.dataDir
core.scoverage.scalacOptions
core.scoverage.scalaCompilerClasspath
core.scalacPluginIvyDeps

Add here is the normal plan without scoverage:

$ mill plan core.test
mill.scalalib.ZincWorkerModule.scalalibClasspath
core.test.forkArgs
core.test.forkEnv
core.test.testFrameworks
core.test.resources
mill.scalalib.ZincWorkerModule.classpath
mill.scalalib.ZincWorkerModule.compilerInterfaceClasspath
mill.scalalib.ZincWorkerModule.worker
mill.scalalib.ZincWorkerModule.worker
core.upstreamCompileOutput
core.sources
GitSupport.gitHead
GitSupport.publishVersion
core.publishVersion
core.buildInfoMembers
core.generatedBuildInfo
core.generatedSources.overriden.mill.scalalib.JavaModule.generatedSources
core.generatedSources
core.allSources
core.allSourceFiles
core.transitiveLocalClasspath
core.resources
core.unmanagedClasspath
core.scalaVersion
core.platformSuffix
core.compileIvyDeps
core.scalaOrganization
core.scalaLibraryIvyDeps
core.ivyDeps.overriden.ammonite.$file.build.MillOsgiModule.ivyDeps
core.ivyDeps
core.transitiveIvyDeps
core.compileClasspath
core.javacOptions
core.scalacOptions
core.scalaCompilerClasspath
core.scalacPluginIvyDeps
core.scalacPluginClasspath
core.compile
core.test.upstreamCompileOutput
core.test.sources
core.test.generatedSources
core.test.allSources
core.test.allSourceFiles
core.localClasspath
core.test.transitiveLocalClasspath
core.test.unmanagedClasspath
core.test.scalaVersion
core.test.platformSuffix
core.test.compileIvyDeps
core.test.scalaOrganization
core.test.scalaLibraryIvyDeps
core.test.ivyDeps
core.test.transitiveIvyDeps
core.test.compileClasspath
core.test.scalaCompilerClasspath
core.test.scalacPluginClasspath
core.test.compile
core.test.localClasspath
core.test.runIvyDeps
core.test.upstreamAssemblyClasspath

At a first glace, one can see the plans are very different. The core.generatedBuildInfo target is missing. Also, there are other (essentially) targets missing in this specific case, e.g. GitSupport.publishVersion which generates the core.publishVersion.

@lefou
Copy link
Member Author

lefou commented Jun 25, 2019

@nvander1 ping

@lefou
Copy link
Member Author

lefou commented Jun 25, 2019

I was wondering, if we could define just the ScoverageTest as additional Test object in a regular ScalaModule, or even as a sub-module of a test module. That way, we could reuse almost all configuration easily.

Usage outline:

object core extends ScalaModule with ... {
  object test extends Tests with ScoverageTests {
    def scoverageVersion = "1.3.1"
  }
}

@lefou
Copy link
Member Author

lefou commented Jun 25, 2019

Or in case, one wants to run tests also without scoverage instrumentations:

object core extends ScalaModule with ... {
  object test extends Tests { }
  object scoverage extends Tests with ScoverageTests {
    def scoverageVersion = "1.3.1"
  }
}

@nvander1
Copy link
Contributor

@lefou I am also experiencing similar issues of missing targets. Feels similar to part 1 of issue #613 as referenced in fulcrumgenomics/commons#47. Also similar to #620 .

I'll be looking more in depth at this later this week.

@nvander1
Copy link
Contributor

nvander1 commented Jul 3, 2019

PR coming later today for this. @lefou

@lefou lefou closed this as completed in #647 Jul 4, 2019
@lefou lefou added this to the after-0.4.2 milestone Jul 4, 2019
@lefou lefou added the solved The issue was fixed/resolved label Jul 4, 2019
lefou added a commit to lefou/mill-osgi that referenced this issue Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved The issue was fixed/resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants