Skip to content

Commit a56dd05

Browse files
committed
Refactor Scala version check and add some tests for unsupported Scala versions
1 parent d44d55f commit a56dd05

File tree

23 files changed

+434
-39
lines changed

23 files changed

+434
-39
lines changed

src/it/test_ScalaMavenPlugin_Scala212_JUnit/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<properties>
2121
<scala.compat.version>2.12</scala.compat.version>
22-
<scala.minor.version>18</scala.minor.version>
22+
<scala.minor.version>8</scala.minor.version> <!-- Testing that 2.12.8 is supported -->
2323
</properties>
2424

2525
<build>
@@ -39,6 +39,9 @@
3939
<plugin>
4040
<groupId>@project.groupId@</groupId>
4141
<artifactId>@project.artifactId@</artifactId>
42+
<configuration>
43+
<scalacPluginVersion>2.0.0</scalacPluginVersion> <!-- Downgrading for Scala 2.12.8 -->
44+
</configuration>
4245
</plugin>
4346
</plugins>
4447
</build>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp

src/it/test_skip_Scala2_10/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_skip_Scala2_10</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage is Skipped for Scala 2.10</name>
18+
<description>Test Scoverage is Skipped for Scala 2.10</description>
19+
20+
<properties>
21+
<scala.compat.version>2.10</scala.compat.version>
22+
<scala.minor.version>7</scala.minor.version>
23+
</properties>
24+
25+
<build>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
</plugin>
31+
<plugin>
32+
<groupId>net.alchim31.maven</groupId>
33+
<artifactId>scala-maven-plugin</artifactId>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.scalatest</groupId>
37+
<artifactId>scalatest-maven-plugin</artifactId>
38+
</plugin>
39+
<plugin>
40+
<groupId>@project.groupId@</groupId>
41+
<artifactId>@project.artifactId@</artifactId>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package service
2+
3+
import org.scalatest.wordspec.AnyWordSpec
4+
5+
class HelloServiceScalaTest extends AnyWordSpec {
6+
7+
"HelloService" should {
8+
"say hello" in {
9+
assert(HelloServiceScala.hello == "Hello")
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try {
2+
3+
def logFile = new File(basedir, "build.log")
4+
def lines = logFile.readLines()
5+
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.10.7\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")
6+
7+
return true
8+
9+
} catch (Throwable e) {
10+
e.printStackTrace()
11+
return false
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp

src/it/test_skip_Scala2_11/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_skip_Scala2_11</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage is Skipped for Scala 2.11</name>
18+
<description>Test Scoverage is Skipped for Scala 2.11</description>
19+
20+
<properties>
21+
<scala.compat.version>2.11</scala.compat.version>
22+
<scala.minor.version>12</scala.minor.version>
23+
</properties>
24+
25+
<build>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
</plugin>
31+
<plugin>
32+
<groupId>net.alchim31.maven</groupId>
33+
<artifactId>scala-maven-plugin</artifactId>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.scalatest</groupId>
37+
<artifactId>scalatest-maven-plugin</artifactId>
38+
</plugin>
39+
<plugin>
40+
<groupId>@project.groupId@</groupId>
41+
<artifactId>@project.artifactId@</artifactId>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package service
2+
3+
import org.scalatest.wordspec.AnyWordSpec
4+
5+
class HelloServiceScalaTest extends AnyWordSpec {
6+
7+
"HelloService" should {
8+
"say hello" in {
9+
assert(HelloServiceScala.hello == "Hello")
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try {
2+
3+
def logFile = new File(basedir, "build.log")
4+
def lines = logFile.readLines()
5+
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.11.12\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")
6+
7+
return true
8+
9+
} catch (Throwable e) {
10+
e.printStackTrace()
11+
return false
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp

src/it/test_skip_Scala2_12_7/pom.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_skip_Scala2_12_7</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage is Skipped for Scala 2.12.7</name>
18+
<description>Test Scoverage is Skipped for Scala 2.12.7</description>
19+
20+
<properties>
21+
<scala.compat.version>2.12</scala.compat.version>
22+
<scala.minor.version>7</scala.minor.version>
23+
<scoverage.scalacPluginVersion>2.0.0</scoverage.scalacPluginVersion>
24+
</properties>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-compiler-plugin</artifactId>
31+
</plugin>
32+
<plugin>
33+
<groupId>net.alchim31.maven</groupId>
34+
<artifactId>scala-maven-plugin</artifactId>
35+
</plugin>
36+
<plugin>
37+
<groupId>org.scalatest</groupId>
38+
<artifactId>scalatest-maven-plugin</artifactId>
39+
</plugin>
40+
<plugin>
41+
<groupId>@project.groupId@</groupId>
42+
<artifactId>@project.artifactId@</artifactId>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package service
2+
3+
import org.scalatest.wordspec.AnyWordSpec
4+
5+
class HelloServiceScalaTest extends AnyWordSpec {
6+
7+
"HelloService" should {
8+
"say hello" in {
9+
assert(HelloServiceScala.hello == "Hello")
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try {
2+
3+
def logFile = new File(basedir, "build.log")
4+
def lines = logFile.readLines()
5+
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.12.7\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")
6+
7+
return true
8+
9+
} catch (Throwable e) {
10+
e.printStackTrace()
11+
return false
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp

src/it/test_skip_Scala3_1/pom.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_skip_Scala3_1</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage is Skipped for Scala 3.1</name>
18+
<description>Test Scoverage is Skipped for Scala 3.1</description>
19+
20+
<properties>
21+
<scala.compat.version>3</scala.compat.version>
22+
<scala.version>3.1.0</scala.version>
23+
<scala.library.artifact.id>scala3-library_3</scala.library.artifact.id>
24+
</properties>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-compiler-plugin</artifactId>
31+
</plugin>
32+
<plugin>
33+
<groupId>net.alchim31.maven</groupId>
34+
<artifactId>scala-maven-plugin</artifactId>
35+
</plugin>
36+
<plugin>
37+
<groupId>org.scalatest</groupId>
38+
<artifactId>scalatest-maven-plugin</artifactId>
39+
</plugin>
40+
<plugin>
41+
<groupId>@project.groupId@</groupId>
42+
<artifactId>@project.artifactId@</artifactId>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package service
2+
3+
import org.scalatest.wordspec.AnyWordSpec
4+
5+
class HelloServiceScalaTest extends AnyWordSpec {
6+
7+
"HelloService" should {
8+
"say hello" in {
9+
assert(HelloServiceScala.hello == "Hello")
10+
}
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try {
2+
3+
def logFile = new File(basedir, "build.log")
4+
def lines = logFile.readLines()
5+
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"3.1.0\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")
6+
7+
return true
8+
9+
} catch (Throwable e) {
10+
e.printStackTrace()
11+
return false
12+
}

0 commit comments

Comments
 (0)