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

sbt-scoverage 2.0.0 fails on Windows with [error] bad option: -P:scoverage: errors #440

Closed
guizmaii opened this issue Jun 28, 2022 · 1 comment

Comments

@guizmaii
Copy link

guizmaii commented Jun 28, 2022

We have CIs running on Linux, macOS and Windows.

Since we updated to sbt-scoverage 2.0.0, we have the following error at compile time on Windows when we run the sbt 'clean;coverage;test;coverageReport' command:

[error] bad option: -P:scoverage:dataDir:D:\a\project-name\project-name\modules\common\target\scala-2.13/scoverage-data
[error] bad option: -P:scoverage:sourceRoot:D:\a\project-name\project-name
[error] bad option: -P:scoverage:excludedPackages:caliban.generator.*;com.project.name.api.client.generated.*;com.project.name.api.client.api.testkit.*
[error] bad option: -P:scoverage:reportTestName
[error] four errors found
[error] (common / Compile / compileIncremental) Compilation failed
[error] Total time: 50 s, completed Jun 27, 2022, 11:55:15 AM

The same sbt command on Linux and macOS works normally.

Could it be because of the /scoverage-data in scoverage:dataDir:D:\a\project-name\project-name\modules\common\target\scala-2.13/scoverage-data which should be \scoverage-data on Windows 🤔

guizmaii added a commit to guizmaii/sbt-scoverage that referenced this issue Jun 28, 2022
@guizmaii guizmaii mentioned this issue Jun 28, 2022
stevedlawrence added a commit to stevedlawrence/sbt-scoverage that referenced this issue Sep 28, 2022
The -Xplugin option expects a classpath string with multiple paths
separated by a semicolon or colon depending on this operating system.
However, this currently always uses a colon, which doesn't work on
windows. This means scalac cannot find the scoverage plugin jars and
leads to errors about "bad options".

This modifies the -Xplugin logic to use File.pathSeparator when building
the Xplugin classpath, allowing it to work regardless of operating
system.

Closes scoverage#440
stevedlawrence added a commit to stevedlawrence/sbt-scoverage that referenced this issue Oct 18, 2022
The -Xplugin option expects a classpath string with multiple paths
separated by a semicolon or colon depending on this operating system.
However, this currently always uses a colon, which doesn't work on
windows. This means scalac cannot find the scoverage plugin jars and
leads to errors about "bad options".

This modifies the -Xplugin logic to use File.pathSeparator when building
the Xplugin classpath, allowing it to work regardless of operating
system.

Also modifies excludedPackages when on windows to replace unix file
separators with escaped windows file separators. Modifies tests to
remove unnecessary escaping of unix separators.

Closes scoverage#440
@rolandtritsch
Copy link
Member

Closed with #465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants