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

Support for bundling XPC Services #24

Open
bo0ts opened this issue May 3, 2022 · 4 comments
Open

Support for bundling XPC Services #24

bo0ts opened this issue May 3, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@bo0ts
Copy link

bo0ts commented May 3, 2022

I would like to use swift-bundler to create an app that includes an XPC Service. For that the resulting .app directory needs to contain a directory Contents/XPXServices which in turn contains .xpc bundles.

A first step to make this possible would be to support dictionaries dictionaries as additional plist entries:

[apps.ServiceProvider]
product = "ServiceProvider"
version = "0.0.1" # The apps can specify separate versions
[apps.ServiceProvider.extra_plist_entries]
CFBundleIdentifier = "com.my.ServiceProviderXPC"
CFBundlePackageType = "XPC!"
XPCService = { ServiceType = "Application" }

results in

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleIdentifier</key>
    <string>com.my.ServiceProviderXPC</string>
    <key>CFBundlePackageType</key>
    <string>XPC!</string>
    <key>XPCService</key>
    <dict>
        <key>ServiceType</key>
        <string>Application</string>
    </dict>
</dict>
</plist>

Given this I could already add a manual step that adds my ServiceProvider to the already created bundle.

@stackotter
Copy link
Owner

Would you be able to provide an example xcode project with an xpc service so that I can see how the resulting app bundle should look? I haven’t worked with xpc services before so I don’t know how they work.

@bo0ts
Copy link
Author

bo0ts commented May 5, 2022

I've started my project using https://github.com/rderik/XPCSquirrel as a template. The resulting app folder looks like this:

$ tree MyApp.app
MyApp.app/
└── Contents
    ├── Info.plist
    ├── MacOS
    │   └── MyApp
    └── XPCServices
        └── ServiceProvider.xpc
            └── Contents
                ├── Info.plist
                └── MacOS
                    └── ServiceProvider

Happy to provide more information if you need it.

@stackotter
Copy link
Owner

Thanks, that should be enough info for now 👍

Once I've gotten very basic iOS support working (a sponsor wants that) I'll try implementing support for XPC services. Basic iOS support isn't too far away so you shouldn't have to wait too long :)

@stackotter
Copy link
Owner

I'm finally working on Swift Bundler again after not really working on it much at all for probably over 6 months. The early access version currently has support for expressing any possible plist entries in the configuration file. I will be merging the early access version into this repo soon after a few more improvements. After that I'll be looking into supporting a big chunk of the kinds of Apple-specific app content that Xcode supports (iMessage extensions, XPC services, etc.)

@stackotter stackotter added the enhancement New feature or request label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants