Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(export): the editor and the command line export a project from one reading of it

esengine715538c8ef98
diff --git a/.github/workflows/android-canary-apk.yml b/.github/workflows/android-canary-apk.yml
index e4a33ef1a..256b4881f 100644
--- a/.github/workflows/android-canary-apk.yml
+++ b/.github/workflows/android-canary-apk.yml
@@ -132,6 +132,7 @@ jobs:
exit 1
fi
cp "$APK" "apks/$name.apk"
+ node -e "process.stdout.write(require('./build/pkg/$name.json').appId)" > "apks/$name.appid"
echo "::endgroup::"
done
ls -la apks
@@ -139,5 +140,7 @@ jobs:
- uses: actions/upload-artifact@v7
with:
name: compat-apks
- path: apks/*.apk
+ path: |
+ apks/*.apk
+ apks/*.appid
retention-days: 3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9de3583de..3cdac5ae7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ published separately; it ships inside the editor.
### Fixed
+- An export from the Build dialog and one from `estella export` now read the project the same way. The dialog's builds keep the engine modules a project includes or excludes, which they ignored; the command line's carry the project's app id (a native package was always `com.estella.game`, so two games replaced each other on a phone), its script entry and scenes folder, its desktop channel and Steam app, and a playable's ad network.
- Android's "Android Studio project" and "App Bundle (.aab)" settings take effect: the project file never read them back, so every Android export wrote an APK and nothing else.
- A native development build's Profiler shows its draw calls, triangles, sprites and VRAM, and what the debug channel costs it: all read 0 on a native build.
diff --git a/desktop b/desktop
index 2ee68a2b8..a4dcbabcb 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 2ee68a2b82c1b9a1f582d8f399e17c88f41e8be9
+Subproject commit a4dcbabcb0cb360428514729b82ddfdc2c45c1ea
diff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjs
index 36361a886..12ccadfb1 100644
--- a/pipeline/bin/estella.mjs
+++ b/pipeline/bin/estella.mjs
@@ -757,9 +757,6 @@ if (!entryScene) {
process.exit(2);
}
-const scriptsEntry = opts.scripts ?? (existsSync(path.join(opts.projectDir, 'src', 'main.ts'))
- ? 'src/main.ts' : undefined);
-
const outDir = path.resolve(opts.out ?? path.join(opts.projectDir, `dist-${platform}`));
// The editor's package.json is the version of the whole product, and the runtime
@@ -781,17 +778,16 @@ const desktopTemplates = platform !== 'desktop' ? [] : (opts.template
const { mod: fmt, cleanup: cleanupFmt } = await loadPipeline(
path.join(PIPELINE, 'src', 'project', 'index.ts'), 'projectFormat.mjs');
-const { resolveOrientation, parseManifest, runtimeConfigOf, cookOptionsOf, packagingOptionsOf } = fmt;
+const { parseManifest } = fmt;
// PARSED, not read by hand: the parser normalizes legacy platform ids and drops
// values that could not be judged against. A setting read straight off the JSON
// here is a second answer to what a project means.
const manifest = parseManifest(project);
-const sizeBudgetBytes = manifest.packaging?.sizeBudget?.[platform];
const { mod: exporter, cleanup: cleanupExport } = await loadPipeline(
path.join(PIPELINE, 'src', 'export', 'exportGame.ts'), 'exportGame.mjs');
-const { mod: rpkMod, cleanup: cleanupRpk } = await loadPipeline(
- path.join(PIPELINE, 'src', 'export', 'rpk.ts'), 'rpk.mjs');
+const { mod: projectOpts, cleanup: cleanupProjectOpts } = await loadPipeline(
+ path.join(PIPELINE, 'src', 'export', 'projectExportOptions.ts'), 'projectExportOptions.mjs');
// A platform the project defines in .esengine/platforms/, loaded the way the
// build dialog loads it, so a headless package is the one the dialog makes.
@@ -815,46 +811,33 @@ if (!fmt.BUILTIN_PLATFORMS.includes(platform)) {
let code = 1;
try {
const result = await exporter.exportGame({
- root: opts.projectDir,
+ ...await projectOpts.projectExportOptions(opts.projectDir, manifest, platform),
entryScene,
- scriptsEntry,
+ ...(opts.scripts ? { scriptsEntry: opts.scripts } : {}),
+ ...(opts.title ? { title: opts.title } : {}),
hostsDir: path.join(PIPELINE, 'src', 'runtime'),
packagesDir: path.join(REPO, 'plugins'),
sdkDistDir: path.join(REPO, 'sdk', 'dist'),
wasmDir: opts.wasm ? path.resolve(opts.wasm) : projectPlatform?.wasmDir ?? engineRuntimeDir(platform),
miniGameProfile: projectPlatform?.profile,
outDir,
- platform,
- title: opts.title ?? project.name ?? path.basename(opts.projectDir),
- orientation: resolveOrientation(project),
- // The project's OWN settings, through the same derivation the editor uses:
- // without it a headless package ships every setting at its default while
- // claiming to be the package the dialog makes.
- runtime: runtimeConfigOf(manifest),
- ...cookOptionsOf(manifest),
- ...packagingOptionsOf(manifest),
- // What the dialog passes from the same settings: the vendor's id for the game,
- // the version a host config states, and a quick game's ordinal and key.
- miniGameAppid: manifest.packaging?.platforms?.[platform]?.appid,
- appVersion: manifest.version,
- miniGameVersionCode: manifest.packaging?.platforms?.[platform]?.versionCode,
- miniGameReleaseKey: platform === 'quickgame' || platform === 'huawei'
- ? (await rpkMod.readReleaseKey(opts.projectDir, manifest.packaging?.platforms?.[platform]?.releaseKey)) ?? undefined
- : undefined,
androidTemplate: platform === 'android' ? templateDir : null,
desktopTemplates,
- desktopChannel: opts['steam-appid'] ? 'steam' : undefined,
- steam: (opts['steam-appid'] || opts['steam-sdk'])
- ? { appId: Number(opts['steam-appid']) || undefined, sdkPath: opts['steam-sdk'] }
- : undefined,
+ ...(opts['steam-appid'] ? { desktopChannel: 'steam' } : {}),
+ ...((opts['steam-appid'] || opts['steam-sdk']) ? {
+ steam: {
+ ...manifest.packaging?.platforms?.desktop?.steam,
+ ...(opts['steam-appid'] ? { appId: Number(opts['steam-appid']) } : {}),
+ ...(opts['steam-sdk'] ? { sdkPath: opts['steam-sdk'] } : {}),
+ },
+ } : {}),
iosSources: platform === 'ios' && templateDir ? iosTemplateSources(templateDir) : null,
- androidOutput: opts.output === 'project' ? 'project' : undefined,
+ ...(opts.output === 'project' ? { androidOutput: 'project' } : {}),
minify: opts.minify,
...(opts['debug-channel'] ? { debugChannel: { url: opts['debug-channel'] } } : {}),
// `dev` is what the AOT step calls "do not compile" — the editor's preview
// mode, reused here so there is one word for it (docs/REARCH_AOT.md §9).
...(opts['no-aot'] ? { aotMode: 'dev' } : {}),
- sizeBudgetBytes,
});
const report = { ...result, outDir };
console.log(JSON.stringify(report, null, 2));
@@ -888,7 +871,7 @@ try {
// Before the exit, not after: process.exit() in the try block would skip this
// and leave the bundle dirs behind.
cleanupExport();
- cleanupRpk();
+ cleanupProjectOpts();
cleanupFmt();
}
process.exit(code);
diff --git a/pipeline/src/export/exportGame.ts b/pipeline/src/export/exportGame.ts
index 56e254de5..bc5bfb7c7 100644
--- a/pipeline/src/export/exportGame.ts
+++ b/pipeline/src/export/exportGame.ts
@@ -266,6 +266,8 @@ export interface ExportGameResult {
packedFrom?: Record<string, number>;
warnings: string[];
errors: string[];
+ /** A native target's bundle id, as the installed app is known to the OS. */
+ appId?: string;
/** Android: the generated Gradle project, for the editor to reveal. Absent
* unless the export asked for a project (and a template was installed). */
androidProject?: string;
@@ -835,6 +837,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
const errors: string[] = [];
/** iOS: set once the project is written around the content (see below). */
let xcodeProject: string | undefined;
+ let appId: string | undefined;
let androidProject: string | undefined;
let apkFile: string | undefined;
let aabFile: string | undefined;
@@ -1124,6 +1127,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
allowHttp: !opts.minify,
};
await writeFile(path.join(payloadDir, 'app.config.json'), JSON.stringify(appConfig, null, 2) + '\n');
+ appId = appConfig.id;
const http = cleartextWarning(platform, !!opts.minify, hotUpdate?.remoteRoot);
if (http) warnings.push(http);
@@ -1240,7 +1244,7 @@ async function produceExport(opts: ExportGameOptions): Promise<ExportGameResult>
return {
ok: errors.length === 0, platform, outDir: absOut, included: cook.included.length,
inclusion: cook.inclusion,
- warnings, errors, ...(xcodeProject ? { xcodeProject } : {}), ...(androidProject ? { androidProject } : {}),
+ warnings, errors, ...(appId ? { appId } : {}), ...(xcodeProject ? { xcodeProject } : {}), ...(androidProject ? { androidProject } : {}),
...(apkFile ? { apkFile } : {}), ...(aabFile ? { aabFile } : {}),
...(appBundles.length > 0 ? { appBundles } : {}),
...(steamChecklist ? { steamChecklist } : {}),
diff --git a/pipeline/src/export/projectExportOptions.ts b/pipeline/src/export/projectExportOptions.ts
new file mode 100644
index 000000000..f9a4fb4d6
--- /dev/null
+++ b/pipeline/src/export/projectExportOptions.ts
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file projectExportOptions.ts — what a project's own settings say an export of
+ * it is, for one target.
+ *
+ * The Build dialog and the command line each assembled this by hand, and the two
+ * lists drifted: a headless package carried no app id, ignored a project's script
+ * entry and scenes folder and its ad network, while the dialog dropped the
+ * project's engine module choices. Both now start from this one answer and lay
+ * only what the person chose for this build on top.
+ */
+import path from 'node:path';
+import type { ExportGameOptions } from './exportGame';
+import { readReleaseKey } from './rpk';
+import { loadPlayableProfile } from './platformCatalog';
+import {
+ resolveAppId, resolveLayout, resolveOrientation, resolveScripts,
+ type ExportPlatform, type ProjectManifest,
+} from '../project/format';
+import { BUILTIN_PLATFORMS, isMiniGamePlatform } from '../project/platforms';
+import { cookOptionsOf, packagingOptionsOf, runtimeConfigOf } from '../project/runtimeConfig';
+
+/** The part of an export a project's manifest decides; the caller adds where the
+ * engine, templates and output live, and the choices made for this one build. */
+export type ProjectExportOptions = Omit<ExportGameOptions,
+ 'hostsDir' | 'packagesDir' | 'sdkDistDir' | 'wasmDir' | 'outDir'>;
+
+const NATIVE_IDENTITY: Partial<Record<ExportPlatform, 'android' | 'ios' | 'desktop'>> = {
+ android: 'android', ios: 'ios', desktop: 'desktop',
+};
+
+export async function projectExportOptions(
+ root: string, manifest: ProjectManifest, platform: ExportPlatform,
+): Promise<ProjectExportOptions> {
+ const packaging = manifest.packaging;
+ const plat = packaging?.platforms;
+ const vendor = (plat as Record<string, { appid?: string } | undefined> | undefined)?.[platform];
+ const quickGame = platform === 'quickgame' ? plat?.quickgame : platform === 'huawei' ? plat?.huawei : undefined;
+ const identity = NATIVE_IDENTITY[platform];
+ return {
+ root,
+ platform,
+ entryScene: manifest.defaultScene ?? '',
+ scenesDir: resolveLayout(manifest).scenes,
+ scriptsEntry: resolveScripts(manifest).main,
+ title: manifest.name || path.basename(root),
+ orientation: resolveOrientation(manifest),
+ runtime: runtimeConfigOf(manifest),
+ ...cookOptionsOf(manifest),
+ ...packagingOptionsOf(manifest),
+ // A project-defined target is a mini-game variant built on WeChat's, so it
+ // ships WeChat's id; a built-in vendor ships only its own.
+ miniGameAppid: isMiniGamePlatform(platform) ? vendor?.appid
+ : (BUILTIN_PLATFORMS as readonly string[]).includes(platform) ? undefined : plat?.wechat?.appid,
+ ...(identity ? { appId: resolveAppId(manifest, identity) } : {}),
+ appVersion: manifest.version,
+ ...(quickGame ? {
+ miniGameVersionCode: quickGame.versionCode,
+ miniGameReleaseKey: (await readReleaseKey(root, quickGame.releaseKey)) ?? undefined,
+ } : {}),
+ androidVersionCode: plat?.android?.versionCode,
+ androidAppBundle: plat?.android?.appBundle,
+ androidOutput: plat?.android?.output,
+ desktopProductName: plat?.desktop?.productName,
+ desktopChannel: plat?.desktop?.channel,
+ steam: plat?.desktop?.steam,
+ ...(platform === 'playable'
+ ? { playableAdProfile: (await loadPlayableProfile(root, plat?.playable?.network)) ?? undefined }
+ : {}),
+ sizeBudgetBytes: packaging?.sizeBudget?.[platform],
+ };
+}
diff --git a/pipeline/tests/project-export-options.test.ts b/pipeline/tests/project-export-options.test.ts
new file mode 100644
index 000000000..851c8992a
--- /dev/null
+++ b/pipeline/tests/project-export-options.test.ts
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file What a project's settings make of an export, as both the Build dialog
+ * and the command line receive it.
+ */
+import { describe, it, expect, beforeAll, afterAll } from 'vitest';
+import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { parseManifest } from '../src/project/format';
+import { projectExportOptions } from '../src/export/projectExportOptions';
+
+let root: string;
+
+beforeAll(() => {
+ root = mkdtempSync(path.join(tmpdir(), 'export-options-'));
+ mkdirSync(path.join(root, 'sign'));
+ writeFileSync(path.join(root, 'sign', 'key.pem'), 'KEY');
+ writeFileSync(path.join(root, 'sign', 'cert.pem'), 'CERT');
+});
+afterAll(() => rmSync(root, { recursive: true, force: true }));
+
+const manifest = parseManifest({
+ formatVersion: '1',
+ name: 'Star Hopper',
+ version: '2.1.0',
+ defaultScene: 'levels/start.esscene',
+ layout: { scenes: 'levels' },
+ scripts: { main: 'game/boot.ts' },
+ features: { modules: { 'esengine/tilemap': 'exclude' } },
+ packaging: {
+ modulesByPlatform: { wechat: { 'esengine/ai': 'include' } },
+ sizeBudget: { wechat: 4_000_000 },
+ platforms: {
+ wechat: { appid: 'wx-own' },
+ douyin: { appid: 'tt-own' },
+ quickgame: { appid: 'qg', versionCode: 7, releaseKey: { privateKey: 'sign/key.pem', certificate: 'sign/cert.pem' } },
+ android: { versionCode: 12, appBundle: true, output: 'project' },
+ desktop: { productName: 'Star Hopper Deluxe', channel: 'steam', steam: { appId: 480 } },
+ playable: { network: 'meta' },
+ },
+ },
+});
+
+describe('the export a project describes', () => {
+ it('carries the project\'s layout, entry points and name', async () => {
+ const o = await projectExportOptions(root, manifest, 'web');
+ expect(o).toMatchObject({
+ root, platform: 'web', entryScene: 'levels/start.esscene', scenesDir: 'levels',
+ scriptsEntry: 'game/boot.ts', title: 'Star Hopper', appVersion: '2.1.0',
+ });
+ });
+
+ it('carries the engine modules the project chose, per target', async () => {
+ const o = await projectExportOptions(root, manifest, 'wechat');
+ expect(o.features?.modules).toEqual({ 'esengine/tilemap': 'exclude' });
+ expect(o.modulesByPlatform?.wechat).toEqual({ 'esengine/ai': 'include' });
+ expect(o.sizeBudgetBytes).toBe(4_000_000);
+ });
+
+ it('gives each mini-game vendor its own id, and a web build none', async () => {
+ expect((await projectExportOptions(root, manifest, 'douyin')).miniGameAppid).toBe('tt-own');
+ expect((await projectExportOptions(root, manifest, 'wechat')).miniGameAppid).toBe('wx-own');
+ expect((await projectExportOptions(root, manifest, 'web')).miniGameAppid).toBeUndefined();
+ });
+
+ it('gives a project-defined target WeChat\'s id', async () => {
+ expect((await projectExportOptions(root, manifest, 'my-portal')).miniGameAppid).toBe('wx-own');
+ });
+
+ it('names a native app after the project, not a placeholder', async () => {
+ const android = await projectExportOptions(root, manifest, 'android');
+ expect(android.appId).toMatch(/^[a-z][\w.]*\.[a-z]\w*$/i);
+ expect(android.appId).not.toBe('com.estella.game');
+ expect(android).toMatchObject({ androidVersionCode: 12, androidAppBundle: true, androidOutput: 'project' });
+ expect((await projectExportOptions(root, manifest, 'web')).appId).toBeUndefined();
+ });
+
+ it('carries the desktop product, channel and Steam app', async () => {
+ expect(await projectExportOptions(root, manifest, 'desktop')).toMatchObject({
+ desktopProductName: 'Star Hopper Deluxe', desktopChannel: 'steam', steam: { appId: 480 },
+ });
+ });
+
+ it('reads a quick game\'s release key from the project', async () => {
+ const o = await projectExportOptions(root, manifest, 'quickgame');
+ expect(o.miniGameVersionCode).toBe(7);
+ expect(o.miniGameReleaseKey).toBeDefined();
+ });
+
+ it('resolves a playable\'s ad network', async () => {
+ expect((await projectExportOptions(root, manifest, 'playable')).playableAdProfile?.id).toBe('meta');
+ });
+});
diff --git a/tools/android-compat-run.sh b/tools/android-compat-run.sh
index ee6be64ca..fe911db08 100755
--- a/tools/android-compat-run.sh
+++ b/tools/android-compat-run.sh
@@ -44,7 +44,7 @@ for apk in "${APKS[@]}"; do
# --no-frame-judge: the frame is for a human to look at. The gate is install +
# `ready` + no recorded error.
node "$ROOT/tools/verify-native-boot.mjs" \
- --platform android --apk "$apk" \
+ --platform android --apk "$apk" --app-id "$(cat "${apk%.apk}.appid")" \
--label "$label" --no-frame-judge \
--out "$OUT" \
--metrics-out "${OUT}/${label}.json" || rc=$?
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index a4a8d3004..1ca27d48d 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -1146,4 +1146,8 @@ export const NOTED = {
{ note: 'A native development build\'s Profiler shows its draw calls, triangles, sprites and VRAM, and what the debug channel costs it: all read 0 on a native build.' },
'fix(android): the Gradle project and App Bundle settings reach the export':
{ note: 'Android\'s "Android Studio project" and "App Bundle (.aab)" settings take effect: the project file never read them back, so every Android export wrote an APK and nothing else.' },
+ 'fix(export): the Build dialog\'s export reads the project the way the command line does':
+ { note: 'An export from the Build dialog and one from `estella export` now read the project the same way. The dialog\'s builds keep the engine modules a project includes or excludes, which they ignored; the command line\'s carry the project\'s app id (a native package was always `com.estella.game`, so two games replaced each other on a phone), its script entry and scenes folder, its desktop channel and Steam app, and a playable\'s ad network.' },
+ 'fix(export): the editor and the command line export a project from one reading of it':
+ { note: 'An export from the Build dialog and one from `estella export` now read the project the same way. The dialog\'s builds keep the engine modules a project includes or excludes, which they ignored; the command line\'s carry the project\'s app id (a native package was always `com.estella.game`, so two games replaced each other on a phone), its script entry and scenes folder, its desktop channel and Steam app, and a playable\'s ad network.' },
};
diff --git a/tools/verify-native-boot.mjs b/tools/verify-native-boot.mjs
index 63147039a..01230c896 100644
--- a/tools/verify-native-boot.mjs
+++ b/tools/verify-native-boot.mjs
@@ -20,7 +20,7 @@
* `bootPhase`/`bootReady` write to the file only (BootLog.cpp), so grepping
* logcat for "ready" finds nothing and calls a dead app healthy.
*
- * node tools/verify-native-boot.mjs --platform ios --app <bundle.app>
+ * node tools/verify-native-boot.mjs --platform ios --app <bundle.app> [--app-id <bundle id>]
* node tools/verify-native-boot.mjs --platform android --examples all
* node tools/verify-native-boot.mjs --platform android --examples all --shard 1/3
*
@@ -50,7 +50,10 @@ import { GOLDEN, launchTimeoutFor } from './goldenProjects.mjs';
import { worthAnotherLaunch, exitCodeFor, unjudgedReason } from './lib/smokeRetry.mjs';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
-const APP_ID = 'com.estella.game';
+/** A prebuilt app's bundle id, unless `--app-id` names another; a packaged
+ * example's is whatever its export reports. */
+const DEFAULT_APP_ID = 'com.estella.game';
+let APP_ID = DEFAULT_APP_ID;
const LOG_NAME = 'estella-boot.log';
const READY = 'ready in';
/** Captures per app. See the comment at the capture site for why >1 and why
@@ -191,7 +194,7 @@ function cpuTicks(adb, pid) {
function androidDriver(opts) {
const adb = process.env.ANDROID_HOME
? path.join(process.env.ANDROID_HOME, 'platform-tools', 'adb') : 'adb';
- const logFile = `/sdcard/Android/data/${APP_ID}/files/${LOG_NAME}`;
+ const logFile = () => `/sdcard/Android/data/${APP_ID}/files/${LOG_NAME}`;
let lastReadError = '';
return {
@@ -239,7 +242,7 @@ function androidDriver(opts) {
trySh(adb, ['uninstall', APP_ID]);
sh(adb, ['install', '-r', '-t', apk]);
// A record left by an earlier app would answer for this one.
- trySh(adb, ['shell', 'rm', '-f', logFile]);
+ trySh(adb, ['shell', 'rm', '-f', logFile()]);
trySh(adb, ['logcat', '-c']);
},
// `-W` makes this wait for the launch to finish and print what it cost, so
@@ -313,7 +316,7 @@ function androidDriver(opts) {
trySh(adb, ['shell', 'cmd', 'uimode', 'night', night ? 'yes' : 'no']);
},
readLog() {
- const got = trySh(adb, ['shell', 'cat', logFile]);
+ const got = trySh(adb, ['shell', 'cat', logFile()]);
// Why it failed, kept for the diagnostics. "No such file" (the app never
// got that far) and "Permission denied" (it did, and this cannot see it)
// are opposite conclusions that both arrive here as an empty string, and
@@ -441,7 +444,7 @@ function androidDriver(opts) {
// First, because an unreadable record is a different failure from an
// unwritten one and the report cannot tell them apart on its own.
['reading the boot record', lastReadError
- ? `${lastReadError}\n${trySh(adb, ['shell', 'ls', '-l', path.posix.dirname(logFile)]).stdout ?? ''}`
+ ? `${lastReadError}\n${trySh(adb, ['shell', 'ls', '-l', path.posix.dirname(logFile())]).stdout ?? ''}`
: ''],
['logcat (EstellaSDK)', trySh(adb, ['logcat', '-d', '-s', 'EstellaSDK:*']).stdout],
['logcat (crashes)', trySh(adb, ['logcat', '-d', '-b', 'crash']).stdout],
@@ -747,7 +750,7 @@ function packageExample(driver, name, opts) {
if (!existsSync(report)) throw new Error('the export wrote no result');
const exported = JSON.parse(readFileSync(report, 'utf8'));
if (!exported.ok) throw new Error(`export failed: ${(exported.errors ?? []).join('; ') || 'no reason given'}`);
- return { app: driver.build(exported), work };
+ return { app: driver.build(exported), work, appId: exported.appId ?? DEFAULT_APP_ID };
}
// =============================================================================
@@ -808,6 +811,7 @@ if (!opts.examples) {
console.error(`✗ no ${driver.name} app to verify (pass --${driver.artifactFlag} <path>)`);
process.exit(2);
}
+ APP_ID = opts.appId ?? DEFAULT_APP_ID;
const r = await verifyApp(driver, artifact, opts.label, opts);
console.log(`boot record: ${r.ready ? r.readyLine : 'never reached "ready in"'}`);
console.log(`frame: ${r.size}${opts.frameJudge === false ? '' : `, ${r.colors} distinct colors (need ${opts.minColors})`}`);
@@ -857,7 +861,8 @@ const results = [];
for (const name of examples) {
let r;
try {
- const { app, work } = packageExample(driver, name, opts);
+ const { app, work, appId } = packageExample(driver, name, opts);
+ APP_ID = appId;
r = await verifyApp(driver, app, name, opts, !FRAME_NOT_JUDGED[name]);
if (worthAnotherLaunch(r)) {
const first = r;