@@ -294,8 +294,7 @@ func (o *Orchestrator) DoCycle() {
294
294
}
295
295
296
296
func (o * Orchestrator ) buildOrClean () tsc.CommandLineResult {
297
- build := ! o .opts .Command .BuildOptions .Clean .IsTrue ()
298
- if build && o .opts .Command .BuildOptions .Verbose .IsTrue () {
297
+ if ! o .opts .Command .BuildOptions .Clean .IsTrue () && o .opts .Command .BuildOptions .Verbose .IsTrue () {
299
298
o .createBuilderStatusReporter (nil )(ast .NewCompilerDiagnostic (
300
299
diagnostics .Projects_in_this_build_Colon_0 ,
301
300
strings .Join (core .Map (o .Order (), func (p string ) string {
@@ -307,22 +306,12 @@ func (o *Orchestrator) buildOrClean() tsc.CommandLineResult {
307
306
if len (o .errors ) == 0 {
308
307
buildResult .statistics .Projects = len (o .Order ())
309
308
if o .opts .Command .CompilerOptions .SingleThreaded .IsTrue () {
310
- for _ , config := range o .Order () {
311
- path := o .toPath (config )
312
- task := o .getTask (path )
313
- o .buildOrCleanProject (task , path , & buildResult )
314
- }
309
+ o .singleThreadedBuildOrClean (& buildResult )
315
310
} else {
316
- wg := core .NewWorkGroup (false )
317
- o .tasks .Range (func (path tspath.Path , task * buildTask ) bool {
318
- wg .Queue (func () {
319
- o .buildOrCleanProject (task , path , & buildResult )
320
- })
321
- return true
322
- })
323
- wg .RunAndWait ()
311
+ o .multiThreadedBuildOrClean (& buildResult )
324
312
}
325
313
} else {
314
+ // Circularity errors prevent any project from being built
326
315
buildResult .result .Status = tsc .ExitStatusProjectReferenceCycle_OutputsSkipped
327
316
reportDiagnostic := o .createDiagnosticReporter (nil )
328
317
for _ , err := range o .errors {
@@ -334,6 +323,27 @@ func (o *Orchestrator) buildOrClean() tsc.CommandLineResult {
334
323
return buildResult .result
335
324
}
336
325
326
+ func (o * Orchestrator ) singleThreadedBuildOrClean (buildResult * orchestratorResult ) {
327
+ // Go in the order since only one project can be built at a time so that random order isnt picked by work group creating deadlock
328
+ for _ , config := range o .Order () {
329
+ path := o .toPath (config )
330
+ task := o .getTask (path )
331
+ o .buildOrCleanProject (task , path , buildResult )
332
+ }
333
+ }
334
+
335
+ func (o * Orchestrator ) multiThreadedBuildOrClean (buildResult * orchestratorResult ) {
336
+ // Spin off the threads with waiting on upstream to build before actual project build
337
+ wg := core .NewWorkGroup (false )
338
+ o .tasks .Range (func (path tspath.Path , task * buildTask ) bool {
339
+ wg .Queue (func () {
340
+ o .buildOrCleanProject (task , path , buildResult )
341
+ })
342
+ return true
343
+ })
344
+ wg .RunAndWait ()
345
+ }
346
+
337
347
func (o * Orchestrator ) buildOrCleanProject (task * buildTask , path tspath.Path , buildResult * orchestratorResult ) {
338
348
task .result = & taskResult {}
339
349
task .result .reportStatus = o .createBuilderStatusReporter (task )
0 commit comments