Adam Murdoch wrote:
I've also wanted to do something similar, where I want to execute a
bunch of code in the settings file to add dynamic stuff to the Settings
object and Project objects. I didn't want the code in the settings file,
because I wanted to reuse it across a bunch of builds. I ended up
solving it with some copy-and-paste coding.
We have solved this problem (to some degree) for build files - you add
your code to the buildSrc project or to an external project which you
drag in via the classpath specified in the settings file, and then use a
plugin (or whatever) to execute the code. I think the best solution is
to generalise this approach, so that it will work for pretty much any
type of script that Gradle executes (build files, settings files, user
config files, ...).
One change that we've discussed in the past is to move the declaration
of the build file classpath from the settings file to the build file
itself. We could use this approach for pretty much any script, including
the settings file. Part of this change would also be to generalise the
buildSrc concept, to make it possible to declare one or more other
projects to be included in the classpath of the script.
I think this would solve your problem nicely.
Perhaps a simpler approach that would meet my needs would be to make
sure that the buildSrc project is built before settings.gradle is
executed and then have the buildSrc in the classpath for
settings.gradle. Is there a reason that settings.gradle is executed
before buildSrc is built?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email