Skip to content

Commit 11d5027

Browse files
committed
(#121) Make the plugin compatible with java-platform plugin by removing auto-apply on subprojects
1 parent d5e4c9b commit 11d5027

File tree

11 files changed

+83
-68
lines changed

11 files changed

+83
-68
lines changed

src/functionalTest/java/org.scoverage/ScalaJavaMultiModuleTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ public void checkAndAggregateScoverage() throws Exception {
1818
AssertableBuildResult result = run("clean", ScoveragePlugin.getCHECK_NAME(),
1919
ScoveragePlugin.getAGGREGATE_NAME());
2020

21-
result.assertTaskOutcome("java_only:" + ScoveragePlugin.getCOMPILE_NAME(), TaskOutcome.NO_SOURCE);
21+
result.assertTaskSkipped("java_only:" + ScoveragePlugin.getCOMPILE_NAME());
2222

2323
result.assertTaskSkipped(ScoveragePlugin.getREPORT_NAME());
2424
result.assertTaskSucceeded("scala_only:" + ScoveragePlugin.getREPORT_NAME());
2525
result.assertTaskSucceeded("mixed_scala_java:" + ScoveragePlugin.getREPORT_NAME());
2626
result.assertTaskSkipped("java_only:" + ScoveragePlugin.getREPORT_NAME());
27+
2728
result.assertTaskSucceeded(ScoveragePlugin.getCHECK_NAME());
2829
result.assertTaskSucceeded("scala_only:" + ScoveragePlugin.getCHECK_NAME());
2930
result.assertTaskSucceeded("mixed_scala_java:" + ScoveragePlugin.getCHECK_NAME());
3031
result.assertTaskSkipped("java_only:" + ScoveragePlugin.getCHECK_NAME());
32+
3133
result.assertTaskSucceeded(ScoveragePlugin.getAGGREGATE_NAME());
3234

3335
assertAllReportFilesExist();

src/functionalTest/resources/projects/scala-java-multi-module/build.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ plugins {
22
id 'org.scoverage' apply false
33
}
44

5+
description = 'a multi-module Scala and Java project that builds successfully with 100% coverage'
6+
57
allprojects {
68
repositories {
79
jcenter()
810
}
911
}
1012

11-
description = 'a multi-module Scala and Java project that builds successfully with 100% coverage'
12-
13-
apply plugin: 'org.scoverage'
14-
15-
allprojects {
13+
subprojects {
14+
apply plugin: 'java'
1615

1716
dependencies {
1817
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
@@ -21,12 +20,9 @@ allprojects {
2120
test {
2221
useJUnitPlatform()
2322
}
24-
25-
scoverage {
26-
minimumRate = 0.5
27-
}
2823
}
2924

25+
apply plugin: 'org.scoverage'
3026
scoverage {
3127
minimumRate = 0.5
3228
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
apply plugin: 'java'
2-
31
dependencies {
4-
52
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion
63
}

src/functionalTest/resources/projects/scala-java-multi-module/mixed_scala_java/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
apply plugin: 'java'
21
apply plugin: 'scala'
3-
apply plugin: 'org.scoverage'
42

53
dependencies {
64
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
@@ -16,4 +14,9 @@ ext.configureSources = { set, name ->
1614
set.java.srcDirs = []
1715
}
1816
configureSources(sourceSets.main, 'main')
19-
configureSources(sourceSets.test, 'test')
17+
configureSources(sourceSets.test, 'test')
18+
19+
apply plugin: 'org.scoverage'
20+
scoverage {
21+
minimumRate = 0.5
22+
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
apply plugin: 'scala'
2-
apply plugin: 'org.scoverage'
32

43
dependencies {
54
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
@@ -8,3 +7,8 @@ dependencies {
87

98
testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}", version: scalatestVersion
109
}
10+
11+
apply plugin: 'org.scoverage'
12+
scoverage {
13+
minimumRate = 0.5
14+
}

src/functionalTest/resources/projects/scala-multi-module-cross-version/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.scoverage'
2+
id 'org.scoverage' apply false
33
}
44

55
allprojects {
@@ -14,6 +14,7 @@ allprojects {
1414

1515
apply plugin: 'java'
1616
apply plugin: 'scala'
17+
apply plugin: 'org.scoverage'
1718

1819
dependencies {
1920
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion

src/functionalTest/resources/projects/scala-multi-module-multiple-test-tasks/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'org.scoverage'
2+
id 'org.scoverage' apply false
33
}
44

55
allprojects {
@@ -14,6 +14,7 @@ allprojects {
1414

1515
apply plugin: 'java'
1616
apply plugin: 'scala'
17+
apply plugin: 'org.scoverage'
1718

1819
dependencies {
1920
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
plugins {
2-
id 'org.scoverage'
2+
id 'org.scoverage' apply false
33
}
44

5-
allprojects {
5+
description = 'a multi-module Scala project that builds successfully with 100% coverage'
6+
7+
allprojects { p ->
68
repositories {
79
jcenter()
810
}
9-
}
1011

11-
description = 'a multi-module Scala project that builds successfully with 100% coverage'
12+
if (p.name != 'dependencies') {
13+
apply plugin: 'java'
14+
apply plugin: 'scala'
15+
apply plugin: 'org.scoverage'
1216

13-
allprojects {
17+
dependencies {
18+
implementation platform(project(':dependencies'))
1419

15-
apply plugin: 'java'
16-
apply plugin: 'scala'
20+
compile group: 'org.scala-lang', name: 'scala-library'
1721

18-
dependencies {
19-
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
22+
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine'
23+
testCompile group: 'org.junit.platform', name: 'junit-platform-runner'
2024

21-
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion
22-
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
25+
testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}"
26+
}
2327

24-
testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}", version: scalatestVersion
25-
}
26-
27-
test {
28-
useJUnitPlatform()
29-
}
28+
test {
29+
useJUnitPlatform()
30+
}
3031

31-
scoverage {
32-
minimumRate = 0.5
32+
scoverage {
33+
minimumRate = 0.5
34+
}
3335
}
3436
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id 'java-platform'
3+
}
4+
5+
dependencies {
6+
constraints {
7+
api group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
8+
9+
api group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion
10+
api group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
11+
12+
api group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}", version: scalatestVersion
13+
}
14+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include 'a', 'b', 'common'
1+
include 'dependencies', 'a', 'b', 'common'

0 commit comments

Comments
 (0)