-
Notifications
You must be signed in to change notification settings - Fork 48
Consider scala patch version for scalac-scoverage-plugin #95
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
Merged
gslowikowski
merged 1 commit into
scoverage:master
from
chetanmeh:fix-plugin-artifactId
Jan 22, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,19 +58,19 @@ | |
* <br> | ||
* This is internal mojo, executed in forked {@code scoverage} life cycle. | ||
* <br> | ||
* | ||
* | ||
* @author <a href="mailto:[email protected]">Grzegorz Slowikowski</a> | ||
* @since 1.0.0 | ||
*/ | ||
@Mojo( name = "pre-compile", defaultPhase = LifecyclePhase.GENERATE_RESOURCES ) | ||
@Mojo( name = "pre-compile", defaultPhase = LifecyclePhase.GENERATE_RESOURCES ) | ||
public class SCoveragePreCompileMojo | ||
extends AbstractMojo | ||
{ | ||
|
||
/** | ||
* Allows SCoverage to be skipped. | ||
* <br> | ||
* | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Parameter( property = "scoverage.skip", defaultValue = "false" ) | ||
|
@@ -85,7 +85,7 @@ public class SCoveragePreCompileMojo | |
* <li>if specified, and equals {@code 2.13} or starts with {@code 2.13.} - <b>{@code scalac-scoverage-plugin_2.13}</b> will be used</li> | ||
* <li>if specified, but does not meet any of the above conditions or if not specified - plugin execution will be skipped</li> | ||
* </ul> | ||
* | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Parameter( property = "scala.version" ) | ||
|
@@ -129,7 +129,7 @@ public class SCoveragePreCompileMojo | |
/** | ||
* See <a href="https://github.com/scoverage/sbt-scoverage#highlighting">https://github.com/scoverage/sbt-scoverage#highlighting</a>. | ||
* <br> | ||
* | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Parameter( property = "scoverage.highlighting", defaultValue = "true" ) | ||
|
@@ -202,7 +202,7 @@ public class SCoveragePreCompileMojo | |
|
||
/** | ||
* Configures project for compilation with SCoverage instrumentation. | ||
* | ||
* | ||
* @throws MojoExecutionException if unexpected problem occurs | ||
*/ | ||
@Override | ||
|
@@ -293,7 +293,7 @@ else if ( "2.13".equals( resolvedScalaVersion ) || resolvedScalaVersion.startsWi | |
|
||
try | ||
{ | ||
Artifact pluginArtifact = getScalaScoveragePluginArtifact( scalaBinaryVersion ); | ||
Artifact pluginArtifact = getScalaScoveragePluginArtifact( scalaBinaryVersion, resolvedScalaVersion ); | ||
Artifact runtimeArtifact = getScalaScoverageRuntimeArtifact( scalaBinaryVersion ); | ||
|
||
if ( pluginArtifact == null ) | ||
|
@@ -434,7 +434,7 @@ private void setProperty( Properties projectProperties, String propertyName, Str | |
} | ||
} | ||
|
||
private Artifact getScalaScoveragePluginArtifact( String scalaMainVersion ) | ||
private Artifact getScalaScoveragePluginArtifact( String scalaMainVersion, String resolvedScalaVersion ) | ||
throws ArtifactNotFoundException, ArtifactResolutionException | ||
{ | ||
Artifact result = null; | ||
|
@@ -457,9 +457,20 @@ private Artifact getScalaScoveragePluginArtifact( String scalaMainVersion ) | |
} | ||
} | ||
|
||
result = | ||
getResolvedArtifact( "org.scoverage", "scalac-scoverage-plugin_" + scalaMainVersion, | ||
resolvedScalacPluginVersion ); | ||
try | ||
{ | ||
// Look for plugin artifact matching the scala version (full form like 2.12.14) | ||
// If not found then look for artifact based on major version like 2.12 | ||
result = | ||
getResolvedArtifact( "org.scoverage", "scalac-scoverage-plugin_" + resolvedScalaVersion, | ||
resolvedScalacPluginVersion ); | ||
} catch (ArtifactNotFoundException e) | ||
{ | ||
result = | ||
getResolvedArtifact( "org.scoverage", "scalac-scoverage-plugin_" + scalaMainVersion, | ||
resolvedScalacPluginVersion ); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If an exception were thrown from both the above try-block the below catch-block caught, then the error message will only report not finding the
scalaMainVersion
(rather than both thescalaMainVersion
andresolvedScalaVersion
).(I could be wrong though. Even if my comment is correct I don't whether a slightly inaccurate error message would be considered a good reason to block the pull request.)