On Fri, Feb 19, 2010 at 9:37 AM, Peter Ledbrook <[email protected]>wrote:
> Hi,
>
> I create a copy task in this manner:
>
> /**
> * Creates a task that copies all the project's message bundles to
> * build/resources. If 'native2ascii' is enabled, then that tool is
> * used to convert the files from UTF-8 to ASCII en route.
> */
> private createPackageI18nTask(project, dependsOn) {
> def resourcesDir = new File(project.buildDir, "resources")
> project.task("packageI18n", type: Copy, dependsOn: dependsOn) {
> def buildConfig = project.buildData.settings.config
> if (buildConfig.grails.enable.native2ascii) {
> copyAction = new
> FileCopyActionImpl(project.fileResolver, new
> Native2AsciiCopySpecVisitor())
> }
>
> from(".") {
> include "grails-app/i18n/**/*.properties"
> }
> into resourcesDir
>
>
doFirst {
> // Process any plugin resources bundles as well.
> for (plugin in project.buildPlugins.pluginManager.allPlugins) {
> if (plugin.pluginDirectory) {
> from(plugin.pluginDirectory) {
> include "grails-app/i18n/**/*.properties"
> into new File(resourcesDir,
> "plugins/${plugin.name}-${plugin.version}")
> }
> }
> }
>
}
> }
> }
>
> The problem I have is in the iteration over the plugins: the plugins
> are not loaded by the plugin manager until execution time. Is there a
> way to add extra 'from's to a Copy task during the execution phase? Or
> do I need to use a different approach?
>
>
You can configure a task at execution time, in this case as long as the
default action of the copy task is not executed yet. Just put it in a
doFirst closure (see above)
- Hans
> Thanks,
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>