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

compileScoverageScala waif with "bad option: -P:scoverage:sourceRoot:C:\" #194

Closed
rafalmag opened this issue May 19, 2023 · 6 comments
Closed

Comments

@rafalmag
Copy link
Contributor

Thanks for releasing v8.0.0 that supports scala 2.13.9+ (as previous Scala versions were affected by CVE-2022-36944 ).
However on Windows there is an issue that the report cannot be generated from Gradle plugin.

The error is:

> Task :compileScoverageScala FAILED
[Error] : bad option: -P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
[Error] : bad option: -P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
two errors found

FAILURE: Build failed with an exception.

Steps to reproduce:
Run test for org.scoverage.ScalaSingleModuleTest#checkScoverage on Windows, example by running command gradlew :functionalTest --tests "org.scoverage.ScalaSingleModuleTest.checkScoverage".

The very same test on tag 7.0.0 or 6.1.0 does not complain about "bad option", but fails with:

Execution failed for task ':checkScoverage'.
> Only 0% of project is covered by tests instead of 30% (coverageType: Line)

I guess that test is anyway not 100% compatible with Windows, but it would be already a progress if the test from tag v8.0.0 would at least produce "0% coverage" instead of failing with bad option.

Exception from org.scoverage.ScalaSingleModuleTest#checkScoverage (when added extra parameter "--stacktrace"):

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileScoverageScala'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:149)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:147)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:324)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:317)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:163)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:39)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:26)
	at org.gradle.api.internal.tasks.compile.daemon.AbstractIsolatedCompilerWorkerExecutor$CompilerWorkAction.execute(AbstractIsolatedCompilerWorkerExecutor.java:78)
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:54)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:48)
	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
	at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:48)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:96)
	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:65)
	at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
	at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
	at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: Compilation failed
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:335)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:157)
	... 22 more
Caused by: Compilation failed
	at xsbt.CachedCompiler0.handleErrors(CompilerBridge.scala:183)
	at xsbt.CachedCompiler0.run(CompilerBridge.scala:172)
	at xsbt.CachedCompiler0.run(CompilerBridge.scala:134)
	at xsbt.CompilerBridge.run(CompilerBridge.scala:39)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
	at sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
	... 25 more

Full output (from v8.0.0):

> Task :compileJava NO-SOURCE
> Task :compileGroovy UP-TO-DATE
> Task :pluginDescriptors UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileFunctionalTestJava UP-TO-DATE
> Task :compileFunctionalTestGroovy NO-SOURCE
> Task :processFunctionalTestResources UP-TO-DATE
> Task :functionalTestClasses UP-TO-DATE
> Task :pluginUnderTestMetadata UP-TO-DATE
> Task :functionalTest
> Task :clean
> Task :compileJava NO-SOURCE

> Task :compileScala
[Warn] : -target is deprecated: Use -release instead to compile against the correct platform API.
one warning found

> Task :compileScoverageJava NO-SOURCE

> Task :compileScoverageScala FAILED
[Error] : bad option: -P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
[Error] : bad option: -P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
two errors found

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileScoverageScala'.
> Compilation failed

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
3 actionable tasks: 3 executed

Unexpected build execution failure in C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module with arguments [-PscalaVersionMajor=2, -PscalaVersionMinor=13, -PscalaVersionBuild=10, -PjunitVersion=5.3.2, -PjunitPlatformVersion=1.3.2, -PscalatestVersion=3.0.8, --warning-mode=all, clean, checkScoverage]

Output:
> Task :clean
> Task :compileJava NO-SOURCE

> Task :compileScala
[Warn] : -target is deprecated: Use -release instead to compile against the correct platform API.
one warning found

> Task :compileScoverageJava NO-SOURCE

> Task :compileScoverageScala FAILED
[Error] : bad option: -P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
[Error] : bad option: -P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
two errors found

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileScoverageScala'.
> Compilation failed

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
3 actionable tasks: 3 executed

org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module with arguments [-PscalaVersionMajor=2, -PscalaVersionMinor=13, -PscalaVersionBuild=10, -PjunitVersion=5.3.2, -PjunitPlatformVersion=1.3.2, -PscalatestVersion=3.0.8, --warning-mode=all, clean, checkScoverage]

Output:
> Task :clean
> Task :compileJava NO-SOURCE

> Task :compileScala
[Warn] : -target is deprecated: Use -release instead to compile against the correct platform API.
one warning found

> Task :compileScoverageJava NO-SOURCE

> Task :compileScoverageScala FAILED
[Error] : bad option: -P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
[Error] : bad option: -P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
two errors found

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileScoverageScala'.
> Compilation failed

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
3 actionable tasks: 3 executed

	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$build$2(DefaultGradleRunner.java:269)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:362)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.build(DefaultGradleRunner.java:267)
	at app//org.scoverage.ScoverageFunctionalTest.run(ScoverageFunctionalTest.java:79)
	at app//org.scoverage.ScalaSingleModuleTest.checkScoverage(ScalaSingleModuleTest.java:57)
	at java.base@19/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base@19/java.lang.reflect.Method.invoke(Method.java:578)
	at app//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at app//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at app//org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at app//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at app//org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at app//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at app//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at app//org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at app//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at app//org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
	at java.base@19/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base@19/java.lang.reflect.Method.invoke(Method.java:578)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)


org.scoverage.ScalaSingleModuleTest > checkScoverage FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at ScalaSingleModuleTest.java:57
1 test completed, 1 failed
> Task :functionalTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':functionalTest'.
> There were failing tests. See the report at: file:///C:/Users/Rafal/Documents/IdeaProjects/gradle-scoverage/build/reports/tests/functionalTest/index.html
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
7 actionable tasks: 1 executed, 6 up-to-date

Part of the output with "--debug" flag:

2023-05-19T18:33:49.629+0200 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Resolve files of :zinc' completed
2023-05-19T18:33:49.629+0200 [INFO] [org.gradle.language.scala.tasks.AbstractScalaCompile] Zinc is doing a full recompile since the analysis file doesn't exist
2023-05-19T18:33:49.629+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.NormalizingScalaCompiler] Class path: [C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.10\67c1afabaea9ba51321159e70a78515647e1b73d\scala-library-2.13.10.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-reporter_2.13\2.0.8\31e6f4758b2ffb5d81677827dc822de9516dda09\scalac-scoverage-reporter_2.13-2.0.8.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-runtime_2.13\2.0.8\f62a81f0f3a0be9a375b3c61b82f3d3eda3036e0\scalac-scoverage-runtime_2.13-2.0.8.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang.modules\scala-xml_2.13\2.1.0\f2c107c097692b6c07941e7b96fcf6ec3b58add6\scala-xml_2.13-2.1.0.jar, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\java\scoverage, C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage]
2023-05-19T18:33:49.630+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.NormalizingScalaCompiler] Java compiler arguments: -source 1.8 -target 1.8 -d C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage -g -sourcepath  -processorpath C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-reporter_2.13\2.0.8\31e6f4758b2ffb5d81677827dc822de9516dda09\scalac-scoverage-reporter_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-runtime_2.13\2.0.8\f62a81f0f3a0be9a375b3c61b82f3d3eda3036e0\scalac-scoverage-runtime_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang.modules\scala-xml_2.13\2.1.0\f2c107c097692b6c07941e7b96fcf6ec3b58add6\scala-xml_2.13-2.1.0.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.10\67c1afabaea9ba51321159e70a78515647e1b73d\scala-library-2.13.10.jar -s C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\generated\sources\annotationProcessor\scala\scoverage -XDuseUnsharedTable=true -classpath C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.10\67c1afabaea9ba51321159e70a78515647e1b73d\scala-library-2.13.10.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-reporter_2.13\2.0.8\31e6f4758b2ffb5d81677827dc822de9516dda09\scalac-scoverage-reporter_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-runtime_2.13\2.0.8\f62a81f0f3a0be9a375b3c61b82f3d3eda3036e0\scalac-scoverage-runtime_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang.modules\scala-xml_2.13\2.1.0\f2c107c097692b6c07941e7b96fcf6ec3b58add6\scala-xml_2.13-2.1.0.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\java\scoverage;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\src\main\scala\org\hello\World.scala
2023-05-19T18:33:49.639+0200 [INFO] [org.gradle.api.internal.tasks.scala.ZincScalaCompiler] Compiling with Zinc Scala compiler.
2023-05-19T18:33:49.640+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompiler] Inputs(compilers: Compilers(scalac: Analyzing compiler (Scala 2.13.10), javaTools: sbt.internal.inc.javac.JavaTools$$anon$1@24b91172), options: CompileOptions(classpath: [Lxsbti.VirtualFile;@371cd5e2, sources: [Lxsbti.VirtualFile;@1cabebd0, classesDirectory: C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage, scalacOptions: [Ljava.lang.String;@2709eb00, javacOptions: [Ljava.lang.String;@4b574c12, maxErrors: 100, sourcePositionMapper: xsbti.compile.CompileOptions$1@1ab5235f, order: Mixed, temporaryClassesDirectory: Optional.empty, converter: Optional.empty, stamper: Optional.empty, earlyOutput: Optional.empty), setup: Setup(perClasspathEntryLookup: org.gradle.api.internal.tasks.scala.ZincScalaCompiler$EntryLookup@5903aeb2, skip: false, cachePath: C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\tmp\scala\compilerAnalysis\compileScoverageScala.analysis, cache: sbt.internal.inc.FreshCompilerCache@31ba0f79, incrementalCompilerOptions: IncOptions(transitiveStep: 5, recompileAllFraction: 0.5, relationsDebug: false, apiDebug: false, apiDiffContextSize: 5, apiDumpDirectory: Optional.empty, classfileManagerType: Optional[TransactionalManagerType(backupDirectory: C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\tmp\scala\classfileBackup\compileScoverageScala.bak, logger: org.gradle.api.internal.tasks.scala.SbtLoggerAdapter@40fce280)], auxiliaryClassFiles: [Lxsbti.compile.AuxiliaryClassFiles;@73609e1b, useCustomizedFileManager: false, recompileOnMacroDef: Optional[false], useOptimizedSealed: false, storeApis: true, enabled: true, extra: {}, logRecompileOnMacro: true, externalHooks: xsbti.compile.DefaultExternalHooks@37d2d8fb, ignoredScalacOptions: [Ljava.lang.String;@56f2c8bf, strictMode: false, allowMachinePath: true, pipelining: false), reporter: sbt.internal.inc.LoggedReporter@71bdc803, progress: Optional.empty, earlyAnalysisStore: Optional.empty, extra: [Lxsbti.T2;@65a0069), previousResult: PreviousResult(analysis: Optional.empty, setup: Optional.empty))
2023-05-19T18:33:49.640+0200 [INFO] [org.gradle.api.internal.tasks.scala.ZincScalaCompiler] Prepared Zinc Scala inputs: 0.001 secs
2023-05-19T18:33:49.645+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] IncrementalCompile -----------
2023-05-19T18:33:49.645+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] IncrementalCompile.incrementalCompile
2023-05-19T18:33:49.645+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] previous = Stamps for: 0 products, 0 sources, 0 libraries
2023-05-19T18:33:49.645+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] current source = Set(C:/Users/Rafal/Documents/IdeaProjects/gradle-scoverage/build/resources/functionalTest/projects/scala-single-module/src/main/scala/org/hello/World.scala)
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] > initialChanges = InitialChanges(Changes(added = Set(C:/Users/Rafal/Documents/IdeaProjects/gradle-scoverage/build/resources/functionalTest/projects/scala-single-module/src/main/scala/org/hello/World.scala), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(),API Changes: Set())
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Full compilation, no sources in previous analysis.
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] all 1 sources are invalidated
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Created transactional ClassFileManager with tempDir = C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\tmp\scala\classfileBackup\compileScoverageScala.bak
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Initial set of included nodes: 
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Recompiling all sources: number of invalidated sources > 50.0% of all sources
2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] About to delete class files:

2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] We backup class files:

2023-05-19T18:33:49.646+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] compilation cycle 1
2023-05-19T18:33:49.647+0200 [INFO] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] compiling 1 Scala source to C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage ...
2023-05-19T18:33:49.647+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Returning already retrieved and compiled bridge: C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\8.1.1\zinc-1.6.1_2.13.10_8\compiler-bridge.jar.
2023-05-19T18:33:49.658+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] Running cached compiler 78fbb70b for Scala compiler version 2.13.10
2023-05-19T18:33:49.659+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] The Scala compiler is invoked with:
	-deprecation
	-unchecked
	-P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
	-P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
	-Yrangepos
	-Xplugin:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar
	-target:8
	-bootclasspath
	C:\Program Files\Java\jdk1.8.0_192\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_192\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_192\jre\classes;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.10\67c1afabaea9ba51321159e70a78515647e1b73d\scala-library-2.13.10.jar
	-classpath
	C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.10\67c1afabaea9ba51321159e70a78515647e1b73d\scala-library-2.13.10.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-reporter_2.13\2.0.8\31e6f4758b2ffb5d81677827dc822de9516dda09\scalac-scoverage-reporter_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-runtime_2.13\2.0.8\f62a81f0f3a0be9a375b3c61b82f3d3eda3036e0\scalac-scoverage-runtime_2.13-2.0.8.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scala-lang.modules\scala-xml_2.13\2.1.0\f2c107c097692b6c07941e7b96fcf6ec3b58add6\scala-xml_2.13-2.1.0.jar;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\java\scoverage;C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\classes\scala\scoverage
2023-05-19T18:33:49.687+0200 [ERROR] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [Error] : bad option: -P:scoverage:dataDir:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\scoverage
2023-05-19T18:33:49.687+0200 [ERROR] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [Error] : bad option: -P:scoverage:sourceRoot:C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module
2023-05-19T18:33:49.690+0200 [ERROR] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] two errors found
2023-05-19T18:33:49.690+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Compilation failed (CompilerInterface)
2023-05-19T18:33:49.692+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Rolling back changes to class files.
2023-05-19T18:33:49.692+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Removing generated classes:

2023-05-19T18:33:49.693+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Restoring class files: 

2023-05-19T18:33:49.693+0200 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] Removing the temporary directory used for backing up class files: C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\tmp\scala\classfileBackup\compileScoverageScala.bak
@maiflai
Copy link
Contributor

maiflai commented May 20, 2023

https://github.com/scoverage/gradle-scoverage/blob/master/src/main/groovy/org/scoverage/ScoveragePlugin.groovy#L204 has

scalaCompileOptions.additionalParameters.add('-Xplugin:' + pluginFiles.join(":"))

I suspect this does not work with a path like c:\ - @msigmond, is this join required please?

--edit
I think scoverage/sbt-scoverage@8ba258c has the answer.

@rafalmag, could you test the replacement of ":" with File.pathSeparator on Windows please?

@rafalmag
Copy link
Contributor Author

rafalmag commented May 20, 2023

Great, main issue fixed! Thanks, I was experimenting with dataDir and sourceRoot and could not find why zinc is complaining. Once fixed Xplugin then I see scoverage plugin logs from "Zinc".

Now the test: org.scoverage.ScalaSingleModuleTest#reportScoverageWithExcludedClasses is green (and before the fix it also failed).

Regarding the org.scoverage.ScalaSingleModuleTest#checkScoverageFails - the test is still red (like on 7.0.0 or 6.1.0 branches) with:

2023-05-20T16:24:16.659+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2023-05-20T16:24:16.659+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2023-05-20T16:24:16.659+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2023-05-20T16:24:16.659+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':checkScoverage'.
2023-05-20T16:24:16.659+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Only 0% of project is covered by tests instead of 30% (coverageType: Line)

So no longer "bad option" error, but it seems it cannot read the coverage from reports. I checked the files:

2023-05-20T16:24:16.560+0200 [INFO] [org.gradle.api.Project] [scoverage] Written Cobertura XML report to C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\reports\scoverage\cobertura.xml
2023-05-20T16:24:16.564+0200 [INFO] [org.gradle.api.Project] [scoverage] Written XML report to C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\reports\scoverage\scoverage.xml
2023-05-20T16:24:16.575+0200 [INFO] [org.gradle.api.Project] [scoverage] Written HTML report to C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\resources\functionalTest\projects\scala-single-module\build\reports\scoverage\index.html

and the test coverage is 50%, so I guess there might be still some minor, but similar bug in checkScoverage or scoverage compiler plugin.

PS: The join seems to be required, as there are 3 files on the "-Xplugin" parameter list:

	C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-plugin_2.13.10\2.0.8\ffb6b75d2c4299106b14bfbfa80290db6e1b4e75\scalac-scoverage-plugin_2.13.10-2.0.8.jar
	C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-serializer_2.13\2.0.8\26d52b6f0cb540a5aad1d805cd837e803f52cc54\scalac-scoverage-serializer_2.13-2.0.8.jar
	C:\Users\Rafal\Documents\IdeaProjects\gradle-scoverage\build\tmp\functionalTest\work\.gradle-test-kit\caches\modules-2\files-2.1\org.scoverage\scalac-scoverage-domain_2.13\2.0.8\91e31dfe8f589c32953911304e0500b2b1496b7\scalac-scoverage-domain_2.13-2.0.8.jar

@maiflai
Copy link
Contributor

maiflai commented May 20, 2023

What is your Locale please? I wonder if there is a difference between the expected number format and the actual number format.

--edit I have deployed 8.0.1 with the compilation fix

@rafalmag
Copy link
Contributor Author

Thanks for prompt deployment.
Indeed problem is locale related. My locale is "pl_PL" (decimal separator = ','). When I run the test with JVM parameters: " -Duser.country=US -Duser.language=en" (decimal separator = '.' ) test is green now. Even all tests are green now :)

BTW: Both cobertura.xml and scoverage.xml (with pl_PL or en_US locale) are using "." as decimal separator (as per XML standard), so I guess that checkScoverage should parse those values using non-locale oriented parser.

@rafalmag
Copy link
Contributor Author

I think the issue is in org.scoverage.CoverageChecker#checkLineCoverage(java.io.File, org.scoverage.CoverageType, double) that uses NumberFormat from default locale.
If you would agree - I can prepare a PR with NumberFormat hardcoded like in DecimalFormat. Then org.scoverage.CoverageCheckerTest#failsWhenStatementRateIsBelowTarget tests fails with an error:

Expected: expects message "Only 33.33% of project is covered by tests instead of 100% (coverageType: Statement)"
     but: was <org.gradle.api.GradleException: Only 33,33% of project is covered by tests instead of 100% (coverageType: Statement)>

but it always looks stange to see an English text with "," used in numbers - so I would propose to remove number formats localization from error messages as well.

rafalmag added a commit to rafalmag/gradle-scoverage that referenced this issue May 21, 2023
rafalmag added a commit to rafalmag/gradle-scoverage that referenced this issue May 21, 2023
maiflai added a commit that referenced this issue May 21, 2023
(#194) Fix numbers decimal separator
@maiflai
Copy link
Contributor

maiflai commented May 21, 2023

Published 8.0.2 with support for Windows and non-US locale

@maiflai maiflai closed this as completed May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants