Slackbot
08/30/2023, 1:35 PMMiles Peele
08/30/2023, 1:40 PMtest.onlyIf { false }
I would expect that directly invoking the test task skips its dependencies but I'm seeing the opposite behavior.
Am I modeling this wrong, or am I understanding this wrong?ephemient
08/30/2023, 1:43 PMephemient
08/30/2023, 1:45 PMVampire
08/30/2023, 1:45 PMonlyIf is an executiontime check.
So the dependency tasks could influence the outcome of this check, so they must be run as @ephemient described.Vampire
08/30/2023, 1:47 PMwill skip dependencies but I don't think there a way to do that inside gradleiirc you can actually do it inside the build, by modifying the start parameters object, but not at execution time, only at configuration time or maybe even just in the settings script or an init script, I don't fully remember.
ephemient
08/30/2023, 1:47 PMVampire
08/30/2023, 1:53 PMVampire
08/30/2023, 1:54 PMgradle.startParameter.excludedTaskNames.add("check")
in a normal build script works just fine.
It just has to be done during configuration phase, before the task graph is finalized.Miles Peele
08/30/2023, 1:55 PMif (project.property("something") == true)
// mess with the startParameter thingVampire
08/30/2023, 1:55 PMVampire
08/30/2023, 1:55 PMVampire
08/30/2023, 1:57 PMVampire
08/30/2023, 1:57 PMsomething changes, it should invalidate CC entryMiles Peele
08/30/2023, 2:02 PMBuildService
3. Use onlyIf on tasks (i.e. test) to control whether or not they execute based on data in the BuildService
But if onlyIf doesn't stop task dependencies from executing, then it seems I must use gradle.startParameter.excludedTaskNames . However, if I have to use that API, then the original logic I had doesn't work, right? Because that excludedTasknames stuff has to be done before the task graph is finalizedVampire
08/30/2023, 2:19 PMVampire
08/30/2023, 2:20 PMMiles Peele
08/30/2023, 2:45 PMRoot build
platform-build-1
platform specific modules...
platform-build-2
platform-build-3
shared-build
sharedModules...
Each platform-build has an `includeBuild("shared-build")`line as part of their settings. Sometimes, code is added to shared that doesn't affect every platform, i.e. it would only affect platform-build-1/platform-build-2 and not platform-build-3. The onlyIf logic I have works pretty well - if a given code change doesn't affect platform-build-3, it won't for example, execute all tests in platform-build-3.
We're doing this for a few reasons, one of which is some caching restrictions we're working through.
I realize this is a bit overkill though!