Replies: 1 comment
-
Hey 👋 So, there are two types of pre-hooks we might want to support. CLI commandsSimple CLI commands. This would be for simple convenience of not having to wrap // Config.swift
let config = Config(
hooks: [.pre("my-custom-command"), .post("bundle exec pod install")]
) These commands would run before and after any generation – including when we trigger the generation internally via Project mappersWe've discussed this in the past with @kwridan – it would have been really powerful to be able to modify the tuist project pre and post generation using the project representation from the ProjectAutomation framework. Tasks can currently only read graph – you can't augment it directly. We might want to create another plugin type that would allow you something like this: // We get the current graph
let graph = try Tuist.graph()
graph.name = "Change the graph name"
// Tuist will take this new version of the graph and generate _it_ instead of the original one.
return graph However, let's first focus on simple CLI commands and see if we'd want to support something like this in the future. There are lots of gotchas and possible undefined behaviour for this type of a hook. |
Beta Was this translation helpful? Give feedback.
-
Over time there have been various issues on the Tuist repo (such as this one) to which the ideal fix has been to implement post-generation hooks that would allow Tuist consumers to opt into manipulating the generated
.xcodeproj
in some way before handing the reigns back off to Tuist. My understanding is that there is also a desire to open it up to pre-generate
hooks, although I don't personally have a strong understanding of the use cases for those.In a world without post-generation hooks consumers of Tuist who need to do anything to the
xcodeproj
to make it usable for their setup lose the ability to use some of Tuist's most powerful features, such astuist test
andtuist cache
.I'd love to motivate a discussion about what problems should and shouldn't be solved by pre- and post-generation hooks, any limitations that would need to be to put in place to that consumers need to be wary of, and ultimately an architectural/design overview for how we might accomplish this feat.
Maybe the first place to start is for anyone who's done some thinking about this to fill in some details about the motivation for pre-generation hooks as well as some known gotchas that the long-time Tusit maintainers might know of.
Beta Was this translation helpful? Give feedback.
All reactions