Hi
I’ve created a custom plugin for our build system. In this plugin I defined a task of type: Download (from these guys: de.undercouch.gradle.tasks.download.Download). I have a function in another class which goes out to our Artifactory server and determines the latest artifact in the repo for the project. This however is an expensive call as it issues a REST query and has to roll through the results. This wasn’t a problem when I had manually specified the Download task in all of my sub-projects. But now that I’ve created a Plugin and moved the task into it this function is executed for every sub-project during the configuration phase when it is assigned to the src property of the Download plugin.
There has got to be some better way to prevent this from happening at config time right?
The original task in each sub-project looked like this:
download {
src Utils.getLatestArtifact()
dest $destDir
}
And in the plugin it looks more like this:
private void addAppTasks(Project project) {
project.task('bundleArtifacts', type: Download) {
src Utils.getLatestArtifact()
dest $destDir
}
}
Any ideas on how to fix this?
Thanks, Derek