Skip to content

Commit

Permalink
Merge branch 'release/next' of github.com:fsharp/FAKE into release/next
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Jun 27, 2020
2 parents 812f32f + 3cf20c1 commit d91b3df
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type Docopt(doc', ?soptChars':string) =
|> addKey opt.DefaultValue opt.FullLong
|> addKey opt.DefaultValue opt.FullShort
) map) result
member this.Parse(argv':#seq<string>) = this.Parse(argv' |> Seq.toArray)

member __.Usage = String.Join("\n", uStrs)
member __.UsageParser = pusage
5 changes: 4 additions & 1 deletion src/app/Fake.DotNet.Cli/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ module DotNet =
|> List.concat
|> List.filter (not << String.IsNullOrEmpty)

/// nuget push paramters for `dotnet nuget push`
/// nuget push parameters for `dotnet nuget push`
type NuGetPushOptions =
{ Common: Options
PushParams: NuGet.NuGetPushParams }
Expand Down Expand Up @@ -1681,6 +1681,9 @@ module DotNet =
use __ = Trace.traceTask "DotNet:nuget:push" nupkg
let param = NuGetPushOptions.Create() |> setParams
let pushParams = param.PushParams
pushParams.ApiKey |> Option.iter (fun key -> TraceSecrets.register "<ApiKey>" key)
pushParams.SymbolApiKey |> Option.iter (fun key -> TraceSecrets.register "<SymbolApiKey>" key)

let args = Args.toWindowsCommandLine (nupkg :: buildNugetPushArgs pushParams)
let result = exec (fun _ -> param.Common) "nuget push" args

Expand Down
8 changes: 4 additions & 4 deletions src/app/Fake.DotNet.NuGet/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ let private propertiesParam = function

/// Creates a NuGet package without templating (including symbols package if enabled)
let private pack parameters nuspecFile =
TraceSecrets.register parameters.AccessKey "<NuGetKey>"
TraceSecrets.register parameters.SymbolAccessKey "<NuGetSymbolKey>"
TraceSecrets.register "<NuGetKey>" parameters.AccessKey
TraceSecrets.register "<NuGetSymbolKey>" parameters.SymbolAccessKey
let nuspecFile = Path.getFullName nuspecFile
let properties = propertiesParam parameters.Properties
let basePath = parameters.BasePath |> Option.map (sprintf "-BasePath \"%s\"") |> Option.defaultValue ""
Expand Down Expand Up @@ -433,8 +433,8 @@ let internal toPushCliArgs param =
|> List.filter (not << String.IsNullOrEmpty)

let rec private push (options : ToolOptions) (parameters : NuGetPushParams) nupkg =
parameters.ApiKey |> Option.iter (fun key -> TraceSecrets.register key "<NuGetKey>")
parameters.SymbolApiKey |> Option.iter (fun key -> TraceSecrets.register key "<NuGetSymbolKey>")
parameters.ApiKey |> Option.iter (fun key -> TraceSecrets.register "<NuGetKey>" key)
parameters.SymbolApiKey |> Option.iter (fun key -> TraceSecrets.register "<NuGetSymbolKey>" key)

let pushArgs = parameters |> toPushCliArgs |> Args.toWindowsCommandLine
let args = sprintf "%s \"%s\" %s" options.Command nupkg pushArgs
Expand Down
6 changes: 3 additions & 3 deletions src/app/Fake.DotNet.NuGet/NuGetVersion.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ type NuGetVersionIncrement = SemVerInfo -> SemVerInfo
/// Increment patch version
let IncPatch:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=(v.Patch+1u) }
{ v with Build=0I; Patch=(v.Patch+1u); Original = None }

/// Increment minor version
let IncMinor:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=0u; Minor=(v.Minor+1u) }
{ v with Build=0I; Patch=0u; Minor=(v.Minor+1u); Original = None }

/// Increment major version
let IncMajor:NuGetVersionIncrement =
fun (v:SemVerInfo) ->
{ v with Build=0I; Patch=0u; Minor=0u; Major=(v.Major+1u) }
{ v with Build=0I; Patch=0u; Minor=0u; Major=(v.Major+1u); Original = None }

/// Arguments for the next NuGet version number computing
type NuGetVersionArg =
Expand Down
6 changes: 3 additions & 3 deletions src/app/Fake.DotNet.Paket/Paket.fs
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ let pack setParams =
let pushFiles setParams files =
let parameters : PaketPushParams = PaketPushDefaults() |> setParams

TraceSecrets.register parameters.ApiKey "<PaketApiKey>"
TraceSecrets.register "<PaketApiKey>" parameters.ApiKey
match Environment.environVarOrNone "nugetkey" with
| Some k -> TraceSecrets.register k "<PaketApiKey>"
| Some k -> TraceSecrets.register "<PaketApiKey>" k
| None -> ()
match Environment.environVarOrNone "nuget-key" with
| Some k -> TraceSecrets.register k "<PaketApiKey>"
| Some k -> TraceSecrets.register "<PaketApiKey>" k
| None -> ()

let packages = Seq.toList files
Expand Down
13 changes: 13 additions & 0 deletions src/test/Fake.Core.UnitTests/Fake.DotNet.NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Fake.DotNet.NuGetTests

open Fake.Core
open Fake.DotNet.NuGet
open Fake.DotNet.NuGet.Version
open Expecto

[<Tests>]
Expand Down Expand Up @@ -36,5 +37,17 @@ let tests =
let expected = "-ApiKey abc123 -DisableBuffering -NoSymbols -NoServiceEndpoint -Source MyNuGetSource -SymbolApiKey MySymbolApiKey -SymbolSource MySymbolSource -Timeout 360"

Expect.equal cli expected "Push args generated correctly."

test "Incrementing Patch for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.0") |> IncPatch |> string) "1.1.1" "Incremented Patch from 1.1.0 should be 1.1.1"
}

test "Incrementing Minor for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.1") |> IncMinor |> string) "1.2.0" "Incremented Minor from 1.1.1 should be 1.2.0"
}

test "Incrementing Major for a SemVerInfo" {
Expect.equal (SemVer.parse("1.1.1") |> IncMajor |> string) "2.0.0" "Incremented Patch from 1.1.1 should be 2.0.0"
}
]

0 comments on commit d91b3df

Please sign in to comment.