eas-cli 2.7.1 → 2.9.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.
- package/README.md +78 -53
- package/build/branch/queries.d.ts +1 -0
- package/build/branch/queries.js +2 -2
- package/build/build/build.d.ts +1 -1
- package/build/build/build.js +2 -2
- package/build/build/createContext.js +1 -0
- package/build/build/graphql.js +6 -0
- package/build/build/local.js +1 -1
- package/build/build/queries.d.ts +4 -2
- package/build/build/queries.js +32 -7
- package/build/build/runBuildAndSubmit.js +31 -2
- package/build/commands/build/run.d.ts +0 -1
- package/build/commands/build/run.js +32 -12
- package/build/commands/submit.js +1 -1
- package/build/commands/update/index.js +20 -8
- package/build/devices/utils/formatDevice.js +1 -2
- package/build/graphql/generated.d.ts +15 -0
- package/build/graphql/generated.js +9 -2
- package/build/graphql/mutations/SubmissionMutation.js +14 -2
- package/build/graphql/mutations/UploadSessionMutation.d.ts +4 -3
- package/build/project/applicationIdentifier.js +6 -2
- package/build/run/android/aapt.d.ts +5 -0
- package/build/run/android/aapt.js +51 -0
- package/build/run/android/adb.d.ts +23 -0
- package/build/run/android/adb.js +120 -0
- package/build/run/android/emulator.d.ts +7 -0
- package/build/run/android/emulator.js +109 -0
- package/build/run/android/run.d.ts +1 -1
- package/build/run/android/run.js +10 -3
- package/build/run/android/sdk.d.ts +3 -0
- package/build/run/android/sdk.js +29 -0
- package/build/run/android/systemRequirements.d.ts +1 -0
- package/build/run/android/systemRequirements.js +24 -0
- package/build/run/ios/simulator.js +1 -1
- package/build/run/utils.d.ts +2 -0
- package/build/run/utils.js +20 -0
- package/build/submit/ArchiveSource.d.ts +20 -10
- package/build/submit/ArchiveSource.js +59 -60
- package/build/submit/BaseSubmitter.d.ts +4 -1
- package/build/submit/BaseSubmitter.js +20 -0
- package/build/submit/android/AndroidSubmitCommand.js +1 -2
- package/build/submit/android/AndroidSubmitter.d.ts +3 -3
- package/build/submit/android/AndroidSubmitter.js +12 -7
- package/build/submit/commons.d.ts +1 -1
- package/build/submit/commons.js +1 -16
- package/build/submit/ios/IosSubmitCommand.js +1 -2
- package/build/submit/ios/IosSubmitter.d.ts +3 -3
- package/build/submit/ios/IosSubmitter.js +11 -6
- package/build/submit/utils/files.js +2 -2
- package/build/submit/utils/summary.d.ts +2 -2
- package/build/submit/utils/summary.js +7 -8
- package/build/uploads.d.ts +4 -10
- package/build/uploads.js +16 -36
- package/build/utils/download.d.ts +3 -2
- package/build/utils/download.js +60 -36
- package/build/utils/paths.d.ts +7 -7
- package/build/utils/paths.js +3 -1
- package/build/utils/progress.d.ts +1 -1
- package/build/utils/progress.js +6 -4
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
|
@@ -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.MAIN', '-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(
|
|
1
|
+
export declare function runAppOnAndroidEmulatorAsync(appPath: string): Promise<void>;
|
package/build/run/android/run.js
CHANGED
|
@@ -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
|
|
6
|
-
|
|
7
|
-
|
|
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,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;
|
|
@@ -20,7 +20,7 @@ async function selectSimulatorAsync() {
|
|
|
20
20
|
message: `Select a simulator to run your app on`,
|
|
21
21
|
name: 'selectedSimulator',
|
|
22
22
|
choices: simulators.map(simulator => ({
|
|
23
|
-
title: `
|
|
23
|
+
title: `iOS ${simulator.osVersion} ${simulator.name}`,
|
|
24
24
|
value: simulator,
|
|
25
25
|
})),
|
|
26
26
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRunnableOnSimulatorOrEmulator = void 0;
|
|
4
|
+
const generated_1 = require("../graphql/generated");
|
|
5
|
+
function isAab(build) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
return (_c = (_b = (_a = build.artifacts) === null || _a === void 0 ? void 0 : _a.applicationArchiveUrl) === null || _b === void 0 ? void 0 : _b.endsWith('.aab')) !== null && _c !== void 0 ? _c : false;
|
|
8
|
+
}
|
|
9
|
+
function didArtifactsExpire(build) {
|
|
10
|
+
return new Date().getTime() - new Date(build.updatedAt).getTime() > 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
11
|
+
}
|
|
12
|
+
function isRunnableOnSimulatorOrEmulator(build) {
|
|
13
|
+
var _a;
|
|
14
|
+
return (build.status === generated_1.BuildStatus.Finished &&
|
|
15
|
+
!!((_a = build.artifacts) === null || _a === void 0 ? void 0 : _a.applicationArchiveUrl) &&
|
|
16
|
+
((build.platform === generated_1.AppPlatform.Ios && build.distribution === generated_1.DistributionType.Simulator) ||
|
|
17
|
+
(build.platform === generated_1.AppPlatform.Android && !isAab(build))) &&
|
|
18
|
+
!didArtifactsExpire(build));
|
|
19
|
+
}
|
|
20
|
+
exports.isRunnableOnSimulatorOrEmulator = isRunnableOnSimulatorOrEmulator;
|
|
@@ -7,14 +7,19 @@ export declare enum ArchiveSourceType {
|
|
|
7
7
|
latest = 1,
|
|
8
8
|
path = 2,
|
|
9
9
|
buildId = 3,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
build = 4,
|
|
11
|
+
buildList = 5,
|
|
12
|
+
prompt = 6,
|
|
13
|
+
gcs = 7
|
|
12
14
|
}
|
|
13
|
-
interface
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
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 {};
|