On 10/02/10 1:26 AM, Peter Ledbrook wrote:
Hi,
Is something like this possible:
apply id: 'groovy'
sourceSets {
main {
groovy {
srcDirs "grails-app/conf",
"grails-app/domain",
"grails-app/controllers",
"grails-app/services",
"grails-app/taglib",
"grails-app/util",
"src/groovy",
"src/java"
srcDir(projectDir)//.include("*GrailsPlugin.groovy")
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile "org.grails:grails-crud:1.1.2",
"org.grails:grails-gorm:1.1.2"
groovy "org.codehaus.groovy:groovy-all:1.6.7"
}
With a recent 0.9 snapshot, the above build file only results in the
*GrailsPlugin.groovy file being compiled. The trouble is, a Grails
plugin project is rather awkward because there is one file in the root
of the project that requires compiling. Can source sets handle this?
Not quite. There's a couple of changes I'd like to make, either of which
would let you do this declaratively:
1. Allow include/exclude patterns to be specified for each source dir,
in addition to the global patterns, similar to how the copy task allows
this:
groovy {
srcDirs 'grails-app/conf', ...
srcDir(projectDir) {
include '*GrailsPlugin.groovy'
}
}
2. Let you add anything that Project.files() handles as source:
groovy {
srcDirs 'grails-api/conf', ...
source 'GrailsPlugin.groovy'
}
There are some work arounds:
The GroovyCompile task provides option 2 already, so you could just add
'GrailsPlugin.groovy' to the 'compileGroovy' task:
sourceSets.main.groovy.srcDirs 'grails-api/conf', ...
compileGroovy.source 'GrailsPlugin.groovy'
Another would be to add the project dir to the main source set and use a
selector closure to ignore everything else under project dir:
groovy {
srcDirs 'grails-api/conf', ...
srcDir projectDir
exclude { FileTreeElement fte -> fte.file.parentFile == projectDir
&& file.name != 'GrailsPlugin.groovy' }
}
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email