0

I have a gradle task that calls ant.exec() to do svn export into a directory:

/*
 *  Get code from repository into the 'src' directory
 */
task getSource << {
    ant.exec(executable: svn_executable) {
      arg(value: 'export')
      arg(value: repository)
      arg(value: 'src')
   }
}

Then I have a task that deletes certain files in the exported directory:

task deletes(type: Delete) {
    ant.delete() {
        fileset(dir: "src", includes: "**/*template*")
    }
}

And then I have another task that calls getSource and deletes one after another.

The problem is that gradle doesn't wait for the getSource to complete and goes straight ahead to the next task, which is a problem, since at that moment there are no files that need to be deleted.

Is there a way to get around this?

Thank you!

4

2 回答 2

1

然后我有另一个任务调用 getSource 并一个接一个地删除。

你到底是什么意思?Gradle 任务不能调用其他任务;它只能依赖于他们。

于 2013-05-02T00:10:51.937 回答
1

您的“删除”任务在配置阶段而不是 gradle 的执行阶段调用 ant.delete。在http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Delete.html上查看有关如何正确配置“删除”任务的 Gradle DSL 参考

希望有帮助,

干杯,

勒内

于 2013-05-02T05:05:41.907 回答