Control target cache invalidation with additional inputs
A target's output can depend on more than its source files and declared dependencies. Code-generation templates, tool versions, configuration files, and environment variables can all change the resulting binary without previously changing Tuist's target hash. This could cause Tuist to reuse a stale cached artifact.
Targets can now declare these values through additionalHashingInputs:
let hashingInputs: [Target.HashingInput] = [
.glob("Templates/Model.stencil"),
.glob("Codegen"),
.glob("Config/**/*.json"),
.environmentVariable("FEATURE_CONFIGURATION"),
.string("generator-v2"),
.script("codegen --version"),
]
Pass the array to Target.target(additionalHashingInputs:). Exact files, directories, and glob patterns contribute their contents. Environment variables contribute their current value, strings contribute their literal value, and scripts contribute their standard output. When any declared input changes, the target hash changes and Tuist rebuilds the artifact instead of restoring stale cached output.