Hi all, we’ve run into a gap in Tuist’s cache configuration.
Today, cacheOptions already gives us a few useful controls:
-
profiles.defaultlets us pick the default cache behavior, which isonlyExternalby default -
custom profiles can use
allPossible/onlyExternal/none -
custom profiles can also add
targetQueriesandexceptTargetQueries
That works well when you want to choose a profile.
The problem we’re trying to solve is slightly different: we want to preserve Tuist’s existing command defaults, but also declare that a small set of targets should never be eligible for binary caching, which currently is an issue when using tuist test.
In our case:
-
plain
tuist generateshould keep its current default behavior (.onlyExternal) -
focused
tuist generate <targets>should keep its current focused behavior (.allPossible) -
tuist test <scheme>should keep its current behavior (.allPossible) -
but a handful of Firebase / Firestore-related targets should always stay source-based, even for
tuist test, which they don’t currently
So this feels less like “we need another profile”, and more like “we need a global exclusion list that composes with whatever cache behavior the command would normally use.”
A strawman API could be:
cacheOptions: .options(
exceptTargetQueries: [
"FirebaseAnalyticsTarget",
"FirebaseAnalyticsWrapper",
"FirebaseFirestoreTarget",
"FirebaseFirestore",
"FirebaseFirestoreInternalWrapper",
"FirebaseSharedSwift",
"leveldb",
"nanopb",
]
)
Intended behavior:
-
preserve current command defaults
-
never replace these targets with cached binaries
-
also exclude them from tuist cache warm
This seems like a small, backwards-compatible addition to cacheOptions, and more direct than trying to encode this through custom profiles.
Does this seem like a reasonable direction?
Other options considered
Adding a new inherited base profile like .commandDefault
Example:
cacheOptions: .options(
profiles: .profiles(
[
"firebase-workaround": .profile(
.commandDefault,
except: [
"FirebaseFirestore",
"FirebaseFirestoreTarget",
"FirebaseAnalyticsTarget",
]
)
],
default: "firebase-workaround"
)
)
This seems to solve my issue, but isn’t strictly backwards compatible / would potentially change behavior if a user were to run tuist test with an already configured cacheOptions, since as of now tuist test implicitly overrides any cacheOptions to .allPossible.