Skip to content

find_native_library target_key missing watchos mapping #107

@proggeramlug

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

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