Hi Chris,

On May 10, 2008, at 12:49 AM, chrishane wrote:


Is it possible to have an includes/excludes directive on the compile task?

I am building a java project and our current build scripts compile specific directories for specific build targets. Until I can refactor the directory
structure, I need to compile only certain directories.

I have been surprised myself when I discovered that the Gradle Compile task does not offer this.

On the other hand it is a good showcase that Gradle doesn't lock you in. If Gradle where just a big framework you might had to wait for the next release to get this feature. But as Gradle's build by convention behavior is build upon a general purpose build DSL there is a work around.

compile.actions[0] = {
    ant {
        mkdir(dir: classesDir)
        javac(includeAntRuntime: false,
                srcdir: srcDirs.join(':'),
                destdir: classesDir,
                classpath: dependencies.antpath('compile'),
                target: targetCompatibility,
                source: sourceCompatibility,
                includes: 'org/gradle/webapp1/')
    }
}

This replaces the build in compile behavior with something that solves your problem. We simply use the javac ant task and feed it with the project properties. Additionally we use javac's includes property to filter packages or whatever we want to filter. There is also an excludes property available.

We are not saying this is very convenient but not less convenient compared to an ant build.

I have filed an issue for this: http://jira.codehaus.org/browse/ GRADLE-89

This is going to be fixed in the next release.

- Hans


Thanks,
Chris....
--
View this message in context: http://www.nabble.com/Compile-Inculde- Exclude-tp17157729p17157729.html
Sent from the gradle-user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



--
Hans Dockter
Gradle Project lead
http://www.gradle.org




Reply via email to