I had to use this syntax instead:
compileJava.dependsOn("copySources")
but works, thanks!
I ended up having to use ant.copy instead of the copy task as the
copyTask doesn't support includeFile. Here is what I ended up with:
task copySources << {
ant.copy(todir: "build/tmp/mapiToCompile") {
fileset(dir: "/Users/phil/dev/sag/optimize/trunk/src/java/core") {
includesfile(name:
"/Users/phil/dev/sag/optimize/trunk/build/dependencies/compile/mapi.txt")
excludesfile(name:
"/Users/phil/dev/sag/optimize/trunk/build/dependencies/compile/mapi-exclude.txt")
}
}
}
On Thu, Aug 4, 2011 at 5:23 PM, Adam Murdoch
<[email protected]> wrote:
>
> On 05/08/2011, at 9:08 AM, phil swenson wrote:
>
> I want to hook in a doFirst closure to compileJava to copy my sources
> in from an external directory.
>
> This is problematic as the configuration phase will look to see if the
> sources need to be compiled first, won't find a directory and will
> bypass compile so my copy task doesn't execute.
>
> So is there a way to accomplish this?
>
> Generally, you should use a separate task to do this sort of thing, and
> attach a dependency between the two tasks.
> task prepareSource(type: Copy) {
> from 'wherever-the-source-is'
> into 'some-source-dir'
> }
> compileJava {
> dependsOn prepareSource
> }
> Another option is to simply add the external directory as a source
> directory:
> sourceSets.main.java.srcDir 'whereever-the-source-is'
>
> --
> Adam Murdoch
> Gradle Co-founder
> http://www.gradle.org
> VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
> http://www.gradleware.com
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email