mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0794dba24 | ||
|
|
fbfdd60576 | ||
|
|
4dd41e1765 |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@expo/build-tools': minor
|
||||
---
|
||||
|
||||
Report the identifier of the installed app as `applicationIdentifier` in the agent-device remote config, so clients can attach to the app of an `application_archive_url` session.
|
||||
+30
@@ -201,6 +201,36 @@ describe('runAgentDeviceRemoteSessionAsync orchestration', () => {
|
||||
expect(mockDaemonStopAsync).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
BuildRuntimePlatform.DARWIN,
|
||||
{
|
||||
iosSimulatorUdid: 'selected-udid',
|
||||
application: Promise.resolve({
|
||||
installAppPath: '/tmp/App.app',
|
||||
launchAppIdentifier: 'com.example.archive',
|
||||
}),
|
||||
},
|
||||
],
|
||||
[
|
||||
BuildRuntimePlatform.LINUX,
|
||||
{ booted: Promise.resolve(), ready: Promise.resolve('com.example.archive') },
|
||||
],
|
||||
])(
|
||||
'reports the identifier of the app the %s device launched',
|
||||
async (runtimePlatform, device) => {
|
||||
const logger = { info: jest.fn(), warn: jest.fn(), child: jest.fn().mockReturnThis() };
|
||||
|
||||
await runAsync(logger, runtimePlatform, { device });
|
||||
|
||||
expect(uploadRemoteSessionConfigAsync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
remoteConfig: expect.objectContaining({ applicationIdentifier: 'com.example.archive' }),
|
||||
})
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('uses the warm daemon after adoption and starts no daemon of its own', async () => {
|
||||
const logger = { info: jest.fn(), warn: jest.fn(), child: jest.fn().mockReturnThis() };
|
||||
const warmServer = { port: 3200 } as never;
|
||||
|
||||
@@ -468,6 +468,10 @@ describe(createStartAgentDeviceSessionBuildFunction, () => {
|
||||
expect(launchApplicationAsync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ applicationIdentifier: 'dev.example.app', activityName: '.Main' })
|
||||
);
|
||||
// The remote session reports it so clients can attach to an archive session's app.
|
||||
await expect((sessionDevice() as { ready: Promise<unknown> }).ready).resolves.toBe(
|
||||
'dev.example.app'
|
||||
);
|
||||
});
|
||||
|
||||
it('does not start work for an already cancelled step', async () => {
|
||||
|
||||
@@ -125,7 +125,8 @@ export async function runAgentDeviceRemoteSessionAsync(
|
||||
device:
|
||||
| {
|
||||
booted: Promise<unknown>;
|
||||
ready: Promise<unknown>;
|
||||
/** Resolves with the identifier of the app it installed, if any. */
|
||||
ready: Promise<string | void>;
|
||||
}
|
||||
| {
|
||||
iosSimulatorUdid: string;
|
||||
@@ -242,6 +243,7 @@ export async function runAgentDeviceRemoteSessionAsync(
|
||||
const [
|
||||
{ port: daemonPort, token: daemonToken, remoteSessionUrl: agentDeviceRemoteSessionUrl },
|
||||
webPreview,
|
||||
installedApplicationIdentifier,
|
||||
] = await Promise.all([agentDeviceStartup, sessionHostStartup, deviceReady]).catch(
|
||||
(err: unknown) => {
|
||||
// Also aborts for a `device.ready` that does not come from `tasks.run`.
|
||||
@@ -251,6 +253,11 @@ export async function runAgentDeviceRemoteSessionAsync(
|
||||
);
|
||||
tasks.signal.throwIfAborted();
|
||||
logger.info(tasks.summary());
|
||||
// Reported so clients can attach to the app of a session with no build record, like an
|
||||
// `application_archive_url` one. The session host already launched the iOS app.
|
||||
const applicationIdentifier = hostBootedDevice?.application
|
||||
? (await tasks.untilAborted(hostBootedDevice.application))?.launchAppIdentifier
|
||||
: installedApplicationIdentifier;
|
||||
|
||||
const sessionStart = await uploadRemoteSessionConfigWithLocalEgressAsync({
|
||||
env,
|
||||
@@ -263,6 +270,7 @@ export async function runAgentDeviceRemoteSessionAsync(
|
||||
webPreviewUrl: webPreview.previewPageUrl,
|
||||
previewApiUrl: webPreview.apiUrl,
|
||||
...(webPreview.previewToken ? { webPreviewToken: webPreview.previewToken } : {}),
|
||||
...(applicationIdentifier ? { applicationIdentifier } : {}),
|
||||
},
|
||||
logger,
|
||||
});
|
||||
|
||||
@@ -211,6 +211,7 @@ export function createStartAgentDeviceSessionBuildFunction(
|
||||
let sessionOwnsTeardown = false;
|
||||
let downloaded: Promise<string> | undefined;
|
||||
let applicationReady: Promise<ServeSimApplicationOptions | void> | undefined;
|
||||
let installedAndroidApplication: Promise<string> | undefined;
|
||||
|
||||
try {
|
||||
if (isIos) {
|
||||
@@ -305,7 +306,7 @@ export function createStartAgentDeviceSessionBuildFunction(
|
||||
installAppPath,
|
||||
});
|
||||
} else if (!isIos && (installAppPath || downloadedApp)) {
|
||||
applicationReady = tasks.run('app install and launch', async taskLogger => {
|
||||
installedAndroidApplication = tasks.run('app install and launch', async taskLogger => {
|
||||
await tasks.untilAborted(booted!);
|
||||
const artifactPath = installAppPath ?? (await downloadedApp);
|
||||
if (!artifactPath) {
|
||||
@@ -328,6 +329,7 @@ export function createStartAgentDeviceSessionBuildFunction(
|
||||
env,
|
||||
logger: taskLogger,
|
||||
});
|
||||
return applicationIdentifier;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -358,7 +360,7 @@ export function createStartAgentDeviceSessionBuildFunction(
|
||||
}
|
||||
: {
|
||||
booted,
|
||||
ready: applicationReady ?? tasks.untilAborted(booted),
|
||||
ready: installedAndroidApplication ?? tasks.untilAborted(booted),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -372,7 +374,12 @@ export function createStartAgentDeviceSessionBuildFunction(
|
||||
throw error;
|
||||
} finally {
|
||||
tasks.abort(new Error('Agent-device session ended.'));
|
||||
await Promise.allSettled([booted, downloaded, applicationReady]);
|
||||
await Promise.allSettled([
|
||||
booted,
|
||||
downloaded,
|
||||
applicationReady,
|
||||
installedAndroidApplication,
|
||||
]);
|
||||
}
|
||||
};
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user