Hi Alexey,
Am Fr, 21.01.2011, 10:32, schrieb Alexey Zlobin:
> Hi all,
>
>
> I've met some problems with customisation of resource processing in my
> project. I need to replace some token in property file on every build (main
> idea is to have new DB created for every integration test executed). I
> used intTest example from User Guide
> (http://gradle.org/0.9.1/docs/userguide/java_plugin.html#sec:source_sets)
> .
>
>
> Now i have two problems:
> 1. Main resources appear in the intTest classpath. So my application
> use production configuration instead of test and i can't use ordinal
> process<source set>Resources task. I avoid this problem by the following
> task:
> processResources.doFirst { if (gradle.taskGraph.hasTask(intTest)) {
> processResources.from(sourceSets.intTest.resources.srcDirs) { timestamp =
> System.currentTimeMillis().toString()
> filter(ReplaceTokens, tokens:[runid: timestamp]) }
> }
> }
> Which processes resources from the main source set. But this is very
> tricky and error-prone because may cause test configuration to be deployed
> in production.
>
> 2. All resource processing tasks work with modification check. On
> repeated execution of build without 'clean' gradle decide that resource is
> 'UP-TO-DATE' and do not produce resources with updated
> timestamp.
>
> So my questions are:
> 1. Is it bug that resources from one source set appear in another? If
> no, how can i exclude them from my task classpath? 2. Is there any way to
> force resource processing with no regard to file modification?
First of all, I think your build should produce one production ready
artifact. You shouldn't need to modify the production artifact to run
integration tests.
I think you could force the processResource task to be executed by adding
processResources {
outputs.upToDateWhen { false }
}
to your build script.
regards,
René
>
> --
> Alexey Zlobin
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email