Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

move Paket.Pack() over to use flag arguments #1628

Merged
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
33 changes: 19 additions & 14 deletions src/app/FakeLib/PaketHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type PaketPackParams =
ExcludedTemplates : string list
WorkingDir : string
OutputPath : string
ProjectUrl : string
Symbols : bool
IncludeReferencedProjects : bool
MinimumFromLockFile : bool
Expand All @@ -37,6 +38,7 @@ let PaketPackDefaults() : PaketPackParams =
BuildConfig = null
BuildPlatform = null
TemplateFile = null
ProjectUrl = null
ExcludedTemplates = []
WorkingDir = "."
OutputPath = "./temp"
Expand Down Expand Up @@ -98,22 +100,25 @@ let Pack setParams =
let xmlEncode (notEncodedText : string) =
if String.IsNullOrWhiteSpace notEncodedText then ""
else XText(notEncodedText).ToString().Replace("ß", "ß")

let version = if String.IsNullOrWhiteSpace parameters.Version then "" else " version " + toParam parameters.Version
let releaseNotes = if String.IsNullOrWhiteSpace parameters.ReleaseNotes then "" else " releaseNotes " + toParam (xmlEncode parameters.ReleaseNotes)
let buildConfig = if String.IsNullOrWhiteSpace parameters.BuildConfig then "" else " buildconfig " + toParam parameters.BuildConfig
let buildPlatform = if String.IsNullOrWhiteSpace parameters.BuildPlatform then "" else " buildplatform " + toParam parameters.BuildPlatform
let templateFile = if String.IsNullOrWhiteSpace parameters.TemplateFile then "" else " templatefile " + toParam parameters.TemplateFile
let lockDependencies = if parameters.LockDependencies then " lock-dependencies" else ""
let excludedTemplates = parameters.ExcludedTemplates |> Seq.map (fun t -> " exclude " + t) |> String.concat " "
let specificVersions = parameters.SpecificVersions |> Seq.map (fun (id,v) -> sprintf " specific-version %s %s" id v) |> String.concat " "
let symbols = if parameters.Symbols then " symbols" else ""
let includeReferencedProjects = if parameters.IncludeReferencedProjects then " include-referenced-projects" else ""
let minimumFromLockFile = if parameters.MinimumFromLockFile then " minimum-from-lock-file" else ""
let pinProjectReferences = if parameters.PinProjectReferences then " pin-project-references" else ""
let version = if String.IsNullOrWhiteSpace parameters.Version then "" else " --version " + Process.toParam parameters.Version
let buildConfig = if String.IsNullOrWhiteSpace parameters.BuildConfig then "" else " --build-config " + Process.toParam parameters.BuildConfig
let buildPlatform = if String.IsNullOrWhiteSpace parameters.BuildPlatform then "" else " --build-platform " + Process.toParam parameters.BuildPlatform
let templateFile = if String.IsNullOrWhiteSpace parameters.TemplateFile then "" else " --template " + Process.toParam parameters.TemplateFile
let lockDependencies = if parameters.LockDependencies then " --lock-dependencies" else ""
let excludedTemplates = parameters.ExcludedTemplates |> Seq.map (fun t -> " --exclude " + t) |> String.concat " "
let specificVersions = parameters.SpecificVersions |> Seq.map (fun (id,v) -> sprintf " --specific-version %s %s" id v) |> String.concat " "
let releaseNotes = if String.IsNullOrWhiteSpace parameters.ReleaseNotes then "" else " --release-notes " + Process.toParam (xmlEncode parameters.ReleaseNotes)
let minimumFromLockFile = if parameters.MinimumFromLockFile then " --minimum-from-lock-file" else ""
let pinProjectReferences = if parameters.PinProjectReferences then " --pin-project-references" else ""
let symbols = if parameters.Symbols then " --symbols" else ""
let includeReferencedProjects = if parameters.IncludeReferencedProjects then " --include-referenced-projects" else ""
let projectUrl = if String.IsNullOrWhiteSpace parameters.ProjectUrl then "" else " --project-url " + Process.toParam parameters.ProjectUrl

let packResult =
let cmdArgs = sprintf "%s%s%s%s%s%s%s%s%s%s%s%s" version specificVersions releaseNotes buildConfig buildPlatform templateFile lockDependencies excludedTemplates symbols includeReferencedProjects minimumFromLockFile pinProjectReferences
let cmdArgs =
sprintf "%s%s%s%s%s%s%s%s%s%s%s%s%s"
version specificVersions releaseNotes buildConfig buildPlatform templateFile lockDependencies excludedTemplates
symbols includeReferencedProjects minimumFromLockFile pinProjectReferences projectUrl
ExecProcess
(fun info ->
info.FileName <- parameters.ToolPath
Expand Down