On 7/07/10 5:11 AM, Chris Beams wrote:
a directory listing of my current gradle project looks something like this:
build.gradle
buildSrc
docs
gradle.properties
gradlew
gradlew.bat
settings.gradle
subproj1
subproj2
subproj3
subproj4
gradle artifacts really dominate the root directory, and I think it gives a
perception of gradle being more heavyweight than it actually is. I've already
done a few things, like tucking my extra *.gradle files within buildSrc, and
the wrapper properties file within buildSrc/wrapper, but even still, it's not
ideal.
any suggestions about how to tidy this up?
Here's a few options:
1. build.gradle
You can move build.gradle to a subdirectory, and tell Gradle where it is
in the settings.gradle. For example, you could move it to buildSrc (but
don't call it build.gradle or Gradle will think it's the build file for
the buildSrc project) and so something like this in settings.gradle.
rootProject.buildFileName = 'buildSrc/root.gradle'
2. gradle.properties
You could move gradle.properties into a subdirectory and manually load
it from the root project. Eg, something like this in the root project's
build script:
Property properties = new Properties()
file('buildSrc/gradle.properties').withReader { properties.load(it) }
properties.each { key, value -> project."$key" = value }
3. settings.gradle
You could move settings.gradle into a subdirectory, and use the -c
command-line option to point to it when you run Gradle.
I wouldn't recommend doing this. It's just too awkward to use. Plus
everyone who uses this build would need to know that they need to use
the -c option.
4. gradlew, gradlew.bat
The only options I can think of are to not use the wrapper, or to
generate the wrapper scripts into a subdirectory, eg bin/. Neither are
particularly good options.
Also, there are some things we could change in Gradle to help you solve
this.
- Merging settings.gradle into the build file. We plan on doing this at
some point, hopefully pre-1.0.
- Look for the root build script and/or settings.gradle in the current
directory, and if not found, look for, say, buildSrc/root.gradle.
- Same as above for gradle.properties. Alternatively, make it really
easy to load a properties file. For example, we might support something
like: apply from: 'buildSrc/gradle.properties'
- The wrapper task generates the jar and properties file into
buildSrc/wrapper by default, rather than the root directory.
- Possibly make the build script an executable script, so you just run
it from the command line. This means you could get rid of the 'gradlew'
script. Doesn't help windows users, however.
Not directly related, but we should also end up with 1 Gradle-specific
subdirectory where all the top level Gradle source and config files
live. So we could also:
- Rename 'buildSrc' to something like 'gradle'
- Rename the 'master' directory so that its contents live in the
'gradle' directory.
- Rename the 'config' directory so that its contents live under the
'gradle' directory somewhere.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email