Repository navigation
Only build AppKit examples on macOS - #871
Merged
Merged
Conversation
Since e45c533, `objc2-app-kit` is only a dependency of `examples-app` on macOS, so the `delegate`, `default_xcode_app` and `hello_world_app` examples no longer compile for iOS and visionOS, which fails the iOS ARMv7s and visionOS lint jobs. Gate them on `target_os = "macos"`, with a fallback `main` elsewhere, as `examples/webkit/browser.rs` does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since e45c533,
objc2-app-kitis only a dependency ofexamples-appon macOS, so the AppKit examples no longer compile for iOS and visionOS. That fails "Lint iOS ARMv7s" and "Lint visionOS Aarch64 simulator" onmain(iOS, visionOS). Three examples are affected, though clippy only reports whichever one it hits first:delegate,default_xcode_appandhello_world_app.hello_world_appalso importsNSPoint,NSRectandNSSize, which come fromobjc2-foundation'sobjc2-core-foundationfeature, andobjc2-app-kitwas what enabled that feature.This gates them on
target_os = "macos", with a fallbackmainelsewhere, the same wayexamples/webkit/browser.rsdoes.One thing you may want to change:
hello_world_app.rsis included verbatim inobjc2's crate docs, so thecfglines show up there. I tried two less noisy options, and neither works:#![cfg(target_os = "macos")]at the top fails with E0601 (mainnot found).#![cfg_attr(not(target_os = "macos"), no_main)]passes clippy, butcargo build --examplesfor visionOS fails to link (_mainundefined).Making
objc2-app-kitunconditional again doesn't help either, sinceAppKitis linked on every Apple target (generated/AppKit/mod.rs). If you'd rather keep the docs clean, it may be easier to stop linting that example on non-macOS targets.Testing: with the CI's nightly (
nightly-2026-08-23):cargo clippy -Zbuild-std --all-targets -p examples-app --target {aarch64-apple-visionos-sim,armv7s-apple-ios}passes with this change. Onmain, both CI jobs fail, and locally on visionOS--keep-goingshows all three examples erroring.cargo clippy --all-targets -p examples-appon macOS,cargo docwith--deny=warningsfor visionOS,cargo build --examplesfor visionOS and macOS, andcargo fmt --checkpass.I only ran
-p examples-app, not the CI's full--workspacecommand. e45c533 only touchedexamples/app, so this should turn both lint jobs green. There's no changelog entry, since the examples aren't published.This is independent of #870, where the same two jobs fail for this reason.
🤖 Generated with Claude Code