eas-cli 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1135 -7
  2. package/build/branch/queries.d.ts +1 -0
  3. package/build/branch/queries.js +2 -2
  4. package/build/build/build.js +2 -2
  5. package/build/build/createContext.js +1 -0
  6. package/build/build/graphql.js +6 -0
  7. package/build/build/local.js +1 -1
  8. package/build/build/queries.d.ts +4 -2
  9. package/build/build/queries.js +32 -7
  10. package/build/commands/build/run.js +24 -11
  11. package/build/commands/credentials.d.ts +1 -0
  12. package/build/commands/credentials.js +3 -2
  13. package/build/commands/submit.js +1 -1
  14. package/build/commands/update/index.js +8 -6
  15. package/build/credentials/manager/HelperActions.d.ts +2 -0
  16. package/build/credentials/manager/ManageAndroid.js +8 -1
  17. package/build/credentials/manager/ManageIos.js +8 -1
  18. package/build/credentials/manager/SelectPlatform.d.ts +3 -1
  19. package/build/credentials/manager/SelectPlatform.js +2 -1
  20. package/build/devices/utils/formatDevice.js +1 -2
  21. package/build/graphql/generated.d.ts +12 -0
  22. package/build/graphql/generated.js +9 -2
  23. package/build/graphql/mutations/SubmissionMutation.js +14 -2
  24. package/build/graphql/mutations/UploadSessionMutation.d.ts +4 -3
  25. package/build/prompts.js +3 -1
  26. package/build/run/android/aapt.d.ts +5 -0
  27. package/build/run/android/aapt.js +51 -0
  28. package/build/run/android/adb.d.ts +23 -0
  29. package/build/run/android/adb.js +120 -0
  30. package/build/run/android/emulator.d.ts +7 -0
  31. package/build/run/android/emulator.js +109 -0
  32. package/build/run/android/run.d.ts +1 -1
  33. package/build/run/android/run.js +10 -3
  34. package/build/run/android/sdk.d.ts +3 -0
  35. package/build/run/android/sdk.js +29 -0
  36. package/build/run/android/systemRequirements.d.ts +1 -0
  37. package/build/run/android/systemRequirements.js +24 -0
  38. package/build/submit/ArchiveSource.d.ts +20 -10
  39. package/build/submit/ArchiveSource.js +59 -60
  40. package/build/submit/BaseSubmitter.d.ts +4 -1
  41. package/build/submit/BaseSubmitter.js +20 -0
  42. package/build/submit/android/AndroidSubmitCommand.js +1 -2
  43. package/build/submit/android/AndroidSubmitter.d.ts +3 -3
  44. package/build/submit/android/AndroidSubmitter.js +12 -7
  45. package/build/submit/commons.d.ts +1 -1
  46. package/build/submit/commons.js +1 -16
  47. package/build/submit/ios/IosSubmitCommand.js +1 -2
  48. package/build/submit/ios/IosSubmitter.d.ts +3 -3
  49. package/build/submit/ios/IosSubmitter.js +11 -6
  50. package/build/submit/utils/files.js +2 -2
  51. package/build/submit/utils/summary.d.ts +2 -2
  52. package/build/submit/utils/summary.js +7 -8
  53. package/build/uploads.d.ts +4 -10
  54. package/build/uploads.js +16 -36
  55. package/build/utils/download.d.ts +3 -2
  56. package/build/utils/download.js +37 -30
  57. package/build/utils/progress.d.ts +1 -1
  58. package/build/utils/progress.js +6 -4
  59. package/oclif.manifest.json +1 -1
  60. package/package.json +4 -4
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAptParametersAsync = exports.getAaptExecutableAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const log_1 = tslib_1.__importDefault(require("../../log"));
9
+ const sdk_1 = require("./sdk");
10
+ async function aaptAsync(...options) {
11
+ try {
12
+ return await (0, spawn_async_1.default)(await getAaptExecutableAsync(), options);
13
+ }
14
+ catch (error) {
15
+ if (error.stderr) {
16
+ log_1.default.error(error.stderr);
17
+ }
18
+ throw error;
19
+ }
20
+ }
21
+ async function getAaptExecutableAsync() {
22
+ const sdkRoot = await (0, sdk_1.getAndroidSdkRootAsync)();
23
+ if (!sdkRoot) {
24
+ log_1.default.debug('Failed to resolve the Android SDK path, falling back to global aapt executable');
25
+ return 'aapt';
26
+ }
27
+ const aaptPaths = await (0, fast_glob_1.default)(path_1.default.posix.join('build-tools/**', process.platform === 'win32' ? 'aapt.exe' : 'aapt'), { cwd: sdkRoot, absolute: true });
28
+ if (aaptPaths.length === 0) {
29
+ throw new Error('Failed to resolve the Android aapt path');
30
+ }
31
+ const sorted = aaptPaths.sort();
32
+ return sorted[sorted.length - 1];
33
+ }
34
+ exports.getAaptExecutableAsync = getAaptExecutableAsync;
35
+ async function getAptParametersAsync(appPath) {
36
+ const { stdout } = await aaptAsync('dump', 'badging', appPath);
37
+ const packageNameMatch = stdout.match(/package: name='([^']+)'/);
38
+ if (!packageNameMatch) {
39
+ throw new Error(`Could not read package name from ${appPath}`);
40
+ }
41
+ // get activity name
42
+ const activityNameMatch = stdout.match(/launchable-activity: name='([^']+)'/);
43
+ if (!activityNameMatch) {
44
+ throw new Error(`Could not read activity name from ${appPath}`);
45
+ }
46
+ return {
47
+ packageName: packageNameMatch[1],
48
+ activityName: activityNameMatch[1],
49
+ };
50
+ }
51
+ exports.getAptParametersAsync = getAptParametersAsync;
@@ -0,0 +1,23 @@
1
+ import { SpawnResult } from '@expo/spawn-async';
2
+ export interface AndroidEmulator {
3
+ pid?: string;
4
+ name: string;
5
+ }
6
+ export declare function adbAsync(...args: string[]): Promise<SpawnResult>;
7
+ export declare function getAdbExecutableAsync(): Promise<string>;
8
+ export declare function sanitizeAdbDeviceName(deviceName: string): string | undefined;
9
+ /**
10
+ * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.
11
+ *
12
+ * @param devicePid a value like `emulator-5554` from `abd devices`
13
+ */
14
+ export declare function getAdbNameForDeviceIdAsync(emulatorPid: string): Promise<string | null>;
15
+ export declare function getRunningEmulatorsAsync(): Promise<AndroidEmulator[]>;
16
+ export declare function getFirstRunningEmulatorAsync(): Promise<AndroidEmulator | null>;
17
+ /**
18
+ * Returns true if emulator is booted
19
+ *
20
+ * @param emulatorPid
21
+ */
22
+ export declare function isEmulatorBootedAsync(emulatorPid: string): Promise<boolean>;
23
+ export declare function waitForEmulatorToBeBootedAsync(maxWaitTimeMs: number, intervalMs: number): Promise<AndroidEmulator>;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitForEmulatorToBeBootedAsync = exports.isEmulatorBootedAsync = exports.getFirstRunningEmulatorAsync = exports.getRunningEmulatorsAsync = exports.getAdbNameForDeviceIdAsync = exports.sanitizeAdbDeviceName = exports.getAdbExecutableAsync = exports.adbAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const os_1 = tslib_1.__importDefault(require("os"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const log_1 = tslib_1.__importDefault(require("../../log"));
9
+ const filter_1 = require("../../utils/expodash/filter");
10
+ const promise_1 = require("../../utils/promise");
11
+ const sdk_1 = require("./sdk");
12
+ const BEGINNING_OF_ADB_ERROR_MESSAGE = 'error: ';
13
+ async function adbAsync(...args) {
14
+ const adbExecutable = await getAdbExecutableAsync();
15
+ try {
16
+ return await (0, spawn_async_1.default)(adbExecutable, args);
17
+ }
18
+ catch (error) {
19
+ let errorMessage = (error.stderr || error.stdout || error.message).trim();
20
+ if (errorMessage.startsWith(BEGINNING_OF_ADB_ERROR_MESSAGE)) {
21
+ errorMessage = errorMessage.substring(BEGINNING_OF_ADB_ERROR_MESSAGE.length);
22
+ }
23
+ error.message = errorMessage;
24
+ throw error;
25
+ }
26
+ }
27
+ exports.adbAsync = adbAsync;
28
+ async function getAdbExecutableAsync() {
29
+ const sdkRoot = await (0, sdk_1.getAndroidSdkRootAsync)();
30
+ if (!sdkRoot) {
31
+ log_1.default.debug('Failed to resolve the Android SDK path, falling back to global adb executable');
32
+ return 'adb';
33
+ }
34
+ return path_1.default.join(sdkRoot, 'platform-tools/adb');
35
+ }
36
+ exports.getAdbExecutableAsync = getAdbExecutableAsync;
37
+ function sanitizeAdbDeviceName(deviceName) {
38
+ return deviceName.trim().split(/[\r\n]+/)[0];
39
+ }
40
+ exports.sanitizeAdbDeviceName = sanitizeAdbDeviceName;
41
+ /**
42
+ * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.
43
+ *
44
+ * @param devicePid a value like `emulator-5554` from `abd devices`
45
+ */
46
+ async function getAdbNameForDeviceIdAsync(emulatorPid) {
47
+ var _a;
48
+ const { stdout } = await adbAsync('-s', emulatorPid, 'emu', 'avd', 'name');
49
+ if (stdout.match(/could not connect to TCP port .*: Connection refused/)) {
50
+ // Can also occur when the emulator does not exist.
51
+ throw new Error(`Emulator not found: ${stdout}`);
52
+ }
53
+ return (_a = sanitizeAdbDeviceName(stdout)) !== null && _a !== void 0 ? _a : null;
54
+ }
55
+ exports.getAdbNameForDeviceIdAsync = getAdbNameForDeviceIdAsync;
56
+ // TODO: This is very expensive for some operations.
57
+ async function getRunningEmulatorsAsync() {
58
+ const { stdout } = await adbAsync('devices', '-l');
59
+ const splitItems = stdout.trim().split(os_1.default.EOL);
60
+ const attachedDevices = splitItems
61
+ // First line is `"List of devices attached"`, remove it
62
+ .slice(1, splitItems.length)
63
+ .map(line => {
64
+ // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']
65
+ // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']
66
+ // emulator: ['emulator-5554', 'offline', 'transport_id:1']
67
+ const [pid] = line.split(' ').filter(filter_1.truthy);
68
+ const type = line.includes('emulator') ? 'emulator' : 'device';
69
+ return { pid, type };
70
+ })
71
+ .filter(({ pid, type }) => !!pid && type === 'emulator');
72
+ const devicePromises = attachedDevices.map(async ({ pid }) => {
73
+ var _a;
74
+ const name = (_a = (await getAdbNameForDeviceIdAsync(pid))) !== null && _a !== void 0 ? _a : '';
75
+ return {
76
+ pid,
77
+ name,
78
+ };
79
+ });
80
+ return Promise.all(devicePromises);
81
+ }
82
+ exports.getRunningEmulatorsAsync = getRunningEmulatorsAsync;
83
+ async function getFirstRunningEmulatorAsync() {
84
+ var _a;
85
+ const emulators = await getRunningEmulatorsAsync();
86
+ return (_a = emulators[0]) !== null && _a !== void 0 ? _a : null;
87
+ }
88
+ exports.getFirstRunningEmulatorAsync = getFirstRunningEmulatorAsync;
89
+ /**
90
+ * Returns true if emulator is booted
91
+ *
92
+ * @param emulatorPid
93
+ */
94
+ async function isEmulatorBootedAsync(emulatorPid) {
95
+ try {
96
+ const { stdout } = await adbAsync('-s', emulatorPid, 'shell', 'getprop', 'sys.boot_completed');
97
+ if (stdout.trim() === '1') {
98
+ return true;
99
+ }
100
+ return false;
101
+ }
102
+ catch {
103
+ return false;
104
+ }
105
+ }
106
+ exports.isEmulatorBootedAsync = isEmulatorBootedAsync;
107
+ async function waitForEmulatorToBeBootedAsync(maxWaitTimeMs, intervalMs) {
108
+ log_1.default.newLine();
109
+ log_1.default.log('Waiting for the Android emulator to start...');
110
+ const startTime = Date.now();
111
+ while (Date.now() - startTime < maxWaitTimeMs) {
112
+ const emulator = await getFirstRunningEmulatorAsync();
113
+ if ((emulator === null || emulator === void 0 ? void 0 : emulator.pid) && (await isEmulatorBootedAsync(emulator.pid))) {
114
+ return emulator;
115
+ }
116
+ await (0, promise_1.sleepAsync)(intervalMs);
117
+ }
118
+ throw new Error('Timed out waiting for the Android emulator to start.');
119
+ }
120
+ exports.waitForEmulatorToBeBootedAsync = waitForEmulatorToBeBootedAsync;
@@ -0,0 +1,7 @@
1
+ import { AndroidEmulator } from './adb';
2
+ export declare const EMULATOR_MAX_WAIT_TIMEOUT_MS: number;
3
+ export declare function getEmulatorExecutableAsync(): Promise<string>;
4
+ export declare function selectEmulatorAsync(): Promise<AndroidEmulator>;
5
+ export declare function ensureEmulatorBootedAsync(emulator: AndroidEmulator): Promise<AndroidEmulator>;
6
+ export declare function installAppAsync(emulator: AndroidEmulator, apkFilePath: string): Promise<void>;
7
+ export declare function startAppAsync(emulator: AndroidEmulator, packageName: string, activityName: string): Promise<void>;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startAppAsync = exports.installAppAsync = exports.ensureEmulatorBootedAsync = exports.selectEmulatorAsync = exports.getEmulatorExecutableAsync = exports.EMULATOR_MAX_WAIT_TIMEOUT_MS = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
8
+ const os_1 = tslib_1.__importDefault(require("os"));
9
+ const path_1 = tslib_1.__importDefault(require("path"));
10
+ const log_1 = tslib_1.__importDefault(require("../../log"));
11
+ const prompts_1 = require("../../prompts");
12
+ const filter_1 = require("../../utils/expodash/filter");
13
+ const adb_1 = require("./adb");
14
+ const sdk_1 = require("./sdk");
15
+ exports.EMULATOR_MAX_WAIT_TIMEOUT_MS = 60 * 1000 * 3;
16
+ async function getEmulatorExecutableAsync() {
17
+ const sdkRoot = await (0, sdk_1.getAndroidSdkRootAsync)();
18
+ if (sdkRoot) {
19
+ return path_1.default.join(sdkRoot, 'emulator', 'emulator');
20
+ }
21
+ return 'emulator';
22
+ }
23
+ exports.getEmulatorExecutableAsync = getEmulatorExecutableAsync;
24
+ async function emulatorAsync(...options) {
25
+ const emulatorExecutable = await getEmulatorExecutableAsync();
26
+ try {
27
+ return await (0, spawn_async_1.default)(emulatorExecutable, options);
28
+ }
29
+ catch (error) {
30
+ if (error.stderr) {
31
+ log_1.default.error(error.stderr);
32
+ }
33
+ throw error;
34
+ }
35
+ }
36
+ async function getAvaliableAndroidEmulatorsAsync() {
37
+ try {
38
+ const { stdout } = await emulatorAsync('-list-avds');
39
+ return stdout
40
+ .split(os_1.default.EOL)
41
+ .filter(filter_1.truthy)
42
+ .map(name => ({
43
+ name,
44
+ }));
45
+ }
46
+ catch {
47
+ return [];
48
+ }
49
+ }
50
+ /** Start an Android device and wait until it is booted. */
51
+ async function bootEmulatorAsync(emulator, { timeout = exports.EMULATOR_MAX_WAIT_TIMEOUT_MS, interval = 1000, } = {}) {
52
+ log_1.default.newLine();
53
+ log_1.default.log(`Opening emulator ${chalk_1.default.bold(emulator.name)}`);
54
+ const emulatorExecutable = await getEmulatorExecutableAsync();
55
+ // Start a process to open an emulator
56
+ const emulatorProcess = (0, spawn_async_1.default)(emulatorExecutable, [`@${emulator.name}`], {
57
+ stdio: 'ignore',
58
+ detached: true,
59
+ });
60
+ // we don't want to wait for the emulator process to exit before we can finish `eas build:run` command
61
+ // https://github.com/expo/eas-cli/pull/1485#discussion_r1007935871
62
+ emulatorProcess.child.unref();
63
+ return await (0, adb_1.waitForEmulatorToBeBootedAsync)(timeout, interval);
64
+ }
65
+ async function selectEmulatorAsync() {
66
+ const runningEmulator = await (0, adb_1.getFirstRunningEmulatorAsync)();
67
+ if (runningEmulator) {
68
+ log_1.default.newLine();
69
+ log_1.default.log(`Using open emulator: ${chalk_1.default.bold(runningEmulator.name)}`);
70
+ return runningEmulator;
71
+ }
72
+ const emulators = await getAvaliableAndroidEmulatorsAsync();
73
+ log_1.default.newLine();
74
+ const { selectedEmulator } = await (0, prompts_1.promptAsync)({
75
+ type: 'select',
76
+ message: `Select an emulator to run your app on`,
77
+ name: 'selectedEmulator',
78
+ choices: emulators.map(emulator => ({
79
+ title: emulator.name,
80
+ value: emulator,
81
+ })),
82
+ });
83
+ return selectedEmulator;
84
+ }
85
+ exports.selectEmulatorAsync = selectEmulatorAsync;
86
+ async function ensureEmulatorBootedAsync(emulator) {
87
+ if (!emulator.pid || !(await (0, adb_1.isEmulatorBootedAsync)(emulator.pid))) {
88
+ return await bootEmulatorAsync(emulator);
89
+ }
90
+ return emulator;
91
+ }
92
+ exports.ensureEmulatorBootedAsync = ensureEmulatorBootedAsync;
93
+ async function installAppAsync(emulator, apkFilePath) {
94
+ log_1.default.newLine();
95
+ log_1.default.log('Installing your app...');
96
+ (0, node_assert_1.default)(emulator.pid);
97
+ await (0, adb_1.adbAsync)('-s', emulator.pid, 'install', '-r', '-d', apkFilePath);
98
+ log_1.default.succeed('Successfully installed your app!');
99
+ }
100
+ exports.installAppAsync = installAppAsync;
101
+ async function startAppAsync(emulator, packageName, activityName) {
102
+ log_1.default.newLine();
103
+ log_1.default.log('Starting your app...');
104
+ (0, node_assert_1.default)(emulator.pid);
105
+ await (0, adb_1.adbAsync)('-s', emulator.pid, 'shell', 'am', 'start', '-a', 'android.intent.action.RUN', '-f', '0x20000000', // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.
106
+ '-n', `${packageName}/${activityName}`);
107
+ log_1.default.succeed('Successfully started your app!');
108
+ }
109
+ exports.startAppAsync = startAppAsync;
@@ -1 +1 @@
1
- export declare function runAppOnAndroidEmulatorAsync(_appPath: string): Promise<void>;
1
+ export declare function runAppOnAndroidEmulatorAsync(appPath: string): Promise<void>;
@@ -2,8 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runAppOnAndroidEmulatorAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const log_1 = tslib_1.__importDefault(require("../../log"));
6
- async function runAppOnAndroidEmulatorAsync(_appPath) {
7
- log_1.default.error('Not implemented!');
5
+ const aapt_1 = require("./aapt");
6
+ const emulator = tslib_1.__importStar(require("./emulator"));
7
+ const systemRequirements_1 = require("./systemRequirements");
8
+ async function runAppOnAndroidEmulatorAsync(appPath) {
9
+ await (0, systemRequirements_1.assertExecutablesExistAsync)();
10
+ const selectedEmulator = await emulator.selectEmulatorAsync();
11
+ const bootedEmulator = await emulator.ensureEmulatorBootedAsync(selectedEmulator);
12
+ await emulator.installAppAsync(bootedEmulator, appPath);
13
+ const { packageName, activityName } = await (0, aapt_1.getAptParametersAsync)(appPath);
14
+ await emulator.startAppAsync(bootedEmulator, packageName, activityName);
8
15
  }
9
16
  exports.runAppOnAndroidEmulatorAsync = runAppOnAndroidEmulatorAsync;
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ export declare const ANDROID_DEFAULT_LOCATION: Readonly<Partial<Record<NodeJS.Platform, string>>>;
3
+ export declare function getAndroidSdkRootAsync(): Promise<string | null>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAndroidSdkRootAsync = exports.ANDROID_DEFAULT_LOCATION = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_extra_1 = require("fs-extra");
6
+ const os_1 = tslib_1.__importDefault(require("os"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ exports.ANDROID_DEFAULT_LOCATION = {
9
+ darwin: path_1.default.join(os_1.default.homedir(), 'Library', 'Android', 'sdk'),
10
+ linux: path_1.default.join(os_1.default.homedir(), 'Android', 'Sdk'),
11
+ win32: path_1.default.join(os_1.default.homedir(), 'AppData', 'Local', 'Android', 'Sdk'),
12
+ };
13
+ const ANDROID_DEFAULT_LOCATION_FOR_CURRENT_PLATFORM = exports.ANDROID_DEFAULT_LOCATION[process.platform];
14
+ async function getAndroidSdkRootAsync() {
15
+ if (process.env.ANDROID_HOME && (await (0, fs_extra_1.pathExists)(process.env.ANDROID_HOME))) {
16
+ return process.env.ANDROID_HOME;
17
+ }
18
+ else if (process.env.ANDROID_SDK_ROOT && (await (0, fs_extra_1.pathExists)(process.env.ANDROID_SDK_ROOT))) {
19
+ return process.env.ANDROID_SDK_ROOT;
20
+ }
21
+ else if (ANDROID_DEFAULT_LOCATION_FOR_CURRENT_PLATFORM &&
22
+ (await (0, fs_extra_1.pathExists)(ANDROID_DEFAULT_LOCATION_FOR_CURRENT_PLATFORM))) {
23
+ return ANDROID_DEFAULT_LOCATION_FOR_CURRENT_PLATFORM;
24
+ }
25
+ else {
26
+ return null;
27
+ }
28
+ }
29
+ exports.getAndroidSdkRootAsync = getAndroidSdkRootAsync;
@@ -0,0 +1 @@
1
+ export declare function assertExecutablesExistAsync(): Promise<void>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertExecutablesExistAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const aapt_1 = require("./aapt");
8
+ const adb_1 = require("./adb");
9
+ const emulator_1 = require("./emulator");
10
+ async function assertExecutableExistsAsync(executable, options) {
11
+ try {
12
+ await (0, spawn_async_1.default)(executable, options);
13
+ }
14
+ catch (err) {
15
+ throw new Error(`${chalk_1.default.bold(executable)} executable doesn't seem to work. Please make sure Android Studio is installed on your device and ${chalk_1.default.bold('ANDROID_HOME')} or ${chalk_1.default.bold('ANDROID_SDK_ROOT')} env variables are set.
16
+ ${err.message}`);
17
+ }
18
+ }
19
+ async function assertExecutablesExistAsync() {
20
+ await assertExecutableExistsAsync(await (0, adb_1.getAdbExecutableAsync)(), ['--version']);
21
+ await assertExecutableExistsAsync(await (0, emulator_1.getEmulatorExecutableAsync)(), ['-list-avds']);
22
+ await assertExecutableExistsAsync(await (0, aapt_1.getAaptExecutableAsync)(), ['version']);
23
+ }
24
+ exports.assertExecutablesExistAsync = assertExecutablesExistAsync;
@@ -7,14 +7,19 @@ export declare enum ArchiveSourceType {
7
7
  latest = 1,
8
8
  path = 2,
9
9
  buildId = 3,
10
- buildList = 4,
11
- prompt = 5
10
+ build = 4,
11
+ buildList = 5,
12
+ prompt = 6,
13
+ gcs = 7
12
14
  }
13
- interface ArchiveSourceBase {
14
- sourceType: ArchiveSourceType;
15
+ export interface ArchiveResolverContext {
15
16
  platform: Platform;
16
17
  projectId: string;
17
18
  nonInteractive: boolean;
19
+ graphqlClient: ExpoGraphqlClient;
20
+ }
21
+ interface ArchiveSourceBase {
22
+ sourceType: ArchiveSourceType;
18
23
  }
19
24
  interface ArchiveUrlSource extends ArchiveSourceBase {
20
25
  sourceType: ArchiveSourceType.url;
@@ -31,18 +36,23 @@ interface ArchiveBuildIdSource extends ArchiveSourceBase {
31
36
  sourceType: ArchiveSourceType.buildId;
32
37
  id: string;
33
38
  }
39
+ interface ArchiveBuildSource extends ArchiveSourceBase {
40
+ sourceType: ArchiveSourceType.build;
41
+ build: BuildFragment;
42
+ }
34
43
  interface ArchiveBuildListSource extends ArchiveSourceBase {
35
44
  sourceType: ArchiveSourceType.buildList;
36
45
  }
37
46
  interface ArchivePromptSource extends ArchiveSourceBase {
38
47
  sourceType: ArchiveSourceType.prompt;
39
48
  }
40
- export interface Archive {
41
- build?: BuildFragment;
42
- source: ArchiveSource;
43
- url?: string;
49
+ interface ArchiveGCSSource extends ArchiveSourceBase {
50
+ sourceType: ArchiveSourceType.gcs;
51
+ bucketKey: string;
52
+ localSource: ArchivePathSource;
44
53
  }
45
- export declare type ArchiveSource = ArchiveUrlSource | ArchiveLatestSource | ArchivePathSource | ArchiveBuildIdSource | ArchiveBuildListSource | ArchivePromptSource;
46
- export declare function getArchiveAsync(graphqlClient: ExpoGraphqlClient, source: ArchiveSource): Promise<Archive>;
54
+ export declare type ArchiveSource = ArchiveUrlSource | ArchiveLatestSource | ArchivePathSource | ArchiveBuildIdSource | ArchiveBuildSource | ArchiveBuildListSource | ArchivePromptSource | ArchiveGCSSource;
55
+ export declare type ResolvedArchiveSource = ArchiveUrlSource | ArchiveGCSSource | ArchiveBuildSource;
56
+ export declare function getArchiveAsync(ctx: ArchiveResolverContext, source: ArchiveSource): Promise<ResolvedArchiveSource>;
47
57
  export declare function isUuidV4(s: string): boolean;
48
58
  export {};