Hi Guillaume,
I think there are two ways of achieving your needs.
1. you could store a property file in your resource and replace it during
the build. mr. haki explained this briefly at
http://mrhaki.blogspot.com/2010/11/gradle-goodness-add-filtering-to.html
2. you could create a build.properties file DURING your build and store it
in the classes folder. the first draft of the griffon build uses this
approach. Therefore you can have a look at griffons build.gradle file
(https://github.com/griffon/griffon/blob/master/build.gradle) and the task
"createBuildProperties"
I strongly recommend the first approach ;-)
regards,
René
> Hi all,
>
> I have a build.gradle file where I have the version of my project within a
> variable: version = '1.1'.
> And I also have a source file with a method returning the version, say
> something like String getVersion() { '1.1' }.
>
> I'd like to know what's the easiest way to factor that version number, for
> example in some build.properties file, and have gradle taking care of
> replacing some token (like the Ant token replace mechanism) in my source
> file, and I could reference that properties file from my build file as
> well.
>
> Thanks for your help.
>
> --
> Guillaume Laforge
> Groovy Project Manager
> Head of Groovy Development at SpringSource
> http://www.springsource.com/g2one
>
> Twitter: @glaforge
> Google+: http://gplus.to/glaforge
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email