MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / main

Function main

scripts/integration/android.mjs:47–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 });
46
47async function main() {
48 try {
49 if (!fs.existsSync(simdeck)) {
50 throw new Error(`Missing ${simdeck}. Run npm run build:cli first.`);
51 }
52 if (
53 !fs.existsSync(
54 path.join(root, "packages", "simdeck-test", "dist", "index.js"),
55 )
56 ) {
57 throw new Error(
58 "Missing simdeck/test dist. Run npm run build:simdeck-test first.",
59 );
60 }
61
62 session = await measuredStep("simdeck/test isolated connect", () =>
63 connect({
64 cliPath: simdeck,
65 projectRoot: root,
66 isolated: true,
67 videoCodec: "software",
68 }),
69 );
70 console.log(`service ${session.endpoint}`);
71
72 const target = await measuredStep("resolve Android AVD", () =>
73 resolveAndroidDevice(),
74 );
75 if (!target) {
76 console.log(
77 "No Android AVDs discovered; skipping Android integration suite.",
78 );
79 return;
80 }
81
82 androidUDID = target.udid;
83 console.log(
84 `android target ${androidUDID} (${target.name})${
85 target.isBooted ? " already booted" : ""
86 }`,
87 );
88 if (!target.isBooted && !bootAndroid) {
89 const message = `${androidUDID} is not running. Start the emulator first or set SIMDECK_INTEGRATION_BOOT_ANDROID=1 to let SimDeck boot it.`;
90 if (requireRunningAndroid) {
91 throw new Error(message);
92 }
93 console.log(`${message} Skipping Android integration suite.`);
94 return;
95 }
96 shutdownAndroidAfterRun = !target.isBooted && bootAndroid && !keepAndroid;
97
98 await measuredStep(
99 target.isBooted
100 ? "JS boot Android idempotent"
101 : "JS boot Android emulator",
102 async () => {
103 await session.boot(androidUDID);
104 await waitForBooted(androidUDID);

Callers 1

android.mjsFile · 0.70

Calls 12

connectFunction · 0.90
resolveAndroidDeviceFunction · 0.85
waitForBootedFunction · 0.85
runCliSurfaceFunction · 0.85
runJsSurfaceFunction · 0.85
cleanupAndroidFunction · 0.85
cleanupSyncFunction · 0.85
logMethod · 0.80
bootMethod · 0.80
measuredStepFunction · 0.70
printTimingSummaryFunction · 0.70

Tested by

no test coverage detected