madsmtm / objc2

Bindings to Apple's frameworks in Rust
https://docs.rs/objc2/
MIT License
290 stars 35 forks source link

Add `ServiceManagement` framework #546

Closed dongcarl closed 5 months ago

dongcarl commented 5 months ago

Ref: https://developer.apple.com/documentation/servicemanagement?language=objc

Generated PR: https://github.com/madsmtm/icrate-generated/pull/9


A note: When running header-translator, I was getting a panic at: https://github.com/madsmtm/objc2/blob/5391a0df65ccb48f21fe64a79e18779f72c0af6e/crates/header-translator/src/main.rs#L280

I logged the filename and found that header-translator is trying to get the ServiceManagement.h file, which didn't exist in library.files.

The reason why it's trying to get ServiceManagement.h is because unlike most "umbrella" files in frameworks, the ServiceManagement.h file has a few const CFStringRef declarations in them.

This is perhaps also reflected in ServiceManagement's modulemap, where the umbrella declaration is:

        umbrella "Headers"

Instead of something found in all other icrate supported Frameworks:

        umbrella header "CoreWLAN.h"

Since we need to skip all the declarations in ServiceManagement.h for CoreFoundation reasons, a workaround is just to delay unwrapping the file unless we parsed usable statements, which is implemented in this PR


A question: The "Service Management" framework in general is supported on earlier macOS versions than the SMAppService, so which versions should I put in crates/header-translator/translation-config.toml? Also, which unstable-frameworks-macos-* should I put it under?

madsmtm commented 5 months ago

CI is failing because you're using a newer version of Xcode than icrate is currently generated with.

which versions should I put

Put the version of the framework; the supported versions of the framework will be automatically imported after we resolve #266.

modulemap

Yeah, we don't support that at all, the plan is to integrate better with clang first.

dongcarl commented 5 months ago

Seems like things are passing now

dongcarl commented 5 months ago

Anything else needed here?