Skip to content

Commit e255c0d

Browse files
feat(mobile): mobile:install --prepare fetches or builds without a device
An EAS build takes longer than a pooled device's idle lease, which then ends before the install. --prepare gets the client for the checkout first; leasing and --session afterwards install it in seconds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bfc083e commit e255c0d

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎scripts/mobile-native-client.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,11 @@ const main = Command.make(
983983
Flag.withDescription("With --session, open the dev client against this Metro URL."),
984984
Flag.optional,
985985
),
986+
prepare: Flag.Boolean("prepare").pipe(
987+
Flag.withDescription(
988+
"Fetch or build the client for this checkout without a device (Android: for --abi). Run it before leasing a device: a build can outlast the lease.",
989+
),
990+
),
986991
},
987992
Effect.fn("nativeClient.main")(function* ({
988993
mode,
@@ -991,8 +996,32 @@ const main = Command.make(
991996
session,
992997
abi: sessionAbi,
993998
metro,
999+
prepare,
9941000
}) {
9951001
const started = yield* Clock.currentTimeMillis;
1002+
if (prepare) {
1003+
if (mode !== "ensure" || Option.isSome(requested) || Option.isSome(session))
1004+
return yield* new NativeClientError({
1005+
message: "--prepare needs no device; use it with ensure and no device id or --session.",
1006+
});
1007+
const environment = yield* HostProcess.Environment;
1008+
const home = environment.HOME ?? environment.USERPROFILE;
1009+
if (!home)
1010+
return yield* new NativeClientError({ message: "HOME or USERPROFILE must be set." });
1011+
const current = yield* fingerprint(platform);
1012+
const artifact = yield* resolveArtifact(
1013+
home,
1014+
platform,
1015+
platform === "android" ? sessionAbi : null,
1016+
current,
1017+
);
1018+
yield* Console.error(
1019+
`Client ready for ${platform} (${artifact.source}); lease a device and install.`,
1020+
);
1021+
return yield* Console.log(
1022+
yield* encodeOutput({ status: "ready", source: artifact.source, fingerprint: current }),
1023+
);
1024+
}
9961025
if (Option.isSome(session)) {
9971026
if (mode !== "ensure" || Option.isSome(requested))
9981027
return yield* new NativeClientError({

0 commit comments

Comments
 (0)