-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsole.gradle
85 lines (70 loc) · 2.14 KB
/
console.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
apply plugin: 'groovy'
apply plugin: 'eclipse'
sourceCompatibility = 1.5
version = '0.1'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
configurations {
console
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.6'
compile 'com.google.guava:guava:17.0'
//compile 'org.codehaus.gpars:gpars:1.2.1'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
console 'commons-cli:commons-cli:1.2'
console('jline:jline:2.11') {
exclude(group: 'junit', module: 'junit')
}
console 'org.codehaus.groovy:groovy-groovysh:2.3.+'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
test {
systemProperties 'property': 'value'
// show standard out and standard error of the test JVM(s) on the console
testLogging.showStandardStreams = true
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
// listen to standard out and standard error of the test JVM(s)
onOutput { descriptor, event ->
logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message)
}
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
task(console, dependsOn: 'classes') << {
def classpath = sourceSets.main.runtimeClasspath + configurations.console
def command = [
'java',
'-cp', classpath.collect().join(System.getProperty('path.separator')),
'org.codehaus.groovy.tools.shell.Main',
'--color'
]
def proc = new ProcessBuilder(command)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectInput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor()
if (0 != proc.exitValue()) {
throw new RuntimeException("console exited with status: ${proc.exitValue()}")
}
}