Skip to content

find_native_library target_key missing watchos mapping #107

Closed

Description

@proggeramlug

Bug

In `crates/perry/src/commands/compile.rs` at the `find_native_library` match (around line 1504), watchOS targets fall through to the `_ => "macos"` default:

```rust
let target_key = match target {
Some("ios-simulator") | Some("ios") => "ios",
Some("android") => "android",
Some("tvos-simulator") | Some("tvos") => "tvos",
Some("linux") => "linux",
Some("windows") => "windows",
Some("web") => "web",
None if cfg!(target_os = "linux") => "linux",
None if cfg!(target_os = "windows") => "windows",
_ => "macos",
};
```

So when `--target watchos-simulator` is used with a `perry.nativeLibrary` package, Perry picks up the `macos` entry (`native/macos/`) and tries to build it for the watch-sim target — which fails with unrelated errors like `rfd` not implementing `FileSaveDialogImpl`.

Repro

With the current bloom-jump + bloom-engine tree:

```
cd /path/to/jump
perry compile --target watchos-simulator --features watchos-game-loop src/main.ts -o BloomJumpWatch
```

Fails with `error: could not compile `rfd` ... Failed to build native library crate for bloom/core: native/macos/` — wrong crate.

Fix

Add the watchos arm to the match:

```rust
Some("watchos-simulator") | Some("watchos") => "watchos",
```

Follow-up on the bloom side (not Perry's concern)

Once this lands, bloom's `package.json` needs a `perry.nativeLibrary.targets.watchos` entry pointing at a new `native/watchos/` crate. That's tracked separately — this issue is only about Perry picking the correct key.

Related

Activity

  1. proggeramlug commented on Apr 23, 2026

    @proggeramlug
    ContributorAuthor

    The fix is already present on main — commit c2ba250 added the watchos arm to the find_native_library target_key match (now at line 2088):

    Some("watchos-simulator") | Some("watchos") => "watchos",

    Quick sanity check of other target-string match tables in compile.rs shows no other missing watchos entries — SDK name selection, triple selection, is_watchos flag (line 5937), and the metal_sources match (line 3384) all have parallel watchos arms.

    Closing as completed.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions