Skip to content

Commit 0d70dcd

Browse files
committed
Merge commit '161bad9c26347fa43e89fec52f4c17f03339930a' into fix-tests
2 parents cfb3963 + 161bad9 commit 0d70dcd

File tree

9 files changed

+166
-0
lines changed

9 files changed

+166
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ You can find instructions on how to apply the plugin at http://plugins.gradle.or
3535

3636
`gradle checkScoverage` will automatically invoke `reportScoverage` but it won't generate aggregated reports.
3737
In order to check coverage of aggregated reports one should use `gradle checkScoverage aggregateScoverage`.
38+
39+
**Note:** The plugin is not compatible with composite builds. For more information, see [the relevant issue](https://github.com/scoverage/gradle-scoverage/issues/98).
3840

3941
### Configuration
4042

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.scoverage;
2+
3+
import org.junit.Ignore;
4+
import org.junit.Test;
5+
6+
import java.util.ArrayList;
7+
import java.util.Arrays;
8+
import java.util.List;
9+
10+
/**
11+
* Tests are currently ignored as composite builds are not supported yet.
12+
*
13+
* See https://github.com/scoverage/gradle-scoverage/issues/98
14+
*/
15+
public class CompositeBuildTest extends ScoverageFunctionalTest {
16+
17+
public CompositeBuildTest() {
18+
super("composite-build");
19+
}
20+
21+
@Ignore
22+
@Test
23+
public void buildComposite() {
24+
25+
runComposite("clean", "build");
26+
}
27+
28+
@Ignore
29+
@Test
30+
public void reportComposite() {
31+
32+
runComposite("clean", ScoveragePlugin.getREPORT_NAME());
33+
}
34+
35+
private AssertableBuildResult runComposite(String... arguments) {
36+
37+
List<String> fullArguments = new ArrayList<String>();
38+
fullArguments.add("-p");
39+
fullArguments.add("proj1");
40+
fullArguments.add("--include-build");
41+
fullArguments.add("../proj2");
42+
fullArguments.addAll(Arrays.asList(arguments));
43+
44+
return run(fullArguments.toArray(new String[0]));
45+
}
46+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id 'org.scoverage'
3+
}
4+
5+
repositories {
6+
jcenter()
7+
}
8+
9+
description = 'a single-module Scala project taking part in a composite build (1)'
10+
11+
apply plugin: 'java'
12+
apply plugin: 'scala'
13+
14+
15+
group "org.composite"
16+
version '1.0'
17+
18+
dependencies {
19+
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
20+
21+
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion
22+
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
23+
24+
testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}", version: scalatestVersion
25+
26+
compile "org.composite:proj2:1.0"
27+
}
28+
29+
test {
30+
useJUnitPlatform()
31+
}
32+

src/functionalTest/resources/projects/composite-build/proj1/settings.gradle

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.composite.proj1
2+
3+
import org.composite.proj2.Reporter
4+
5+
class Foo {
6+
def bar(): String = "bar"
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.composite.proj1
2+
3+
import org.scalatest.FunSuite
4+
import org.junit.runner.RunWith
5+
import org.scalatest.junit.JUnitRunner
6+
7+
@RunWith(classOf[JUnitRunner])
8+
class FooSuite extends FunSuite {
9+
10+
test("bar"){
11+
12+
new Foo().bar()
13+
}
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
plugins {
2+
id 'org.scoverage'
3+
}
4+
5+
repositories {
6+
jcenter()
7+
}
8+
9+
description = 'a single-module Scala project taking part in a composite build (2)'
10+
11+
apply plugin: 'java'
12+
apply plugin: 'scala'
13+
14+
15+
group "org.composite"
16+
version '1.0'
17+
18+
dependencies {
19+
compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"
20+
21+
testRuntime group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVersion
22+
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: junitPlatformVersion
23+
24+
testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}", version: scalatestVersion
25+
}
26+
27+
test {
28+
useJUnitPlatform()
29+
}
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.composite.proj2
2+
3+
class Reporter {
4+
5+
def report(rawData: String): Report = {
6+
Report(1,2)
7+
}
8+
9+
class InnerReporter {
10+
11+
def lala(): Unit = {
12+
13+
val x = 1 + 1
14+
x
15+
}
16+
}
17+
}
18+
19+
case class Report(id: Long, count: Int)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.composite.proj2
2+
3+
import org.scalatest.FunSuite
4+
import org.junit.runner.RunWith
5+
import org.scalatest.junit.JUnitRunner
6+
7+
@RunWith(classOf[JUnitRunner])
8+
class ReporterSuite extends FunSuite {
9+
10+
test("report"){
11+
12+
val report = new Reporter().report("x")
13+
14+
assertResult(Report(1, 2))(report)
15+
}
16+
}

0 commit comments

Comments
 (0)