Skip to content

Commit

Permalink
Merge pull request #1516 from BlythMeister/ParallelFix
Browse files Browse the repository at this point in the history
Revert single thread build order change
  • Loading branch information
forki authored Apr 11, 2017
2 parents c80a4c6 + d4ac1a1 commit 8b9d63a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/app/FakeLib/TargetHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,14 @@ let run targetName =
tracefn "Building project with version: %s" buildVersion
PrintDependencyGraph false targetName

// determine a parallel build order
let order = determineBuildOrder targetName

let parallelJobs = environVarOrDefault "parallel-jobs" "1" |> int

// Figure out the order in in which targets can be run, and which can be run in parallel.
if parallelJobs > 1 then
tracefn "Running parallel build with %d workers" parallelJobs

// determine a parallel build order
let order = determineBuildOrder targetName
CurrentTargetOrder <- order |> List.map (fun targets -> targets |> Array.map (fun t -> t.Name) |> Array.toList)

PrintRunningOrder()
Expand All @@ -671,12 +671,15 @@ let run targetName =
runTargetsParallel parallelJobs par
else

let flatenedOrder = order |> List.map (fun targets -> targets |> Array.map (fun t -> t.Name) |> Array.toList) |> List.concat
CurrentTargetOrder <- flatenedOrder |> Seq.map (fun t -> [t]) |> Seq.toList

// Note: we could use the ordering resulting from flattening the result of determineBuildOrder
// for a single threaded build (thereby centralizing the algorithm for build order), but that
// ordering is inconsistent with earlier versions of FAKE.
let _, order = visitDependencies ignore targetName
CurrentTargetOrder <- order |> Seq.map (fun t -> [t]) |> Seq.toList

PrintRunningOrder()

runTargets (flatenedOrder |> Seq.map getTarget |> Seq.toArray)
runTargets (order |> Seq.map getTarget |> Seq.toArray)

finally
if errors <> [] then
Expand Down

0 comments on commit 8b9d63a

Please sign in to comment.