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

Create a swift bundler command line plugin. #36

Merged
merged 4 commits into from
Dec 10, 2023

Conversation

furby-tm
Copy link
Contributor

@furby-tm furby-tm commented Dec 8, 2023

This revision introduces a swift package plugin product for swift bundler, in the form of a command line plugin.

Usage:

$ swift package --disable-sandbox plugin bundler run -p macOS MetaversalDemo
Plugin ‘SwiftBundlerCommandPlugin’ wants permission to allow all network connections on all ports.
Stated reason: “Creating an app bundle may require network access.”.
Allow this plugin to allow all network connections on all ports? (yes/no) yes
Plugin ‘SwiftBundlerCommandPlugin’ wants permission to write to the package directory.
Stated reason: “Creating an app bundle requires writing to the package directory.”.
Allow this plugin to write to the package directory? (yes/no) yes
Building for debugging...
Build complete! (1.50s)
[0/1] Planning build
Building for debugging...
Build complete! (6.84s)
2023-12-07 21:26:05.151 MetaversalDemo[84817:99872459] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
Python v3.11
Python Version: 3.11.6 (main, Nov 16 2023, 00:01:35) [Clang 15.0.0 (clang-1500.1.0.1.1)]
Python Encoding: UTF-8
Python Path: ['/Users/furby/Wabi/MetaverseKit/.build/arm64-apple-macosx/debug/MetaversePythonFramework_PyBundle.bundle/Resources/python/3.11/macOS/python-stdlib', '/Users/furby/Wabi/MetaverseKit/.build/arm64-apple-macosx/debug/MetaversePythonFramework_PyBundle.bundle/Resources/python/3.11/macOS/python-stdlib/lib-dynload', '/Users/furby/Wabi/MetaverseKit/.build/arm64-apple-macosx/debug/MetaversePythonFramework_PyBundle.bundle/Resources/python/3.11/macOS/python-stdlib/lib/python311.zip', '/Users/furby/Wabi/MetaverseKit/.build/arm64-apple-macosx/debug/MetaversePythonFramework_PyBundle.bundle/Resources/python/3.11/macOS/python-stdlib/lib/python3.11', '/Users/furby/Wabi/MetaverseKit/.build/arm64-apple-macosx/debug/MetaversePythonFramework_PyBundle.bundle/Resources/python/3.11/macOS/python-stdlib/lib/python3.11/lib-dynload']
MetaversalDemo has launched.
view did load
info: Loading package manifest
info: Starting debug build
info: Bundling 'MetaversalDemo.app'
info: Creating 'MetaversalDemo.app'
info: Copying executable
info: Creating 'PkgInfo'
info: Creating 'Info.plist'
info: Compiling and copying resource bundle 'MetaversePythonFramework_PyBundle.bundle'
info: Copying dynamic libraries
info: Done in 9.58s. App bundle located at './.build/bundler/MetaversalDemo.app'
info: Running 'MetaversalDemo.app'
SwiftBundlerCommandPlugin succesfully completed.

furby-tm added a commit to wabiverse/MetaverseKit that referenced this pull request Dec 8, 2023
* This includes the swift bundler as a command line
  plugin and should transitively become available to
  all consumers of MetaverseKit, through SwiftUSD.
* Await PR to upstream stackotter:
  stackotter/swift-bundler#36
@stackotter
Copy link
Owner

Awesome, thanks! I was a bit too busy to check it out today, but I’ll have some time tomorrow night

@furby-tm
Copy link
Contributor Author

furby-tm commented Dec 8, 2023

No worries! It's important to enjoy the holidays too, you know!

Copy link
Owner

@stackotter stackotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had two questions/suggestions, other than that it looks good to me. Nice and self-contained 👍

@furby-tm
Copy link
Contributor Author

furby-tm commented Dec 9, 2023

One small sad note, it appears SwiftPM yeets plugins out of packages that are within other dependencies of your project's dependencies -- not sure if the usage of a commit hash in-place of a release version is somehow causing that behavior or not but I will tag a release on my fork and let you know what happens.

Perhaps I'm just abusing SwiftPM with monolithic packages like this, but it seems kind of silly that these things don't transitively come through, given that's how library dependencies work... If this is indeed the case, I will try and see why with one of the SwiftPM project leads.

Can confirm, even after resolving all versioning requirements, plugins don't appear to be transitive to dependencies-of-dependencies, so I will additionally close the issue I created and discuss this with the SwiftPM team.

* Note, I have set this to my fork which has an additional fix to TOMLKit - pending a PR.
* PR: LebJe/TOMLKit#22
@furby-tm
Copy link
Contributor Author

furby-tm commented Dec 9, 2023

@stackotter Hiya! I'm a big dummy and somehow marked the TOMLKit dependency as branch: "0.5.5" instead of the correct from: "0.5.5", and to my surprise is just now finally propagating some errors for me, wild!

However TOMLKit also had an unstable version on one of their dependencies which is pending this PR.

Until then, I have set the dependency on my fork if that works for you.

@furby-tm furby-tm requested a review from stackotter December 10, 2023 00:46
Copy link
Owner

@stackotter stackotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! 🎉 I'm surprised I didn't catch that TOMLKit version issue (branch instead of from) when reviewing that previous PR haha, good catch

@stackotter stackotter merged commit f993ff7 into stackotter:main Dec 10, 2023
@furby-tm
Copy link
Contributor Author

Lgtm! 🎉 I'm surprised I didn't catch that TOMLKit version issue (branch instead of from) when reviewing that previous PR haha, good catch

I'm still in confusion how it worked at all 😆 makes no sense to me, it's got to be the SwiftPM cache or something

@stackotter
Copy link
Owner

Yeah hahah, probably

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

Successfully merging this pull request may close these issues.

2 participants