Skip to content

Commit

Permalink
Merge branch 'master' into verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
maiflai committed Jul 21, 2016
2 parents 06ad7bc + b73e5b1 commit 72ecc23
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ task showVersion() << { println(project.version) }

targetCompatibility = '1.6'

repositories {
mavenCentral()
}

dependencies {
compile gradleApi()
compile localGroovy()
testCompile 'junit:junit:4.12'
}

task groovydocJar(type: Jar, dependsOn: groovydoc) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
10 changes: 7 additions & 3 deletions src/main/groovy/com/github/maiflai/ScalaTestAction.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.gradle.api.tasks.util.PatternSet
import org.gradle.logging.ConsoleRenderer
import org.gradle.internal.UncheckedException
import org.gradle.process.internal.DefaultJavaExecAction
import org.gradle.process.internal.JavaExecAction

Expand Down Expand Up @@ -52,15 +52,19 @@ class ScalaTestAction implements Action<Test> {
}

private static String url(DirectoryReport report) {
new ConsoleRenderer().asClickableFileUrl(report.getEntryPoint())
try {
return new URI("file", "", report.getEntryPoint().toURI().getPath(), null, null).toString();
} catch (URISyntaxException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}


static JavaExecAction makeAction(Test t) {
FileResolver fileResolver = t.getServices().get(FileResolver.class);
JavaExecAction javaExecHandleBuilder = new DefaultJavaExecAction(fileResolver);
t.copyTo(javaExecHandleBuilder)
javaExecHandleBuilder.setMain('org.scalatest.tools.Runner')
javaExecHandleBuilder.setEnvironment(t.getEnvironment())
javaExecHandleBuilder.setClasspath(t.getClasspath())
javaExecHandleBuilder.setJvmArgs(t.getAllJvmArgs())
javaExecHandleBuilder.setArgs(getArgs(t))
Expand Down
10 changes: 9 additions & 1 deletion src/test/groovy/com/github/maiflai/ScalaTestActionTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ class ScalaTestActionTest {
action.getEnvironment()
}

@Test
public void workingDirectoryIsHonoured() throws Exception {
Task test = testTask()
test.workingDir = '/tmp'
JavaExecAction action = ScalaTestAction.makeAction(test)
assertThat(action.workingDir, equalTo(new File('/tmp')))
}

@Test
public void environmentVariableIsCopied() {
Task test = testTask()
Expand Down Expand Up @@ -255,7 +263,7 @@ class ScalaTestActionTest {
@Test
public void configMap() throws Exception {
Task test = testTask()
test.configMap([a:'b', c:1])
test.configMap([a: 'b', c: 1])
def args = commandLine(test)
assertThat(args, both(hasItem('-Da=b')).and(hasItem("-Dc=1")))
}
Expand Down

0 comments on commit 72ecc23

Please sign in to comment.