Skip to content

carlynorama/PluginExplorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plugin Explorer

See also https://www.whynotestflight.com/excuses/what-if-instead-of-a-cli-plugins-part-1-command-plugins/

Repo for exploring how to make Package Plugins.

Plugins

  • TellMeAboutYourself: Command Plugin. Write a report about the target to a file at the top level of the target. Discussed in WhyNoTestFlight plugin series part 1
  • MyInBuildPlugin: Makes code based on text files. See also BuildPluginExample and BuildPluginExample, Discussed on WhyNotTestFlight Start Up, Code Gen
  • MyPreBuildPlugin: Experiments in making zip files and where they can be put. Discussed on plugin series part 4
  • ScreamIntoTheVoid: Trying to figure out where all the pipes are (STOUT, STDERR for plugin, for tool, etc.). WIP.
  • BuildNRun: Also part 4. A command plugin that manages a build via the packageManager proxy.

Handy Commands For Running Command Plugins

swift package plugin --list
swift package $PLUGIN_VERB
swift package --allow-writing-to-package-directory $PLUGIN_VERB
swift package --disable-sandbox $PLUGIN_VERB

Handy Commands for Generating Projects

swift package init --type tool #Comes with argument parser
swift package init --type build-tool-plugin
swift package init --type command-plugin

Handy Rules of Thumb

  • run on demand, makes edits to source/package folder: command plugin
  • run only if resources are missing or stale: build plugin
  • run every build, before the build: pre-build plugin

Gotchas

  • Code generated by build plugins is generally detectable by IDE's, but the build tool has to have been run at least once before you can use it.
  • Code only associated with a .plugin target doesn't get swept up in targets, and build problems can only be found in the build logs. Code also in its own stand alone tool does get more regular treatment. Prioritize putting as much as possible into a tool and as little a possible only in a plugin.
  • Write the tool and get it completely working, then write the plugin.
  • stdout for a tool does not always work as expected.
  • For two plugins to share code they need to both depend on the same executable or a binary, not a non-productized library target. See discussion
  • Adding new files to the source directory is expensive to build plugins. It will rerun not just the plugin, but regenerate every command and run the tool(s).

References

Official

Misc Interesting Repos

About

Repo for exploring how to make Package Plugins.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages