project layout wise: I want multiple composite bui...
# community-support
b
project layout wise: I want multiple composite builds in a directory that build separate projects, but I'd like a single gradle wrapper and libs.versions.toml do I just move the wrapper up from the composite builds into the parent directory and do I want some kind of settings.gradle.kts in the parent directory?
1
v
do I just move the wrapper up from the composite builds into the parent directory
Yes, where the wrapper files are is pretty irrelevant.
and do I want some kind of settings.gradle.kts in the parent directory?
Depends on whether you want a build there, for example one that includes the other builds in a kind of super-build, so that you can for example build multiple of those projects in one call. Otherwise it's not really necessary, as there is not too much difference between
./gradlew :app1:build
and
./gradlew -p app1 :build
or
cd app1 && ../gradlew :build
.
b
I thought maybe the parent gradle settings file would allow me to share code between builds, like maybe including the libs.versions.toml (if I want to keep it outside of the gradle folder) and other things
or can I achieve that without also having that super build
looks like gradle/libs.versions.toml in the parent directory is not automatically loaded when running ../gradlew assemble
and looks like intellij can't deal with that
so I think either way, I need to use one wrapper per composite build
t
Can you make a simple example project on Github showing what you're trying and what's failing to work? Without that, it's going to be guessing
b
one sec
v
I thought maybe the parent gradle settings file would allow me to share code between builds,
If you want to share code between builds A and B you have build C that you include from both of the other builds. The build in the root project would not be too useful for that, unless that is the one where you have the shared code, but that would probably be a bit awkward structure-wise.
like maybe including the libs.versions.toml (if I want to keep it outside of the gradle folder) and other things
You need to include it by location in any of the settings scripts where you want to use it, so having it in the root directory would not help
I think either way, I need to use one wrapper per composite build
No you don't, you just need to explictly define the version catalog location
b
I mean with regards to the intellij idea issue
it seems to download a random gradle wrapper version into every composite build directory, regardless of if one exists in the parent directory
v
Ah, yeah, right, you should at least have the
gradle/wrapper/gradle-wrapper.properties
file in each of the builds so that IntelliJ uses the right Gradle verrsion. The other three files are irrelevant for IntelliJ
b
kinda unfortunate because I wanted only upgrade the wrapper once and not once per project; thank you for your input as always
v
The wrapper are the four files you check in, so you are able to upgrade the wrapper just once because you only have it once. But you probably meant to upgrade the Gradle version only once. Well, unforuntately the IDE needs the information and cannot guess that the wrapper definition from one directory up should be used. If symlinks are an option for you, you can symlink the properities file into the builds.
If not, you could enhance the wrapper task with an action that distributes the properties file to the other locations if you use the task to update the Gradle version.
b
right, symlinks probably work fine