Skip to content

Commit 96e41cc

Browse files
committed
bump to gradle 3.0
1 parent 8312d8a commit 96e41cc

File tree

9 files changed

+19
-104
lines changed

9 files changed

+19
-104
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
compile gradleApi()
4646
compile localGroovy()
4747
scoverage "org.scoverage:scalac-scoverage-plugin_2.11:1.1.1"
48-
testCompile 'org.hamcrest:hamcrest-library:1.3'
48+
testCompile 'junit:junit:4.12', 'org.hamcrest:hamcrest-library:1.3'
4949
}
5050

5151
task groovydocJar(type: Jar, dependsOn: groovydoc) {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=http\://services.gradle.org/distributions/gradle-2.9-bin.zip
6+
distributionUrl=http\://services.gradle.org/distributions/gradle-3.0-all.zip

src/main/groovy/org/scoverage/ScoverageExtension.groovy

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ import java.util.concurrent.Callable
2121
*/
2222
class ScoverageExtension {
2323

24-
private static boolean isEscaped(String argument) {
25-
return (argument.startsWith('"') && argument.endsWith('"')) || (argument.startsWith('\'') && argument.endsWith('\''))
26-
}
27-
28-
static String escape(String argument) {
29-
if (isEscaped(argument)) {
30-
return argument
31-
} else {
32-
return "\"$argument\""
33-
}
34-
}
35-
3624
/** a directory to write working files to */
3725
File dataDir
3826
/** a directory to write final output to */
@@ -158,14 +146,10 @@ class ScoverageExtension {
158146
if (extension.highlighting) {
159147
parameters.add('-Yrangepos')
160148
}
161-
if (scalaCompileOptions.useAnt) {
162-
scalaCompileOptions.additionalParameters = parameters.collect { escape(it) }
163-
} else {
164-
doFirst {
165-
GFileUtils.deleteDirectory(destinationDir)
166-
}
167-
scalaCompileOptions.additionalParameters = parameters
149+
doFirst {
150+
GFileUtils.deleteDirectory(destinationDir)
168151
}
152+
scalaCompileOptions.additionalParameters = parameters
169153
// the compile task creates a store of measured statements
170154
outputs.file(new File(extension.dataDir, 'scoverage.coverage.xml'))
171155
}

src/test/groovy/org/scoverage/AcceptanceTestUtils.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ class AcceptanceTestUtils {
2020
parser.setFeature('http://apache.org/xml/features/nonvalidating/load-external-dtd', false)
2121
}
2222

23-
protected BuildLauncher setupBuild(File projectRoot, boolean useAnt) {
23+
protected BuildLauncher setupBuild(File projectRoot) {
2424
return GradleConnector.
2525
newConnector().
2626
forProjectDirectory(projectRoot).
2727
connect().
2828
newBuild().
2929
withArguments(
30-
"-PuseAnt=$useAnt",
3130
'--init-script',
3231
new File(System.properties.getProperty('user.dir'), 'init-scoverage.gradle').toString())
3332
}

src/test/groovy/org/scoverage/AggregationAcceptanceTest.groovy

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,24 @@ import org.junit.Test
44

55
class AggregationAcceptanceTest extends AcceptanceTestUtils {
66

7-
private static File aggregateReportDir(File baseDir) {
8-
return new File(baseDir, 'build/scoverage-aggregate')
9-
}
10-
11-
private testWater(boolean useAnt) throws Exception {
7+
@Test
8+
public void testMultiProjectAggregationWithZinc() throws Exception {
129
File projectDir = new File('src/test/water')
13-
14-
def build = setupBuild(projectDir, useAnt)
10+
def build = setupBuild(projectDir)
1511
build.forTasks('clean', 'reportScoverage', 'aggregateScoverage').run()
16-
1712
def indexHtml = new File(aggregateReportDir(projectDir), 'index.html')
1813
checkFile('an aggregated index HTML file', indexHtml, true)
19-
2014
def cobertura = new File(aggregateReportDir(projectDir), 'cobertura.xml')
2115
checkFile('an aggregated cobertura XML file', cobertura, true)
22-
2316
def scoverageXml = new File(aggregateReportDir(projectDir), 'scoverage.xml')
2417
checkFile('an aggregated scoverage XML file', scoverageXml, true)
25-
2618
def krillsHtml = new File(aggregateReportDir(projectDir), 'krills.html')
2719
checkFile('a HTML file for \'krills\' sub-project', krillsHtml, true)
28-
2920
def whalesHtml = new File(aggregateReportDir(projectDir), 'whales.html')
3021
checkFile('a HTML file for \'whales\' sub-project', whalesHtml, true)
3122
}
3223

33-
@Test
34-
public void testMultiProjectAggregationWithAnt() throws Exception {
35-
testWater(true)
36-
}
37-
38-
@Test
39-
public void testMultiProjectAggregationWithZinc() throws Exception {
40-
testWater(false)
24+
private static File aggregateReportDir(File baseDir) {
25+
return new File(baseDir, 'build/scoverage-aggregate')
4126
}
4227
}

src/test/groovy/org/scoverage/ScoverageExtensionTest.groovy

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/groovy/org/scoverage/SeparateTestsAcceptanceTest.groovy

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,22 @@ import static org.junit.Assert.assertThat
77

88
class SeparateTestsAcceptanceTest extends AcceptanceTestUtils {
99

10-
private void testSeparate(boolean useAnt) throws Exception {
10+
@Test
11+
public void testSeparateTestsWithZinc() throws Exception {
1112
File projectDir = new File('src/test/separate-tests')
1213
File subprojectDir = new File(projectDir, 'a')
1314
File testsSubprojectDir = new File(projectDir, 'a-tests')
14-
15-
def build = setupBuild(projectDir, useAnt)
15+
def build = setupBuild(projectDir)
1616
build.forTasks('clean', 'reportScoverage').run()
17-
18-
// ensure report is generated in base project ...
1917
def indexHtml = new File(reportDir(subprojectDir), 'index.html')
2018
checkFile('an index HTML file', indexHtml, true)
21-
22-
// ... but not in test project ...
2319
def testsIndexHtml = new File(reportDir(testsSubprojectDir), 'index.html')
2420
checkFile('an index HTML file', testsIndexHtml, false)
25-
26-
// ... and 'Hello.scala' is present there ...
2721
def helloHtml = new File(reportDir(subprojectDir), 'src/main/scala/hello/Hello.scala.html')
2822
checkFile('Hello.scala html file', helloHtml, true)
29-
30-
// ... and both statement and branch coverage is 100%
3123
def branchCoverage = coverage(reportDir(subprojectDir), CoverageType.Branch)
3224
def statementCoverage = coverage(reportDir(subprojectDir), CoverageType.Statement)
3325
assertThat('Branch coverage should be 100%, was ' + branchCoverage, branchCoverage, closeTo(100.0, 1.0))
3426
assertThat('Statement coverage should be 100%, was ' + statementCoverage, statementCoverage, closeTo(100.0, 1.0))
3527
}
36-
37-
@Test
38-
public void testSeparateTestsWithAnt() throws Exception {
39-
testSeparate(true)
40-
}
41-
42-
@Test
43-
public void testSeparateTestsWithZinc() throws Exception {
44-
testSeparate(false)
45-
}
4628
}

src/test/groovy/org/scoverage/SimpleReportAcceptanceTest.groovy

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import org.junit.Test
44

55
class SimpleReportAcceptanceTest extends AcceptanceTestUtils {
66

7-
private testHappyDay(boolean useAnt) throws Exception {
8-
File projectRoot = new File('src/test/happy day')
9-
def build = setupBuild(projectRoot, useAnt)
107

8+
@Test
9+
public void testZincProjectWithCompleteCoverage() throws Exception {
10+
File projectRoot = new File('src/test/happy day')
11+
def build = setupBuild(projectRoot)
1112
build.forTasks('clean', 'checkScoverage').run()
12-
1313
def html = new File(reportDir(projectRoot), 'index.html')
1414
checkFile('an index HTML file', html, true)
1515
def cobertura = new File(reportDir(projectRoot), 'cobertura.xml')
@@ -18,20 +18,10 @@ class SimpleReportAcceptanceTest extends AcceptanceTestUtils {
1818
checkFile('a scoverage XML file', scoverageXml, true)
1919
}
2020

21-
@Test
22-
public void testAntProjectWithCompleteCoverage() throws Exception {
23-
testHappyDay(true)
24-
}
25-
26-
@Test
27-
public void testZincProjectWithCompleteCoverage() throws Exception {
28-
testHappyDay(false)
29-
}
30-
3121
@Test
3222
public void testRun() throws Exception {
3323
File projectRoot = new File('src/test/runtime')
34-
def build = setupBuild(projectRoot, true)
24+
def build = setupBuild(projectRoot)
3525
build.forTasks('clean', 'run').run()
3626
}
3727
}

src/test/happy day/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,4 @@ dependencies {
2525
checkScoverage {
2626
minimumRate = 1.0
2727
coverageType = 'Line'
28-
}
29-
30-
tasks.withType(ScalaCompile) {
31-
scalaCompileOptions.useAnt = project.hasProperty('useAnt') ? project.property('useAnt').toBoolean() : true
3228
}

0 commit comments

Comments
 (0)