Skip to content

Commit ea989cf

Browse files
committed
zinc scalac does not support escaped parameters
1 parent d054196 commit ea989cf

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ class ScoverageExtension {
116116
if (extension.highlighting) {
117117
parameters.add('-Yrangepos')
118118
}
119-
scalaCompileOptions.additionalParameters = parameters.collect { escape(it) }
119+
if (scalaCompileOptions.useAnt) {
120+
scalaCompileOptions.additionalParameters = parameters.collect { escape(it) }
121+
} else {
122+
scalaCompileOptions.additionalParameters = parameters
123+
}
120124
// exclude the scala libraries that are added to enable scala version detection
121125
classpath += pluginDependencies
122126
// the compile task creates a store of measured statements

src/test/groovy/org/scoverage/PluginAcceptanceTest.groovy

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@ import static org.hamcrest.core.Is.is
88

99
class PluginAcceptanceTest {
1010

11-
@Test
12-
public void testProjectWithCompleteCoverage() throws Exception {
11+
static def checkHappyDay(boolean useAnt) {
12+
def projectRoot = "src/test/happy day"
1313
def build = GradleConnector.
14-
newConnector().
15-
forProjectDirectory(new File("src/test/happyday")).
16-
connect().newBuild()
14+
newConnector().
15+
forProjectDirectory(new File(projectRoot)).
16+
connect().newBuild().
17+
withArguments("-PuseAnt=$useAnt")
1718
build.forTasks('clean', 'checkScoverage').run()
1819

19-
def html = new File('src/test/happyday/build/reports/scoverage/index.html')
20+
def html = new File("$projectRoot/build/reports/scoverage/index.html")
2021
assertThat('an HTML file should be created at ' + html.absolutePath, html.exists(), is(true))
2122
}
23+
24+
@Test
25+
public void testAntProjectWithCompleteCoverage() throws Exception {
26+
checkHappyDay(true)
27+
}
28+
29+
@Test
30+
public void testZincProjectWithCompleteCoverage() throws Exception {
31+
checkHappyDay(false)
32+
}
2233
}

src/test/happyday/build.gradle renamed to src/test/happy day/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ dependencies {
2525

2626
checkScoverage {
2727
minimumLineRate = 1.0
28+
}
29+
30+
tasks.withType(ScalaCompile) {
31+
scalaCompileOptions.useAnt = project.hasProperty('useAnt') ? project.property('useAnt').toBoolean() : true
2832
}

0 commit comments

Comments
 (0)