Hi Phil,
You have to declare your task inputs and outputs correctly to get this
up-to-date in your custom tasks. I've created a tiny sample for you. The
sample checks the download count of the bin distribution of
gradle-milestone-4
and updates a stats html snippet in a web folder if the download count
has changed:
---------------------------------
class StatsTask extends DefaultTask{
@Input String statsValue
@OutputDirectory File webspace
@TaskAction
void writeStats() {
htmlSnippet = new File(webspace, "downloadstats.html")
htmlSnippet.text = "Downloaded $statsValue times"
}
}
task updateGradleM4Stat(type:StatsTask){
statsValue = getGradleM4DownloadCount()
webspace = file("path/to/mounted/webspace")
}
String getGradleM4DownloadCount(){
def statsUrl =
"http://gradle.artifactoryonline.com/gradle/simple/distributions/gradle-1.0-milestone-4-bin.zip:artifactory.stats"
def xmlDoc = new XmlParser().parseText(new URL(statsUrl).text)
xmlDoc.downloadCount.text()
}
---------------------------------
I think most of it is self explaining. The up-to-date mechanism is
described in the gradle userguide. see
http://gradle.org/current/docs/userguide/more_about_tasks.html#N10D4D
(still m3 link?) for details.
regards,
René
Am 28.07.11 23:22, schrieb phil swenson:
Is there anyway I could override gradle's up-to-date functionality?
I have two scenarios in mind
1) I need to call a web service, pass in the last message ID from
previous run, and check to see if it is the latest. If there is new
info, then the task is not "up to date" and I need to execute the task
2) if someone changes the configuration for a task (by this I mean a
properties file or a convention), then I want to re-run.
Thoughts?
thanks
phil
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
-----------------------
regards René
rene groeschke
http://www.breskeby.com
@breskeby
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email