scoverage / gradle-scoverage

A plugin to enable the use of Scoverage in a gradle Scala project
Apache License 2.0
53 stars 38 forks source link

use full scala version suffix for scalac-scoverage-... dependencies #152

Closed maslovalex closed 3 years ago

maslovalex commented 3 years ago

scalac-scoverage-plugin and scalac-scoverage-runtime from version 1.4.2 publish artifacts with specific scala version suffix.

see https://search.maven.org/search?q=scalac-scoverage-runtime

ATM, it is possible to use by setting scoverageScalaVersion like this.

scoverage {
  scoverageScalaVersion = '2.12.13'
}

But in case scoverageScalaVersion resolved from the scala-library dependency only major part is taken:

https://github.com/scoverage/gradle-scoverage/blob/f92c9424ad8b02e13dcbfc790c8995c51fd1b308/src/main/groovy/org/scoverage/ScoveragePlugin.groovy#L364

https://github.com/scoverage/gradle-scoverage/blob/f92c9424ad8b02e13dcbfc790c8995c51fd1b308/src/main/groovy/org/scoverage/ScoveragePlugin.groovy#L70

tnielens commented 3 years ago

Same here, this prevents using latest scala versions due to https://github.com/scoverage/scalac-scoverage-plugin/issues/305

maiflai commented 3 years ago

Sorry - does this really prevent the use of the latest scala versions?

It's less convenient than before, but you should be able to set

scoverage {
  scoverageVersion = '1.4.4'
  scoverageScalaVersion = '2.12.13'
}

I think this is required because the publishing of the upstream compiler plugin has changed.

tnielens commented 3 years ago

@maiflai your snippet will not work I think because as of version 1.4.3, the scoverage scala plugin is published against full scala versions only (2.12.12, 2.12.13, etc) and no shorter binary versions (2.12, 2.13) anymore. See https://mvnrepository.com/artifact/org.scoverage/scalac-scoverage-plugin .

maiflai commented 3 years ago

It seems to work for me.

Perhaps you could provide a reproduction of the issue?

maslovalex commented 3 years ago

I think that should work (as I mentioned it my 1st message).

It will not work if you omit setting scoverageScalaVersion and expect plugin to set it based on the scala-library version from dependencies.

maiflai commented 3 years ago

Thanks for confirming.

Unfortunately what looked like a trivial fix isn't working quite as expected.

I'd prefer to concentrate on the --parallel issue rather than this as it appears to have a valid workaround.

tnielens commented 3 years ago

Alright I'm probably wrong. I'll check if I can come up with a repro or if the issue is on my build. Thanks!

tnielens commented 3 years ago

back here :) I'm currently trying with

{
    scoverageVersion = '1.4.8'
    scoverageScalaVersion = '2.12.14'
}

scoverage-plugin seems to be published with full scala version whereas scoverage-runtime with binary version only. So setting scoverageScalaVersion to 2.12 (resp. 2.12.14) will fail to resolve scoverage-plugin (resp. scoverage-runtime)