I want to provide a "common" build initialisation script for all of our
project's gradle builds. The common script  sets up our organisation's
defaults (such adding a "coverage" task etc) and the build.gradle scripts
can then call:

  apply from: "http://some-server/build-common.gradle";
 
This works well except for one thing. I'd like to be able to change a
project's name within a build script like this:

  if (System.getenv("something")) {
    project.name = "${project.name}-prod"
  }

This won't work as project.name is read-only. I realise I could do it in
settings.gradle, but I'd prefer not to have to force the users to set one of
these up. What's the best way to handle this sort of thing?

Things I've tried that don't seem to work:

  *   Setting project.name in buildScript{}.     (Still read-only).
  *   Using --init-script "http://some-server/set-project-name.gradle";    
(Doesn't allow URLs).
  *   Using -m "http://some-server/set-project-name.gradle";     (Doesn't
allow URLs).
  *   Setting archivesBaseName instead of project.name.  (successfully
changes the name of the Jar, but the upload to a repository still uses the
old name as the artefact name).

Is there an easy way to do this?

Thanks,
paul
-- 
View this message in context: 
http://gradle.1045684.n5.nabble.com/Changing-project-name-within-a-build-script-tp3321614p3321614.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


Reply via email to