proper task lifecycle
This commit is contained in:
parent
4f8d2953ab
commit
28b43326f8
28
build.gradle
28
build.gradle
@ -144,13 +144,7 @@ subprojects {
|
|||||||
|
|
||||||
String basePath = it.absolutePath.replaceAll('\\.java', '')
|
String basePath = it.absolutePath.replaceAll('\\.java', '')
|
||||||
File outFile = new File(basePath + '.out')
|
File outFile = new File(basePath + '.out')
|
||||||
if(outFile.exists())
|
|
||||||
outFile.delete()
|
|
||||||
if(tags.outputLine)
|
|
||||||
outFile << tags.outputLine + "\n"
|
|
||||||
File errFile = new File(basePath + '.err')
|
File errFile = new File(basePath + '.err')
|
||||||
OutputStream runStandardOutput = new TeeOutputStream(new FileOutputStream(outFile, true), System.out)
|
|
||||||
OutputStream runErrorOutput = new TeeOutputStream(new FileOutputStream(errFile), System.err)
|
|
||||||
|
|
||||||
task "$tags.fileRoot"(type: JavaExec, dependsOn: tags.runFirst) {
|
task "$tags.fileRoot"(type: JavaExec, dependsOn: tags.runFirst) {
|
||||||
main = tags.mainClass
|
main = tags.mainClass
|
||||||
@ -158,13 +152,21 @@ subprojects {
|
|||||||
args = tags.args
|
args = tags.args
|
||||||
jvmArgs = tags.jVMArgs
|
jvmArgs = tags.jVMArgs
|
||||||
ignoreExitValue = tags.validateByHand || tags.throwsException
|
ignoreExitValue = tags.validateByHand || tags.throwsException
|
||||||
standardOutput = runStandardOutput
|
doFirst {
|
||||||
errorOutput = runErrorOutput
|
if(outFile.exists())
|
||||||
} << {
|
outFile.delete()
|
||||||
println "$outFile size():> " + outFile.size()
|
if(tags.outputLine)
|
||||||
println "$errFile size():> " + errFile.size()
|
outFile << tags.outputLine + "\n"
|
||||||
if (outFile.size() == 0) outFile.delete()
|
|
||||||
if (errFile.size() == 0) errFile.delete()
|
standardOutput = new TeeOutputStream(new FileOutputStream(outFile, true), System.out)
|
||||||
|
errorOutput = new TeeOutputStream(new FileOutputStream(errFile), System.err)
|
||||||
|
}
|
||||||
|
doLast {
|
||||||
|
println "$outFile size():> " + outFile.size()
|
||||||
|
println "$errFile size():> " + errFile.size()
|
||||||
|
if (outFile.size() == 0) outFile.delete()
|
||||||
|
if (errFile.size() == 0) errFile.delete()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// exclude java sources that will not compile
|
// exclude java sources that will not compile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user