Martin
05/03/2024, 5:13 PM// root/build.gradle
dependencies {
// Do I have to list all my subprojects here ?
// It feels a bit awkward because I have 2 places to edit when I'm adding a module
add("aggregatingConfiguration", project(":module1"))
add("aggregatingConfiguration", project(":module2"))
// ...
}
Philip W
05/03/2024, 6:49 PMfor (subproject in subprojects) {
aggregatingConfiguration(subproject)
}
Martin
05/03/2024, 6:56 PMfor (subproject in subprojects) {
if (subproject.pluginManager.hasPlugin("com.myconvention")) {
aggregatingConfiguration(subproject)
}
}
Martin
05/03/2024, 6:57 PMPhilip W
05/03/2024, 7:02 PMsubprojects
, NOT subprojects {}
, is compatible. But accessing any state, like pluginManager
is not.Philip W
05/03/2024, 7:02 PMPhilip W
05/03/2024, 7:04 PMproject.isolated
, but it does not provide many informationMartin
05/03/2024, 7:04 PMPhilip W
05/03/2024, 7:05 PMMartin
05/03/2024, 7:05 PMMartin
05/03/2024, 7:05 PMproject.configuration["foo"].dependencies
is ok but accessing project.pluginManager
is not?Philip W
05/03/2024, 7:05 PMPhilip W
05/03/2024, 7:07 PMMartin
05/03/2024, 7:07 PMMartin
05/03/2024, 7:08 PMMartin
05/03/2024, 7:09 PMMartin
05/03/2024, 7:10 PMPhilip W
05/03/2024, 7:11 PMMartin
05/03/2024, 7:11 PMVampire
05/03/2024, 9:41 PMIsolatedProject
.Vampire
05/03/2024, 9:44 PMMartin
05/04/2024, 10:06 AMVampire
05/04/2024, 10:13 AMMartin
05/04/2024, 10:21 AMeven if querying the model of another project would be ok and you would check which plugins are applied on it like indicated above, you would also require the other project to be configuredThat why I’d love to have it “the other way around”. The leaf project produces artifacts and has a way to tell it to the aggregating project in a project isolation compatible way.
Martin
05/04/2024, 10:22 AMMartin
05/04/2024, 10:26 AMallprojects {}
to some extentVampire
05/04/2024, 12:10 PMVampire
05/04/2024, 12:11 PMMartin
05/04/2024, 12:30 PMadam
05/05/2024, 5:04 AMBut doesn’t that defeat configure on demand? Because now every project needs to be configured even those that do not contribute the task graphOnly if the aggregating configuration is actually used during the build. Isolated projects also short-circuits the configuration of any project that it already has the dependency resolution metadata for, so it will configure each project the first time the configuration is used, and then only configure those projects that have changed after that.
adam
05/05/2024, 5:07 AMMaybe you can knit something with a shared build service.Using a build service will not work for this use case when Isolated projects is enabled, as Gradle will skip the configuration of projects that have not changed, so the build service will not be able to collect any data from them.
adam
05/05/2024, 5:09 AMThat why I’d love to have it “the other way around”. The leaf project produces artifacts and has a way to tell it to the aggregating project in a project isolation compatible way.This is exactly what you're doing by declaring some outgoing artifacts and then asking Gradle to find them all.
Martin
05/05/2024, 9:27 AMMartin
05/05/2024, 9:33 AMit already has the dependency resolution metadata for, so it will configure each project the first time the configuration is used, and then only configure those projects that have changed after that.This actually sounds like I was thinking about when talking about “project graph”. So the project edges are modeled with configurations, right?
Martin
05/05/2024, 9:37 AMroot-project -> has configuration "aggregatingConsumer". "aggregatingConsumer" depends on `project(module1)` and `project(module2)`
module1 -> has matching outgoingVariant
module2 -> doesn't have matching outgoingVariant
The first time “aggregatingConsumer” is used, module1 and module2 are configured (module2 technically doesn’t need to be configured here).
Any time module2 configuration changes, I need to re-configure root-project?Martin
05/05/2024, 9:38 AMMartin
05/05/2024, 12:36 PMdokkatooHtmlModuleOutputDirectoriesResolver - Resolves Dokkatoo html ModuleOutputDirectories files.
+--- project :apollo-runtime FAILED
+--- project :apollo-testing-support
+--- project :apollo-tooling
\--- project :intellij-plugin
+--- project :apollo-gradle-plugin-external
+--- project :apollo-ast
+--- project :apollo-tooling
+--- project :apollo-normalized-cache-sqlite
+--- org.xerial:sqlite-jdbc:3.43.2.0
| \--- org.slf4j:slf4j-api:2.0.9
\--- com.apollographql.apollo3:apollo-runtime:4.0.0-beta.3 FAILED
For some reason apollo-runtime
could not be resolved up there (while it technically should). I’m guessing some conflict or so but because the error is ignored, debugging is not easy...Martin
05/06/2024, 7:59 AMadam
05/14/2024, 6:07 AMAny time module2 configuration changes, I need to re-configure root-project?Yes and no. "No", because the isolated projects implementation will configure a project
a
that has a project dependency on another project b
only if the outgoing dependency management data for b
changes. So if b
changes, but its dependency information does not change, then a
will not be configured. The implementation can be made finer-grained in the future, but this is already not too bad.
"Yes", however, because currently the root project is treated specially and is always configured if one of its subprojects changes. This is to help catch couplings, because typically they live in the root project. We want to improve this so that the root project is not treated specially, but haven't yet.adam
05/14/2024, 6:08 AMJust bumped into an example where leniency could be problematicYes, that's true. It would be good to tweak the API to separate out "please don't fail if there's no matching variant" from "please don't fail if anything goes wrong".
Martin
07/01/2024, 3:14 PMgradle.lifecycle.allProjects { /* add dependency here */ }
) but it’s not great to express more granular dependencies (or more precisely leniency could work with more granular dependencies but doesn’t solve the issue of defining those cross project dependencies in the first place)