@@ -11,7 +11,8 @@ import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEn
11
11
import { runBuildAndSubmitAsync } from '../../build/runBuildAndSubmit' ;
12
12
import { ensureRepoIsCleanAsync } from '../../build/utils/repository' ;
13
13
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' ;
15
16
import { BuildQuery } from '../../graphql/queries/BuildQuery' ;
16
17
import { toAppPlatform } from '../../graphql/types/AppPlatform' ;
17
18
import Log from '../../log' ;
@@ -109,18 +110,11 @@ export default class BuildDev extends EasCommand {
109
110
Log . log ( `✨ Calculated fingerprint hash: ${ fingerprint . hash } ` ) ;
110
111
Log . newLine ( ) ;
111
112
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,
124
118
} ) ;
125
119
if ( builds . length !== 0 ) {
126
120
const build = builds [ 0 ] ;
@@ -142,6 +136,22 @@ export default class BuildDev extends EasCommand {
142
136
143
137
Log . log ( '🚀 No successful build with matching fingerprint found. Starting a new build...' ) ;
144
138
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
+
145
155
await runBuildAndSubmitAsync ( {
146
156
graphqlClient,
147
157
analytics,
@@ -294,4 +304,30 @@ export default class BuildDev extends EasCommand {
294
304
} ) ;
295
305
return buildProfile ;
296
306
}
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
+ }
297
333
}
0 commit comments