@@ -52,7 +52,7 @@ type MakeContext = {
52
52
dir : string ;
53
53
forgeConfig : ResolvedForgeConfig ;
54
54
actualOutDir : string ;
55
- makers : MakerBase < unknown > [ ] ;
55
+ makers : Array < ( ) => MakerBase < unknown > > ;
56
56
outputs : ForgeMakeResult [ ] ;
57
57
} ;
58
58
@@ -134,7 +134,7 @@ export const listrMake = (
134
134
}
135
135
136
136
// eslint-disable-next-line @typescript-eslint/no-explicit-any
137
- const makers : MakerBase < any > [ ] = [ ] ;
137
+ const makers : Array < ( ) => MakerBase < any > > = [ ] ;
138
138
139
139
const possibleMakers = generateTargets ( forgeConfig , overrideTargets ) ;
140
140
@@ -182,7 +182,7 @@ export const listrMake = (
182
182
183
183
maker . ensureExternalBinariesExist ( ) ;
184
184
185
- makers . push ( maker ) ;
185
+ makers . push ( ( ) => maker . clone ( ) ) ;
186
186
}
187
187
188
188
if ( makers . length === 0 ) {
@@ -234,6 +234,7 @@ export const listrMake = (
234
234
235
235
const subRunner = task . newListr ( [ ] , {
236
236
...listrOptions ,
237
+ concurrent : true ,
237
238
rendererOptions : {
238
239
collapse : false ,
239
240
collapseErrors : false ,
@@ -247,25 +248,13 @@ export const listrMake = (
247
248
}
248
249
249
250
for ( const maker of makers ) {
251
+ const uniqMaker = maker ( ) ;
250
252
subRunner . add ( {
251
- title : `Making a ${ chalk . magenta ( maker . name ) } distributable for ${ chalk . cyan ( `${ platform } /${ targetArch } ` ) } ` ,
253
+ title : `Making a ${ chalk . magenta ( uniqMaker . name ) } distributable for ${ chalk . cyan ( `${ platform } /${ targetArch } ` ) } ` ,
252
254
task : async ( ) => {
253
255
try {
254
- /**
255
- * WARNING: DO NOT ATTEMPT TO PARALLELIZE MAKERS
256
- *
257
- * Currently it is assumed we have 1 maker per make call but that is
258
- * not enforced. It is technically possible to have 1 maker be called
259
- * multiple times. The "prepareConfig" method however implicitly
260
- * requires a lock that is not enforced. There are two options:
261
- *
262
- * * Provide makers a getConfig() method
263
- * * Remove support for config being provided as a method
264
- * * Change the entire API of maker from a single constructor to
265
- * providing a MakerFactory
266
- */
267
- await Promise . resolve ( maker . prepareConfig ( targetArch ) ) ;
268
- const artifacts = await maker . make ( {
256
+ await Promise . resolve ( uniqMaker . prepareConfig ( targetArch ) ) ;
257
+ const artifacts = await uniqMaker . make ( {
269
258
appName,
270
259
forgeConfig,
271
260
packageJSON,
@@ -285,7 +274,7 @@ export const listrMake = (
285
274
if ( err ) {
286
275
throw err ;
287
276
} else {
288
- throw new Error ( `An unknown error occurred while making for target: ${ maker . name } ` ) ;
277
+ throw new Error ( `An unknown error occurred while making for target: ${ uniqMaker . name } ` ) ;
289
278
}
290
279
}
291
280
} ,
0 commit comments