basically what I have is a very messy source tree. I have a source tree that I need to appy a very complicated set of filters to to pick what will be compiled. There is an existing text file that defines all these filters - both include and exclude (stuff like com/myco/webservice/**)
the ant copy patternset "includesfile" pulls in an external text file that has all the include patterns (like com/blah/**). ant also has an "excludesfile". see http://ant.apache.org/manual/Types/patternset.html if there is a way to convert the sourceset to match this functionality so I could avoid the entire copy piece, that would be cool of course.... On Fri, Aug 5, 2011 at 3:34 PM, Szczepan Faber <[email protected]> wrote: >>I ended up having to use ant.copy instead of the copy task as the > copyTask doesn't support includeFile. > Interesting - why cannot you use include / exclude of the copy spec? > Cheers! > > On Fri, Aug 5, 2011 at 4:14 PM, phil swenson <[email protected]> wrote: >> >> 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 >> >> > > > > -- > Szczepan Faber > Principal engineer@gradleware > Lead@mockito > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
