Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow to run paket push in parallel #768

Merged
merged 1 commit into from
Apr 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions src/app/FakeLib/PaketHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type PaketPushParams =
PublishUrl : string
EndPoint : string
WorkingDir : string
RunInParallel : bool
ApiKey : string }

/// Paket push default parameters
Expand All @@ -40,6 +41,7 @@ let PaketPushDefaults() : PaketPushParams =
PublishUrl = null
EndPoint = null
WorkingDir = "./temp"
RunInParallel = true
ApiKey = null }

/// Creates a new NuGet package by using Paket pack on all paket.template files in the working directory.
Expand Down Expand Up @@ -79,10 +81,23 @@ let Push setParams =
let key = if String.IsNullOrWhiteSpace parameters.ApiKey then "" else " apikey " + toParam parameters.ApiKey

traceStartTask "PaketPush" (separated ", " packages)
for package in packages do
let pushResult =
ExecProcess (fun info ->
info.FileName <- parameters.ToolPath
info.Arguments <- sprintf "push %s%s%s file %s" url endpoint key (toParam package)) System.TimeSpan.MaxValue
if pushResult <> 0 then failwithf "Error during pushing %s." package

let tasks =
packages
|> Seq.toArray
|> Array.map (fun package -> async {
let pushResult =
ExecProcess (fun info ->
info.FileName <- parameters.ToolPath
info.Arguments <- sprintf "push %s%s%s file %s" url endpoint key (toParam package)) System.TimeSpan.MaxValue
if pushResult <> 0 then failwithf "Error during pushing %s." package })

if parameters.RunInParallel then
Async.Parallel tasks
|> Async.RunSynchronously
|> ignore
else
for task in tasks do
Async.RunSynchronously task

traceEndTask "PaketPush" (separated ", " packages)