Skip to content
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

Buildtool plugin questions #1

Open
nicorichard opened this issue Mar 16, 2022 · 1 comment
Open

Buildtool plugin questions #1

nicorichard opened this issue Mar 16, 2022 · 1 comment

Comments

@nicorichard
Copy link

Hey there, first of all, thank you for your contributions to Swift!

I've been trying to wrap my head around

and use them myself for the SwiftGen use-case as proposed.

This is a very exciting missing piece of the puzzle and I am really excited to use it and if possible contribute to the eco-system.

But I have some questions, if you (or anyone reading) is able to help that would be incredible.

Creating Artifact Bundles

It's unclear to me the proper process for packaging a command-line tool such as SwiftGen as a .artifactbundle, I have tried myself but the result does not look like your example.

How did you package the .artifactbundles in this example?

For instance, I notice they contain not just a flattened SwifGen executable but the dependencies as frameworks.
Is there a straightforward command or process I can follow?

Prebuilt Tool Binary Bundle Distribution

In your research did you come across any suggestions for the best way to store and distribute these artifact bundles?

Cleanup between runs

When using this process to generate sources I've noticed that files are only overwritten and never destroyed. e.g. If I change the name of my expected generated SwiftGen file, both the old file and the new file will be present in the generated outputs.

I've tried running FileManager deletions (e.g. recreating the folder) from createBuildCommands but the deletions tend not to run synchronously and my files are randomly pop in and out of existence.

Any advice regarding this scenario?

@nicorichard
Copy link
Author

nicorichard commented Mar 29, 2022

I was able to answer most of my own questions and apply them to my attempt: https://github.com/nicorichard/SwiftGenPlugin

Creating the bundle was easier than I had imagined but it's easy to make mistakes.

  1. The name of the directory is more important than I had imagined.
  2. It's easy to accidentally zip the bundle in such a way that the (required) artifact bundle folder is lost and the files are root level.

This is compounded by the fact that by default macOS will archive the zip into a folder, hiding the issues.

For anyone wanting to check your zip try

unzip -vl your.artifactbundle.zip

Cleanup

Only my last question remains. If I create a build tool which creates file "A" and I later rename this file to "B" or stop generating it altogether, "A" will not be removed from the plug-in work directory and will continue to compile with the target.

To avoid this it would seem prudent to have some sort of process to clean up old files.

Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant