Skip to content

Commit 33db5aa

Browse files
committed
combined "ignorExitValue" operations
1 parent ec16655 commit 33db5aa

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

build.gradle

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ subprojects {
127127
projectDir.eachFileRecurse {
128128
if (it.name.endsWith('.java')) {
129129

130-
List lines = it.readLines()
131-
132-
Tags tags = new Tags(lines) // Not used yet; just for demo
130+
Tags tags = new Tags(it.readLines())
133131
// if(tags.hasTags()) println tags // Trace output for debugging
134132

135133
// Add tasks for java sources with main methods
@@ -140,24 +138,18 @@ subprojects {
140138
tasks.add(tags.fileRoot)
141139
}
142140

143-
// Some java apps intentionally throw an exception
144-
Boolean maybeIgnoreExitValue = (tags.validateByHand || tags.throwsException)
145-
146141
String basePath = it.absolutePath.replaceAll('\\.java', '')
147-
148142
File outFile = new File(basePath + '.out')
149143
File errFile = new File(basePath + '.err')
150-
151144
OutputStream runStandardOutput = new TeeOutputStream(new FileOutputStream(outFile), System.out)
152-
153145
OutputStream runErrorOutput = new TeeOutputStream(new FileOutputStream(errFile), System.err)
154146

155147
task "$tags.fileRoot"(type: JavaExec, dependsOn: tags.runFirst) {
156148
main = tags.mainClass
157149
classpath = sourceSets.main.runtimeClasspath
158150
args = tags.args
159151
jvmArgs = tags.jVMArgs
160-
ignoreExitValue = maybeIgnoreExitValue
152+
ignoreExitValue = tags.validateByHand || tags.throwsException
161153
standardOutput = runStandardOutput
162154
errorOutput = runErrorOutput
163155
} << {
@@ -167,21 +159,17 @@ subprojects {
167159
if (errFile.size() == 0) errFile.delete()
168160
}
169161
}
170-
171162
// exclude java sources that will not compile
172163
if (tags.compileTimeError) {
173164
sourceSets.main.java.excludes.add(it.name)
174165
}
175166
}
176167
}
177-
178168
task run(dependsOn: tasks)
179169
}
180170

181171
configure(subprojects - project(':onjava')) {
182-
183172
dependencies {
184173
compile project(':onjava')
185174
}
186-
187175
}

0 commit comments

Comments
 (0)