-
Notifications
You must be signed in to change notification settings - Fork 159
Use SBT settings to control scoverage #182
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
Conversation
N.B. Build failing as release of scoverage/scalac-scoverage-plugin#177 required |
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.2.0-SNAPSHOT" | ||
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.2.0" | ||
|
||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't think it is good idea to force users of the sbt-scoverage plugin to download sbt-scalajs, I see all you need from that plugin is a way to guess if the project is Scala.JS and what "binary" version it uses. I guess sbt should have such feature, but for now I think it makes much more sense to just guess that as I did: 2c1e7bb#diff-627f9fd5c400939149d75695caad1988R68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lustefaniak Basically, I fully agree. In fact, I answered this comment on the SBT gitter even before you posted this comment - and even referenced your work! So yes, we are on the same page.
Note the other suggestion of having a plugin per platform ( one just extending the other) as we do with libs.
The reason I have it as it is now is "just to get it working" - note that I am also enforcing a minimum version of scala.js of 0.6.12
as that is the version that has scala 2.12.0-RC1. This will also be the one that scoverage/scalac-scoverage-plugin#177 uses. Which is the other point - what if the version of scala.js an end user uses is diff to the one that scalac-scoverage-plugin uses? Or ....
These are all points to be considered, really this PR just aims to be a minimum "that works"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, as noted in sbt gitter, I said I would do it this way until it became an issue . ie now 😄 So, I'll have a quick look to get a working version that we can refine later
OK: I removed the plugin as per comment ^^. I also removed the Pgp plugin as it should be under Added attribution to commit comment |
@BennyHill Are you aware this failed CI build? |
@rorygraves "Are you aware this failed CI build?" Yes, see comment in this PR above ^^
What more can I do? |
Sorry guys, I am the only person that reviewed this PR and even that attracts negativity. This just cannot be right. |
Also:
That is in the main comment. Game over |
Sorry @BennyHill, I did a quick scan through the PRs, I read your last commit as 'I've just pushed a change' without reading the entire thread. |
I've now removed the jvm settings as I hopefully have fixed this "the sbt way" - the reviews will no doubt help in this regard
But, for "easy" things, a commandalias does the job
These are currently not "mapped" together, despite appearing to do the same thing. Soln: make coverage
There are many "this works for me, try..." suggestions. Whilst helpful, the core problems remain as these solutions tend to be specific to:
The main way that I have tried to address these issues is by trying to just "standard" sbt methods so hopefully the behave is more familiar More thoughts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self review 1
val autoImport = ScoverageKeys | ||
|
||
val cmdlineScoverageEnabled = sys.props.getOrElse("scoverage.enabled", default = "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer required
Please rebase, remove conflicts, remove |
@gslowikowski This looks good, lets get it merged then #188 should be good too. |
I found one more problem. You removed custom hidden
The solution with custom configuration for plugin dependencies is described in SBT Faq in "How should I express a dependency on an outside tool such as proguard?" section and used e.g. in SBT Sxr plugin Restore previous logic using custom configuration, please. |
This implementation does not add anything when |
Some people publish instrumented artifacts. They shouldn't, but they do. This is very bad, but we cannot do anything to stop them. Compare generated poms with coverage turned on.
|
That's my point it isn't. The after ^^ is from a local publish of this PR, that's how I know that it isn't added. See also this bigger example The example you give from SBT is different as it is not a plugin, they don't turn things on/off. But the idea here is that as now the "turning on/off" is done very correctly (as far as I hope) then we do not need to worry. |
Perhaps I could make a suggestion? Could we merge this as-is and then I can rebase #188 and that should pass. I can then change my project https://github.com/typelevel/catalysts to stop using the local publish and we can see what is exactly working? The project should give a good indication of where we are. We can then always modify/update later and check the differences. I've got nothing against adding the new scope, but so far I do not see that is necessary (but was with the old method) |
And I would say in that case, with |
And the reason for my suggestion to use https://github.com/typelevel/catalysts:
I concede that ideally we have all tests in scoverage repository, but for now this is, IMHO, a rapid way to checks things out And on that note, it would be quicker still if |
So, using catalysts
Again, this is correct. It was compiled with the coverage library against the runtime. Any lib getting this dependency will know for sure that has been instrumented. Sure, we could remove it using the mechanism you describe ^^ but we are lying. So hey, I can do this - I'm just explaining what is there. |
So I've pushed the change |
Thank you. |
This PR is designed and tested with scoverage/scalac-scoverage-plugin#177.
One of the big issues with the sbt-scoverage plugin is turning coverage on/off as the state needs to be modified, the current settings propagated up/down projects, etc. It's certainly not trivial, even if it's actually possible. The number of open/closed issues/PR's attest to this.
So... rather than fully fix this, I have a workaround that I think will provide a solid base to move this forward, and of course it works (I think ) with 2.12 etc. The solution is basically to set things up via a jvm command line parameter: So
sbt -Dscoverage.enabled="true" +clean +rootJVM/test
will test with coverage on for 2.10, 2.11 and 2.12.0-RC1, in this example for all JVM projects only (no JS)sbt -Dscoverage.enabled="false" +clean +test +publishLocal
will test with coverage off for 2.10, 2.11 and 2.12.0-RC1 - and will not add any depencencies to the pomsbt +clean +test +publishLocal
will retain current behaviourruntimeClassifier
method supplied by @lustefaniak