搖籃真的很好集成了螞蟻(https://docs.gradle.org/2.11/userguide/ant.html)
它並不會自動記錄每一步。我沒有意識到這是你問的問題。以下更新將產生輸出,您可以手動記錄。
ant.record(name: "${BuildLogPath}/${BuildLogFile}", append:false, loglevel: "verbose", action: "start")
ant.echo("start logging")
//... do stuff here
ant.echo(message: "end logging")
ant.record(name: "${BuildLogPath}/${BuildLogFile}", append:false, loglevel: "verbose", action: "stop")
這可能會做更多的問題。注:這是我從這個很好的例子稍作改動: http://themrsion.blogspot.com/2013/10/gradle-logging-writing-to-log-to-file.html
import org.gradle.logging.internal.*
String currentDate = new Date().format('yyyy-MMM-dd_HH-mm-ss-S')
String loggingDirectory = "${rootDir}/build/logs"
mkdir("${loggingDirectory}")
File gradleBuildLog = new File("${loggingDirectory}/${currentDate}_gradleBuild.log")
gradle.services.get(LoggingOutputInternal).addStandardOutputListener (new StandardOutputListener() {
void onOutput(CharSequence output) {
gradleBuildLog << output
}
})
gradle.services.get(LoggingOutputInternal).addStandardErrorListener (new StandardOutputListener() {
void onOutput(CharSequence output) {
gradleBuildLog << output
}
})
我不相信搖籃目前支持此功能。不過,我確信它可以完成,所以希望有人會提供一個答案! – Jolta