From 8483a68ebcc1e126587ed4dbd48be1acc6df7698 Mon Sep 17 00:00:00 2001 From: Eugene Platonov Date: Tue, 12 Nov 2024 23:45:12 -0500 Subject: [PATCH] Drop sbt-compiler-maven-plugin (it's effectively dead) --- README.md | 15 +++++------ .../plugin/SCoveragePreCompileMojo.java | 25 +------------------ 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index e265bc8a..7918f31e 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,10 @@ internal mojos: ### Prerequisites / limitations -- The plugin is compatible with two Maven Scala compiler plugins: - - - [Scala Maven Plugin](http://davidb.github.io/scala-maven-plugin/) - version `3.0.0` or later required, [addScalacArgs](http://davidb.github.io/scala-maven-plugin/compile-mojo.html#addScalacArgs) and [analysisCacheFile](http://davidb.github.io/scala-maven-plugin/compile-mojo.html#analysisCacheFile) configuration parameters cannot be set directly, use project properties `addScalacArgs` and `analysisCacheFile` instead. - - - [SBT Compiler Maven Plugin](https://github.com/sbt-compiler-maven-plugin/sbt-compiler-maven-plugin/) - version `1.0.0-beta5` or later required. Currently it works only with Scoverage Maven Plugin `1.4.11` or earlier. - -- Starting with version `2.0.0` the plugin supports Scala `2.12.8+`, `2.13.0+` and `3.2.0+`. For Scala `2.10` and `2.11` support please use version `1.4.11`. +- The plugin is compatible with [Scala Maven Plugin](http://davidb.github.io/scala-maven-plugin/) + - version `3.0.0` or later required + - [addScalacArgs](http://davidb.github.io/scala-maven-plugin/compile-mojo.html#addScalacArgs) and [analysisCacheFile](http://davidb.github.io/scala-maven-plugin/compile-mojo.html#analysisCacheFile) configuration parameters cannot be set directly, use project properties `addScalacArgs` and `analysisCacheFile` instead. +- Starting with version `2.0.0` the plugin supports Scala `2.12.8+`, `2.13.0+` and `3.2.0+`. For Scala `2.12.7` and lower please use version `1.4.11` of the plugin. - The plugin is not thread-safe, so it should not be used in multi-threaded builds. @@ -78,7 +75,7 @@ If all the attempts to resolve the Scala version fail, then coverage will not be ```xml - 2.13.12 + 2.13.15 ``` @@ -94,7 +91,7 @@ or scoverage-maven-plugin ${scoverage.plugin.version} - 2.13.12 + 2.13.15 diff --git a/src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java b/src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java index 1a3e2f24..09d58ee3 100644 --- a/src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java +++ b/src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java @@ -53,7 +53,6 @@ * Supported compiler plugins: * *
* This is internal mojo, executed in forked {@code scoverage} life cycle. @@ -203,8 +202,7 @@ public void execute() throws MojoExecutionException Properties projectProperties = project.getProperties(); // for maven-resources-plugin (testResources), maven-compiler-plugin (testCompile), - // sbt-compiler-maven-plugin (testCompile), scala-maven-plugin (testCompile), - // maven-surefire-plugin and scalatest-maven-plugin + // scala-maven-plugin (testCompile), maven-surefire-plugin and scalatest-maven-plugin setProperty( projectProperties, "maven.test.skip", "true" ); // for scalatest-maven-plugin and specs2-maven-plugin setProperty( projectProperties, "skipTests", "true" ); @@ -273,23 +271,19 @@ public void execute() throws MojoExecutionException } String arg = ( scala2 ? SCALA2_DATA_DIR_OPTION : SCALA3_COVERAGE_OUT_OPTION ) + dataDirectory.getAbsolutePath(); - String _scalacOptions = quoteArgument( arg ); String addScalacArgs = arg; arg = scala2 ? ( SOURCE_ROOT_OPTION + session.getExecutionRootDirectory() ) : ""; - _scalacOptions = _scalacOptions + SPACE + quoteArgument( arg ); addScalacArgs = addScalacArgs + PIPE + arg; if ( !StringUtils.isEmpty( excludedPackages ) ) { if ( scala2 ) { arg = SCALA2_EXCLUDED_PACKAGES_OPTION + excludedPackages.replace( "(empty)", "" ); - _scalacOptions = _scalacOptions + SPACE + quoteArgument( arg ); addScalacArgs = addScalacArgs + PIPE + arg; } else if ( filePackageExclusionSupportingScala3 ) { String scala3FormatExcludedPackages = excludedPackages.replace( ";", "," ); arg = SCALA3_EXCLUDED_PACKAGES_OPTION + scala3FormatExcludedPackages; - _scalacOptions = _scalacOptions + SPACE + quoteArgument( arg ); addScalacArgs = addScalacArgs + PIPE + arg; } else { getLog().warn( "Package exclusion is supported for Scala [3.3.4-3.4.0) or 3.4.2+" ); @@ -300,12 +294,10 @@ public void execute() throws MojoExecutionException { if ( scala2 ) { arg = SCALA2_EXCLUDED_FILES_OPTION + excludedFiles; - _scalacOptions = _scalacOptions + SPACE + quoteArgument( arg ); addScalacArgs = addScalacArgs + PIPE + arg; } else if ( filePackageExclusionSupportingScala3 ) { String scala3FormatExcludedFiles = excludedFiles.replace( ";", "," ); arg = SCALA3_EXCLUDED_FILES_OPTION + scala3FormatExcludedFiles; - _scalacOptions = _scalacOptions + SPACE + quoteArgument( arg ); addScalacArgs = addScalacArgs + PIPE + arg; } else { getLog().warn( "File exclusion is supported for Scala [3.3.4-3.4.0) or 3.4.2+" ); @@ -314,13 +306,9 @@ public void execute() throws MojoExecutionException if ( highlighting && scala2 ) { - _scalacOptions = _scalacOptions + SPACE + "-Yrangepos"; addScalacArgs = addScalacArgs + PIPE + "-Yrangepos"; } - String _scalacPlugins = scala2 ? pluginArtifacts.stream() - .map(x -> String.format("%s:%s:%s", x.getGroupId(), x.getArtifactId(), x.getVersion())).collect(Collectors.joining(" ")) : ""; - if ( scala2 ) { arg = PLUGIN_OPTION + pluginArtifacts.stream().map(x -> x.getFile().getAbsolutePath()).collect(Collectors.joining(String.valueOf(java.io.File.pathSeparatorChar))); addScalacArgs = addScalacArgs + PIPE + arg; @@ -328,10 +316,6 @@ public void execute() throws MojoExecutionException Properties projectProperties = project.getProperties(); - // for sbt-compiler-maven-plugin (version 1.0.0-beta5+) - setProperty( projectProperties, "sbt._scalacOptions", _scalacOptions ); - // for sbt-compiler-maven-plugin (version 1.0.0-beta5+) - setProperty( projectProperties, "sbt._scalacPlugins", _scalacPlugins ); // for scala-maven-plugin (version 3.0.0+) setProperty( projectProperties, "addScalacArgs", addScalacArgs ); // for scala-maven-plugin (version 3.1.0+) @@ -371,15 +355,8 @@ public void execute() throws MojoExecutionException private static final String SCALA3_EXCLUDED_FILES_OPTION = "-coverage-exclude-files:"; private static final String PLUGIN_OPTION = "-Xplugin:"; - private static final char DOUBLE_QUOTE = '\"'; - private static final char SPACE = ' '; private static final char PIPE = '|'; - private String quoteArgument( String arg ) - { - return arg.indexOf( SPACE ) >= 0 ? DOUBLE_QUOTE + arg + DOUBLE_QUOTE : arg; - } - private ScalaVersion resolveScalaVersion() { String result = scalaVersion;