Skip to content

Commit f11d1d5

Browse files
Copilotkraenhansen
andcommitted
Revert all visionOS changes - superseded by PR #294
Co-authored-by: kraenhansen <1243959+kraenhansen@users.noreply.github.com>
1 parent c14d33a commit f11d1d5

File tree

4 files changed

+17
-223
lines changed

4 files changed

+17
-223
lines changed

.github/workflows/check-visionos.yml

Lines changed: 0 additions & 134 deletions
This file was deleted.

packages/ferric/src/cargo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record<AppleTargetName, string> = {
2828
// "x86_64-apple-ios-macabi": "ios-x86_64-simulator",
2929
// "aarch64-apple-tvos": "tvos-arm64",
3030
// "aarch64-apple-tvos-sim": "tvos-arm64-simulator",
31-
"aarch64-apple-visionos": "xros-arm64",
32-
"aarch64-apple-visionos-sim": "xros-arm64-simulator",
31+
// "aarch64-apple-visionos": "xros-arm64",
32+
// "aarch64-apple-visionos-sim": "xros-arm64-simulator",
3333
};
3434

3535
const ANDROID_ARCH_PR_TARGET: Record<AndroidTargetName, string> = {

packages/ferric/src/rustup.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export function getInstalledTargets() {
99
.execFileSync("rustup", ["target", "list", "--installed"], {
1010
encoding: "utf-8",
1111
})
12-
.split("\n")
13-
.filter((line) => line.trim() !== ""),
12+
.split("\n"),
1413
);
1514
} catch (error) {
1615
throw new UsageError(
@@ -19,28 +18,3 @@ export function getInstalledTargets() {
1918
);
2019
}
2120
}
22-
23-
/**
24-
* Check if build-std prerequisites are available for tier 3 targets
25-
*/
26-
export function isBuildStdAvailable(): boolean {
27-
try {
28-
// Check if nightly toolchain is available
29-
const toolchains = cp.execFileSync("rustup", ["toolchain", "list"], {
30-
encoding: "utf-8",
31-
});
32-
33-
if (!toolchains.includes("nightly")) {
34-
return false;
35-
}
36-
37-
// Check if rust-src component is installed for nightly
38-
const components = cp.execFileSync("rustup", ["component", "list", "--toolchain", "nightly"], {
39-
encoding: "utf-8",
40-
});
41-
42-
return components.includes("rust-src (installed)");
43-
} catch {
44-
return false;
45-
}
46-
}

packages/ferric/src/targets.ts

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { chalk, UsageError, assertFixable } from "@react-native-node-api/cli-utils";
2-
import { getInstalledTargets, isBuildStdAvailable } from "./rustup.js";
1+
import { chalk, UsageError } from "@react-native-node-api/cli-utils";
2+
import { getInstalledTargets } from "./rustup.js";
33

44
export const ANDROID_TARGETS = [
55
"aarch64-linux-android",
@@ -26,9 +26,9 @@ export const APPLE_TARGETS = [
2626
/*
2727
"aarch64-apple-tvos",
2828
"aarch64-apple-tvos-sim",
29-
*/
3029
"aarch64-apple-visionos",
3130
"aarch64-apple-visionos-sim",
31+
*/
3232

3333
// "aarch64-apple-watchos",
3434
// "aarch64-apple-watchos-sim",
@@ -50,68 +50,22 @@ export const ALL_TARGETS = [...ANDROID_TARGETS, ...APPLE_TARGETS] as const;
5050
export type TargetName = (typeof ALL_TARGETS)[number];
5151

5252
/**
53-
* Tier 3 Rust targets that are not available via `rustup target add`
54-
* and require building the standard library from source using `-Zbuild-std`.
55-
*
56-
* @see https://doc.rust-lang.org/rustc/platform-support.html
57-
* @see https://doc.rust-lang.org/cargo/reference/unstable.html#build-std
58-
*/
59-
export const TIER_3_TARGETS: readonly TargetName[] = [
60-
"aarch64-apple-visionos",
61-
"aarch64-apple-visionos-sim",
62-
] as const;
63-
64-
/**
65-
* Check if a target is a tier 3 target that requires build-std
66-
*/
67-
export function isTier3Target(target: TargetName): boolean {
68-
return (TIER_3_TARGETS as readonly string[]).includes(target);
69-
}
70-
71-
/**
72-
* Ensure the targets are available for building
53+
* Ensure the targets are installed into the Rust toolchain
7354
* We do this up-front because the error message and fix is very unclear from the failure when missing.
7455
*/
7556
export function ensureInstalledTargets(expectedTargets: Set<TargetName>) {
7657
const installedTargets = getInstalledTargets();
77-
const missingStandardTargets = new Set([
78-
...[...expectedTargets].filter(
79-
(target) => !installedTargets.has(target) && !isTier3Target(target),
80-
),
58+
const missingTargets = new Set([
59+
...[...expectedTargets].filter((target) => !installedTargets.has(target)),
8160
]);
82-
const tier3Targets = new Set([
83-
...[...expectedTargets].filter((target) => isTier3Target(target)),
84-
]);
85-
86-
// Handle standard targets that can be installed via rustup
87-
assertFixable(
88-
missingStandardTargets.size === 0,
89-
`You're missing ${missingStandardTargets.size} targets`,
90-
{
91-
command: `rustup target add ${[...missingStandardTargets].join(" ")}`,
92-
},
93-
);
94-
95-
// Handle tier 3 targets that require build-std setup
96-
if (tier3Targets.size > 0) {
97-
// For tier 3 targets, check if build-std prerequisites are met
98-
assertFixable(
99-
isBuildStdAvailable(),
100-
`You're using tier 3 targets (${[...tier3Targets].join(", ")}) that require building the standard library from source`,
101-
{
102-
instructions:
103-
`To set up support for these targets:\n\n` +
104-
`1. Install nightly Rust with the rust-src component:\n` +
105-
` ${chalk.italic("rustup toolchain install nightly --component rust-src")}\n\n` +
106-
`2. Configure Cargo to use build-std by creating a .cargo/config.toml file:\n` +
107-
` ${chalk.italic("[unstable]")}\n` +
108-
` ${chalk.italic('build-std = ["std", "panic_abort"]')}\n\n` +
109-
`3. Set your default toolchain to nightly:\n` +
110-
` ${chalk.italic("rustup default nightly")}\n\n` +
111-
`For more information, see:\n` +
112-
`- Rust Platform Support: ${chalk.italic("https://doc.rust-lang.org/rustc/platform-support.html")}\n` +
113-
`- Cargo build-std: ${chalk.italic("https://doc.rust-lang.org/cargo/reference/unstable.html#build-std")}`,
114-
},
61+
if (missingTargets.size > 0) {
62+
// TODO: Ask the user if they want to run this
63+
throw new UsageError(
64+
`You're missing ${
65+
missingTargets.size
66+
} targets - to fix this, run:\n\n${chalk.italic(
67+
`rustup target add ${[...missingTargets].join(" ")}`,
68+
)}`,
11569
);
11670
}
11771
}

0 commit comments

Comments
 (0)