0
선택한 빌드에 따라 파일 복사 대상 대상을 변경하고 싶습니다. 작업 그래프가 실행 단계에서 실행되었지만 copyTask가 구성 단계에서 설정 되었기 때문에 이는 작동하지 않습니다.복사 작업 대상 변경
어떻게하면됩니까?
gradle.taskGraph.whenReady { taskGraph ->
println('taskGraph')
if (taskGraph.hasTask(buildRelease)){
File toDir=file('test/r')
println('Copy to: ' + toDir.getName())
}else if (taskGraph.hasTask(buildDevel)) {
File toDir=file('test/d')
println('Copy to: ' + toDir.getName())
}
}
task buildDevel (dependsOn: ['copyTask']){}
task buildRelease (dependsOn: ['copyTask']){}
task copyTask(type: Copy) {
from "test"
into toDir
include 'a.txt'
}