On 11/01/2011, at 12:36 AM, Tomek Kaczanowski wrote:

> Is it possible to run some tasks from main build.gradle before
> buildSrc is executed?
> 
> The scenario is the following:
> 
> 
> Right now we clean gradle cache before each build with the following
> task (in main build.gradle):
> 
> task removeGradleCache (description: "removes gradle cache") << {
>   println "deleting gradle cache dir:  ${cacheDir}"
>     ant.delete(includeEmptyDirs:"true", verbose: "true", failonerror:
> "false") {
>        fileset(dir: cacheDir)
>     }
> }
> 
> We have a "clean" task that depends on remvoeGradleCache and it works fine.
> 
> The problem is with custom tasks. In such case buildSrc is executed
> first and fetches some JARs to cache. So we need to the cleaning cache
> logic to build.gradle in buildSrc. I would prefer to have this logic
> still in the main build.gradle. Is it possible?
> 
> BTW. And why we clean the cache? Well, we have numerous issues related
> to Gradle NOT fetching the latest artifacts from local maven
> repository and using older versions from its cache. So now we wipe it
> clean before every build.

Oh, please no.  How about we fix the problem, rather than make it easier to 
implement nasty work arounds?

There was a fix in 0.9.1 so that artifacts in local (ie file:// ) repositories 
have a default timeout of 'always'. It was 'daily'. Have you tried this?

Are there any other issues with resolving that stop you from using the cache?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to