Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scoverage/scoverage-maven-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: scoverage-maven-plugin-1.4.11
Choose a base ref
...
head repository: scoverage/scoverage-maven-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: scoverage-maven-plugin-2.0.0
Choose a head ref
Loading
Showing with 1,863 additions and 901 deletions.
  1. +10 −0 .github/dependabot.yml
  2. +3 −3 .github/workflows/ci.yml
  3. +18 −0 .mvn/wrapper/maven-wrapper.properties
  4. +9 −7 README.md
  5. +239 −0 mvnw
  6. +806 −781 pom.xml
  7. +145 −0 src/it/integration_tests_parent/pom.xml
  8. +1 −0 src/it/test_ScalaMavenPlugin_Scala212_JUnit/invoker.properties
  9. +45 −0 src/it/test_ScalaMavenPlugin_Scala212_JUnit/pom.xml
  10. +6 −0 src/it/test_ScalaMavenPlugin_Scala212_JUnit/src/main/scala/HelloServiceScala.scala
  11. +11 −0 src/it/test_ScalaMavenPlugin_Scala212_JUnit/src/test/scala/HelloServiceScalaTest.scala
  12. +19 −0 src/it/test_ScalaMavenPlugin_Scala212_JUnit/validate.groovy
  13. +1 −0 src/it/test_ScalaMavenPlugin_Scala212_ScalaTest/invoker.properties
  14. +45 −0 src/it/test_ScalaMavenPlugin_Scala212_ScalaTest/pom.xml
  15. +6 −0 src/it/test_ScalaMavenPlugin_Scala212_ScalaTest/src/main/scala/HelloServiceScala.scala
  16. +12 −0 src/it/test_ScalaMavenPlugin_Scala212_ScalaTest/src/test/scala/HelloServiceScalaTest.scala
  17. +19 −0 src/it/test_ScalaMavenPlugin_Scala212_ScalaTest/validate.groovy
  18. +1 −0 src/it/test_ScalaMavenPlugin_Scala213_JUnit/invoker.properties
  19. +45 −0 src/it/test_ScalaMavenPlugin_Scala213_JUnit/pom.xml
  20. +6 −0 src/it/test_ScalaMavenPlugin_Scala213_JUnit/src/main/scala/HelloServiceScala.scala
  21. +11 −0 src/it/test_ScalaMavenPlugin_Scala213_JUnit/src/test/scala/HelloServiceScalaTest.scala
  22. +19 −0 src/it/test_ScalaMavenPlugin_Scala213_JUnit/validate.groovy
  23. +1 −0 src/it/test_ScalaMavenPlugin_Scala213_ScalaTest/invoker.properties
  24. +45 −0 src/it/test_ScalaMavenPlugin_Scala213_ScalaTest/pom.xml
  25. +6 −0 src/it/test_ScalaMavenPlugin_Scala213_ScalaTest/src/main/scala/HelloServiceScala.scala
  26. +12 −0 src/it/test_ScalaMavenPlugin_Scala213_ScalaTest/src/test/scala/HelloServiceScalaTest.scala
  27. +19 −0 src/it/test_ScalaMavenPlugin_Scala213_ScalaTest/validate.groovy
  28. +1 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest/invoker.properties
  29. +46 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest/pom.xml
  30. +6 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest/src/main/scala/HelloServiceScala.scala
  31. +12 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest/src/test/scala/HelloServiceScalaTest.scala
  32. +19 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest/validate.groovy
  33. +1 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest_ScalaVersion_Not_Set/invoker.properties
  34. +54 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest_ScalaVersion_Not_Set/pom.xml
  35. +6 −0 ...calaMavenPlugin_Scala32Plus_ScalaTest_ScalaVersion_Not_Set/src/main/scala/HelloServiceScala.scala
  36. +12 −0 ...MavenPlugin_Scala32Plus_ScalaTest_ScalaVersion_Not_Set/src/test/scala/HelloServiceScalaTest.scala
  37. +19 −0 src/it/test_ScalaMavenPlugin_Scala32Plus_ScalaTest_ScalaVersion_Not_Set/validate.groovy
  38. +16 −7 src/main/java/org/scoverage/plugin/SCoverageCheckMojo.java
  39. +61 −82 src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java
  40. +50 −21 src/main/java/org/scoverage/plugin/SCoverageReportMojo.java
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -12,13 +12,13 @@ jobs:
build:
strategy:
matrix:
java: [ '8', '17' ]
java: [ '11', '17' ]
os: [ 'ubuntu-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ Maven generated plugin documentation:
|------------------|--------------------------------------------------------------------------------------------------|
| `1.4.11` | [Plugin Info](http://scoverage.github.io/scoverage-maven-plugin/1.4.11/plugin-info.html) |

##### Prerequisities / limitations
##### Prerequisites / limitations

Plugin is compatible with two Maven Scala compiler plugins:

@@ -61,20 +61,20 @@ This can be set as project property.
```xml
<project>
<properties>
<scoverage.plugin.version>1.4.11</scoverage.plugin.version>
<scoverage.plugin.version>2.0.0</scoverage.plugin.version>
</properties>
</project>
```


##### Scala version configuration

Plugin supports Scala 2.10.x, 2.11.x, 2.12.x and 2.13.x versions by automatically loading and configuring scalac-scoverage-plugin_2.10, scalac-scoverage-plugin_2.11, scalac-scoverage-plugin_2.12 or scalac-scoverage-plugin_2.13 Scalac SCoverage Plugin artifact. For this to work Scala version has to be set. It can be done by defining `scalaVersion` plugin configuration parameter or `scala.version` project property. Without this setting, coverage will not be calculated.
Plugin supports Scala 2.12.8+, 2.13.0+ and 3.2.0+ versions by automatically loading and configuring matching `scalac-scoverage-plugin` Scalac SCoverage Plugin artifact. For this to work Scala version has to be set. It can be done by defining `scalaVersion` plugin configuration parameter or `scala.version` project property. Without this setting, coverage will not be calculated.

```xml
<project>
<properties>
<scala.version>2.13.8</scala.version>
<scala.version>2.13.12</scala.version>
</properties>
</project>
```
@@ -90,7 +90,7 @@ or
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalaVersion>2.13.8</scalaVersion>
<scalaVersion>2.13.12</scalaVersion>
<!-- other parameters -->
</configuration>
</plugin>
@@ -113,6 +113,8 @@ The first method is better because once the property is defined it's value can b
</project>
```

For Scala 2.10 and 2.11 support please use Scoverage Maven plugin `1.4.11`.

##### Scalac SCoverage plugin version configuration

Maven SCoverage plugin uses by default the latest version of the [scalac-scoverage-plugin](https://github.com/scoverage/scalac-scoverage-plugin) available on its release day.
@@ -122,7 +124,7 @@ It can be configured by defining `scalacPluginVersion` plugin configuration para
```xml
<project>
<properties>
<scoverage.scalacPluginVersion>1.4.11</scoverage.scalacPluginVersion>
<scoverage.scalacPluginVersion>2.0.11</scoverage.scalacPluginVersion>
</properties>
</project>
```
@@ -138,7 +140,7 @@ or
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalacPluginVersion>1.4.11</scalacPluginVersion>
<scalacPluginVersion>2.0.11</scalacPluginVersion>
<!-- other parameters -->
</configuration>
</plugin>
239 changes: 239 additions & 0 deletions mvnw
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.2.0
#
# Optional ENV vars
# -----------------
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
# MVNW_REPOURL - repo url base for downloading maven distribution
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
# ----------------------------------------------------------------------------

set -euf
[ "${MVNW_VERBOSE-}" != debug ] || set -x

# OS specific support.
native_path() { printf %s\\n "$1"; }
case "$(uname)" in
(CYGWIN*|MINGW*) [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
native_path() { cygpath --path --windows "$1"; } ;;
esac

# set JAVACMD and JAVACCMD
set_java_home() {
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
if [ -n "${JAVA_HOME-}" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACCMD="$JAVA_HOME/jre/sh/javac"
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACCMD="$JAVA_HOME/bin/javac"

if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ] ; then
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
return 1
fi
fi
else
JAVACMD="$('set' +e; 'unset' -f command 2>/dev/null; 'command' -v java)" || :
JAVACCMD="$('set' +e; 'unset' -f command 2>/dev/null; 'command' -v javac)" || :

if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ] ; then
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
return 1
fi
fi
}

# hash string like Java String::hashCode
hash_string() {
str="${1:-}" h=0
while [ -n "$str" ]; do
h=$(( ( h * 31 + $(LC_CTYPE=C printf %d "'$str") ) % 4294967296 ))
str="${str#?}"
done
printf %x\\n $h
}

verbose() { :; }
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }

die() {
printf %s\\n "$1" >&2
exit 1
}

# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
while IFS="=" read -r key value; do
case "${key-}" in
distributionUrl) distributionUrl="${value-}" ;;
distributionSha256Sum) distributionSha256Sum="${value-}" ;;
esac
done < "${0%/*}/.mvn/wrapper/maven-wrapper.properties"
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"


case "${distributionUrl##*/}" in
(maven-mvnd-*bin.*)
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
(*AMD64:CYGWIN*|*AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
(:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
(:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
(:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
(*) echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
distributionPlatform=linux-amd64
;;
esac
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
;;
(maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
(*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
esac

# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
distributionUrlName="${distributionUrl##*/}"
distributionUrlNameMain="${distributionUrlName%.*}"
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"

exec_maven() {
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
}

if [ -d "$MAVEN_HOME" ]; then
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
exec_maven "$@"
fi

case "${distributionUrl-}" in
(*?-bin.zip|*?maven-mvnd-?*-?*.zip) ;;
(*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
esac

# prepare tmp dir
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
trap clean HUP INT TERM EXIT
else
die "cannot create temp dir"
fi

mkdir -p -- "${MAVEN_HOME%/*}"

# Download and Install Apache Maven
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
verbose "Downloading from: $distributionUrl"
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"

# select .zip or .tar.gz
if ! command -v unzip >/dev/null; then
distributionUrl="${distributionUrl%.zip}.tar.gz"
distributionUrlName="${distributionUrl##*/}"
fi

# verbose opt
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v

# normalize http auth
case "${MVNW_PASSWORD:+has-password}" in
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
esac

if [ -z "${MVNW_USERNAME-}" ] && command -v wget > /dev/null; then
verbose "Found wget ... using wget"
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName"
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl > /dev/null; then
verbose "Found curl ... using curl"
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl"
elif set_java_home; then
verbose "Falling back to use Java to download"
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
cat > "$javaSource" <<-END
public class Downloader extends java.net.Authenticator
{
protected java.net.PasswordAuthentication getPasswordAuthentication()
{
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
}
public static void main( String[] args ) throws Exception
{
setDefault( new Downloader() );
java.nio.file.Files.copy( new java.net.URL( args[0] ).openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
}
}
END
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
verbose " - Compiling Downloader.java ..."
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")"
verbose " - Running Downloader.java ..."
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
fi

# If specified, validate the SHA-256 sum of the Maven distribution zip file
if [ -n "${distributionSha256Sum-}" ]; then
distributionSha256Result=false
if [ "$MVN_CMD" = mvnd.sh ]; then
echo "Checksum validation is not supported for maven-mvnd." >&2
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
elif command -v sha256sum > /dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c > /dev/null 2>&1; then
distributionSha256Result=true
fi
elif command -v shasum > /dev/null; then
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c > /dev/null 2>&1; then
distributionSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
exit 1
fi
if [ $distributionSha256Result = false ]; then
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
exit 1
fi
fi

# unzip and move
if command -v unzip > /dev/null; then
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR"
else
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR"
fi
printf %s\\n "$distributionUrl" > "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"

clean || :
exec_maven "$@"
Loading