Skip to content

Commit fe61155

Browse files
committed
[eas-cli] log time that it took to complete the previous build in eas build:dev
1 parent 077d8b3 commit fe61155

File tree

4 files changed

+78
-24
lines changed

4 files changed

+78
-24
lines changed

packages/eas-cli/graphql.schema.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/eas-cli/src/commands/build/dev.ts

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEn
1111
import { runBuildAndSubmitAsync } from '../../build/runBuildAndSubmit';
1212
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
1313
import EasCommand from '../../commandUtils/EasCommand';
14-
import { BuildStatus, DistributionType } from '../../graphql/generated';
14+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
15+
import { BuildFragment, BuildStatus, DistributionType } from '../../graphql/generated';
1516
import { BuildQuery } from '../../graphql/queries/BuildQuery';
1617
import { toAppPlatform } from '../../graphql/types/AppPlatform';
1718
import Log from '../../log';
@@ -109,18 +110,11 @@ export default class BuildDev extends EasCommand {
109110
Log.log(`✨ Calculated fingerprint hash: ${fingerprint.hash}`);
110111
Log.newLine();
111112

112-
const builds = await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
113-
appId: projectId,
114-
filter: {
115-
platform: toAppPlatform(platform),
116-
fingerprintHash: fingerprint.hash,
117-
status: BuildStatus.Finished,
118-
simulator: platform === Platform.IOS ? true : undefined,
119-
distribution: platform === Platform.ANDROID ? DistributionType.Internal : undefined,
120-
developmentClient: true,
121-
},
122-
offset: 0,
123-
limit: 1,
113+
const builds = await this.getBuildsAsync({
114+
graphqlClient,
115+
projectId,
116+
platform,
117+
fingerprint,
124118
});
125119
if (builds.length !== 0) {
126120
const build = builds[0];
@@ -142,6 +136,22 @@ export default class BuildDev extends EasCommand {
142136

143137
Log.log('🚀 No successful build with matching fingerprint found. Starting a new build...');
144138

139+
const previousBuildsForSelectedProfile = await this.getBuildsAsync({
140+
graphqlClient,
141+
projectId,
142+
platform,
143+
});
144+
if (
145+
previousBuildsForSelectedProfile.length > 0 &&
146+
previousBuildsForSelectedProfile[0].metrics?.buildDuration
147+
) {
148+
Log.log(
149+
`🕒 Previous build for "${buildProfile.profileName}" profile completed in ${Math.floor(
150+
previousBuildsForSelectedProfile[0].metrics.buildDuration / 60000
151+
)} minutes.`
152+
);
153+
}
154+
145155
await runBuildAndSubmitAsync({
146156
graphqlClient,
147157
analytics,
@@ -294,4 +304,30 @@ export default class BuildDev extends EasCommand {
294304
});
295305
return buildProfile;
296306
}
307+
308+
private async getBuildsAsync({
309+
graphqlClient,
310+
projectId,
311+
platform,
312+
fingerprint,
313+
}: {
314+
graphqlClient: ExpoGraphqlClient;
315+
projectId: string;
316+
platform: Platform;
317+
fingerprint?: { hash: string };
318+
}): Promise<BuildFragment[]> {
319+
return await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
320+
appId: projectId,
321+
filter: {
322+
platform: toAppPlatform(platform),
323+
fingerprintHash: fingerprint?.hash,
324+
status: BuildStatus.Finished,
325+
simulator: platform === Platform.IOS ? true : undefined,
326+
distribution: platform === Platform.ANDROID ? DistributionType.Internal : undefined,
327+
developmentClient: true,
328+
},
329+
offset: 0,
330+
limit: 1,
331+
});
332+
}
297333
}

0 commit comments

Comments
 (0)