New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Manifest cache policy #6245
Comments
@Ernest0-Production
Could you share an example so that I can provide with a solution or path forward. |
Hello. I really wanted to be able to write a custom mechanism for automatically generating type-safe access to target resources via SwiftGen. The limited API of Tuist with the
extension Target {
func feature(name: String) -> Target {
Target.target(
name: name,
scripts: {
let resourcesPaths: [String] = FileManager.shared.subpaths(in: <path/feature/resources>)
// some magic for filter resources by resource kind
let resources: [ResourceType: [Path]] = resourcesPaths.reduce(....)
return resources.map { resourceType, inputPaths in
TargetScript.pre(script: "swiftgen run \(resourceType) --input .... --output \(inputPaths.join(separator: " ")) ")
}
}()
)
}
}
I came to this decision because I tried many other right and wrong approaches. The reason for this is that it is important for me to have access to the code that I use to generate the project. |
Gotcha. As you noted, we'd love to expose an API for this because Until that exists, I recommend taking a different approach where the manifests don't have side effects. If we open an API that implicitly accepts imperative code depending on file-system files, we'd be opening the door for for complexity in the manifests, and potentially the breakage of features that assume no side effect in those files. Since your logic requires accessing the declaration of your project, you can implement a small CLI, maybe in an Xcode project, that imports the dynamic #!/usr/bin/bash
generation_tool # It's noop if nothing has changed
tuist generate |
What problem or need do you have?
I want to be able to control the input data for caching the project manifest.
Motivation:
In the manifest files I have logic that requires reading the current directory at the time of generation.
This is required to automate some actions in my project that are not available in tuist at the moment, and it hardly makes sense to include them in tuist itself, because There can be many such scenarios in different projects.
Potential solution
In the simplest case, it makes sense to add the ability to completely disable the manifest cache, without using the command
tuist clean manifests
which clears all manifests of all projects on my computer.Ideally, the ability to specify a list of additional files for which checksum will be calculated.
For example, add a parameter to
Config
:macOS version
15
Tuist version
4.10
Xcode version
15.3
The text was updated successfully, but these errors were encountered: