Replies: 2 comments 3 replies
-
Agree. If someone tries to override Tuist commands, our commands will take preference. We can make that clear in the documentation that there are some command names that are reserved and that the list of names might grow in the future as we add more features to the project.
I guess you mean here global but managed by Tuist in a tuist-scoped directory?
Same here. I think it aligns with how Swift Package Manager expects packages to be structured: a repository with a Package.swift* at the root.
I'd check if we can maintain this alongside the One thing also I'd like to call out, is that maintaining both,
I lean towards having
The way you described it is the way I envisioned it. I wouldn't name it
I'd check what happens in the first case to make sure it doesn't cause duplicated symbols. Otherwise the helpers will have to dynamically link
I'd instead have a template where we codify the conventions described above.
Agree. Because we have a Swift package we can proxy the calls to the Swift Package Manager CLI |
Beta Was this translation helpful? Give feedback.
-
Thanks for the write up @fortmarek We may be able to remove the Also echo the comments made about using the generic "plugin" name vs. tasks. In terms of the Requiring a CI job which runs this archive in order to release plugins is certainly a bit complex and loses on some of the simplicity the current implementation offers. I'd really love for us to consider just fetching the package, running through the archive internally, and caching that result. |
Beta Was this translation helpful? Give feedback.
-
Tuist Plugins 2.0
There have been some great suggestion in the latest RFC here. I'd like to run another round of reviews (in a similar fashion as Apple runs Swift evolution proposals) as adding new comments to the current RFC would become way too messy.
The response to the last round have been mostly positive for taks specifically, there were also some unclear areas such as
tuist edit
.Tasks
Definition
Reusing the capabilities of
Package.swift
for tasks has a lot of benefits - mainly easy reusing of third party packages. Creating our own solution would incur a big maintenance burden for us and for now, the tradeoff does not seem to be worth it.Invocation
How will we invoke tuist tasks? As mentioned in the last review, we will invoke any command that has
tuist-
prefix. To add to that, we will first try to see if a command name is defined as a command in tuist core and only then try to find alternatives (so that users would not be able to replace our own commands liketuist generate
). I can see some value in being able to override tuist core commands but it could lead to confusion (commands doing different things based on where they would be run from).Secondly, tasks imported as plugins should be possible to run as well but they should not be installed globally. That's because users can have multiple versions of the same plugin. We should therefore install them to a location such as
~/.tuist/Cache/Tasks/plugin-name/version/
. For the first iteration, I'd ignore plugins that don't have tasks pre-built. We should, however, add support for that at some point.Location in a plugin
We still want developers of tasks share them as a plugin - and keeping the rest of the structure as-is. I propose two alternatives for how new tasks should be structured in the plugins repo:
Option 1: Project root
For this option,
Package.swift
would be at the root along withPlugin.swift
. If plugin developers would keep the originalPackage.swift
location for sources, they would be inroot/Sources
. The benefit of this approach is thatPackage.swift
at root can be easily extendable to be used for things other thanTasks
. What I don't really like is amongProjectDescriptionHelpers
,Templates
, etc. we would have not really descriptiveSources
. We could nudge the people to rename it to something else but there would be no strict limits in that. (we can "re-enforce" that nudge withtuist plugins create
)Option 2:
Package.swift
inTasks
Package.swift
andSources
directory would be completely hidden inTasks
repository. This would make the structure of the code in the root a bit easier to read but it is less flexible in the future.Of these options, I am leaning to having a
Package.swift
in the root and nudging people to replace the default location ofSources
toTasks
.Local tasks
One thing not addressed in the original proposal were local tasks - either in the form of a local plugin or a simple local task located in
Tuist/Tasks
. While we could support both, I'm not sure if there is enough value in supportingTuist/Tasks
. What we could maybe rather do is to let users define the tasks via plugins only. This will make the implementation users while users will not lose any functionality.tuist plugins archive
I'd like to detail a little bit of what this command might do and how that fits in the bigger picture of Plugins 2.0.
The primary purpose of this command will be to build all the products in
Package.swift
and create a zip of the executables. The final zip would be calledtasks.zip
and creators of plugins would attach that to a release of a plugin as an artifact. When fetching a plugin, we'd download this zip and extract its contents to~/.tuist/Cache/Tasks/plugin-name/version/
.tuist plugins create
We could either wire this command to
swift package init
. We can add our own template down the line if we want to have tigher control over this.tuist plugins {test, build, run} name-of-task
Apart from
test
andbuild
, I'd also addtuist plugins run
. All of them would just runswift xxx
, though, so there's not much to expand on this.Project Description Helpers
For now, we will keep project description helpers as-is and we will revisit this topic once we progress with new plugins architecture for tasks. This is because having third-party code in helpers does not bring a lot of value and therefore the currently planned changes might not be as beneficial for them as for tasks.
Beta Was this translation helpful? Give feedback.
All reactions