Skip to content

Commit

Permalink
Release 5.14.0 (#2318)
Browse files Browse the repository at this point in the history
Release 5.14.0
  • Loading branch information
matthid authored Jun 12, 2019
2 parents 36b81bc + 6008dc2 commit 2db6e13
Show file tree
Hide file tree
Showing 57 changed files with 933 additions and 618 deletions.
10 changes: 10 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release Notes

## 5.14.0 - 2019-06-12

* BREAKING: Renamed `CliVersion.Lkg` to `CliVersion.Coherent` as it was renamed on the installer. If you use an old installer with this flag you can still use `CliVersion.Version "lkg"` - https://github.com/fsharp/FAKE/pull/2318
* BREAKING: Renamed `NuGet.feedUrl` to `NuGet.galleryV1` and marked it as obsolete. Added `galleryV2` and `galleryV3` - https://github.com/fsharp/FAKE/issues/2323
* ENHANCEMENT: Fake 5 now supports native libraries (like SQL and SQLite NuGet packages) - https://github.com/fsharp/FAKE/issues/2007
* BUGFIX: DotNet.exec (dotnet installer) fails when username has a blank - https://github.com/fsharp/FAKE/issues/2319
* BUGFIX: Error when invoking fake run with different casings - https://github.com/fsharp/FAKE/issues/2314
* BUGFIX: Potential fix for incorrect console colors after running fake - https://github.com/fsharp/FAKE/issues/2173
* DOCS: Document difference between `@@` and `</>` as well as `Path.combineTrimEnd` and `Path.combine` - https://github.com/fsharp/FAKE/issues/2329

## 5.13.7 - 2019-05-11

* BUGFIX: Xamarin Android x86_64 build fails - https://github.com/fsharp/FAKE/issues/2313
Expand Down
8 changes: 5 additions & 3 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ if buildLegacy then

// Release stuff ('FastRelease' is to release after running 'Default')
(if fromArtifacts then "PrepareArtifacts" else "EnsureTestsRun")
=?> ("DotNetCorePushChocolateyPackage", Environment.isWindows)
=?> ("DotNetCorePushChocolateyPackage", Environment.isWindows && chocosource <> "disabled")
==> "FastRelease"
"EnsureTestsRun" ?=> "DotNetCorePushChocolateyPackage"

Expand All @@ -1309,9 +1309,11 @@ if buildLegacy then
"EnsureTestsRun" ?=> "ReleaseDocs"

(if fromArtifacts then "PrepareArtifacts" else "EnsureTestsRun")
==> "DotNetCorePushNuGet"
=?> ("DotNetCorePushNuGet", nugetsource <> "disabled")
==> "FastRelease"
"EnsureTestsRun" ?=> "DotNetCorePushNuGet"

if nugetsource <> "disabled" then
ignore ("EnsureTestsRun" ?=> "DotNetCorePushNuGet")


// Gitlab staging (myget release)
Expand Down
16 changes: 16 additions & 0 deletions help/markdown/core-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ CreateProcess.fromRawCommandLine "./folder/mytool.exe" "arg1 arg2 arg3"
```

Or use some FAKE helpers:

```fsharp
open Fake.Core
Arguments.Empty
|> Arguments.appendIf true "-Verbose"
|> Arguments.appendNotEmpty "-Channel" channelParamValue
|> Arguments.appendNotEmpty "-Version" versionParamValue
|> Arguments.appendOption "-Architecture" architectureParamValue
|> Arguments.appendNotEmpty "-InstallDir" (defaultArg param.CustomInstallDir defaultUserInstallDir)
|> Arguments.appendIf param.DebugSymbols "-DebugSymbols"
|> Arguments.appendIf param.DryRun "-DryRun"
|> Arguments.appendIf param.NoPath "-NoPath"
```

Or use helper libraries like [`BlackFox.CommandLine`](https://github.com/vbfox/FoxSharp/tree/master/src/BlackFox.CommandLine):

```fsharp
Expand Down
23 changes: 23 additions & 0 deletions integrationtests/i002007-native-libs/before/build.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#r "paket:
nuget Fake.Core.Target
nuget System.Data.SQLite.Core //"
#load "./.fake/build.fsx/intellisense.fsx"

open Fake.Core
open System.Data.SQLite

let openConn (path:string) =
let builder = SQLiteConnectionStringBuilder()
builder.DataSource <- path
let conn = new SQLiteConnection(builder.ToString())
conn.OpenAndReturn()

// Default target
Target.create "Default" (fun _ ->
Trace.trace "Hello World from FAKE"
use conn = openConn "temp.db"
()
)

// start build
Target.runOrDefault "Default"
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ group netcore
nuget System.Runtime.Loader
nuget System.IO.FileSystem.Watcher
nuget System.Data.SqlClient
nuget Microsoft.SqlServer.SqlManagementObjects
nuget Microsoft.SqlServer.SqlManagementObjects
784 changes: 395 additions & 389 deletions paket.lock

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/app/Fake.Core.Process/CmdLineParsing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,66 @@ type Arguments =

/// This is the reverse of https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
member x.ToWindowsCommandLine = Args.toWindowsCommandLine x.Args// |> CmdLine.toString
/// Escape the given argument list according to a unix shell (bash)
member x.ToLinuxShellCommandLine = Args.toLinuxShellCommandLine x.Args// |> CmdLine.toList |> Args.toLinuxShellCommandLine

/// Create a new arguments object from the given list of arguments
static member OfArgs (args:string seq) = { Args = args |> Seq.toArray; Original = None }

/// Create a new arguments object from a given startinfo-conforming-escaped command line string.
/// Same as `OfWindowsCommandLine`.
static member OfStartInfo cmd = Arguments.OfWindowsCommandLine cmd

/// Create a new command line string which can be used in a ProcessStartInfo object.
/// If given, returns the exact input of `OfWindowsCommandLine` otherwise `ToWindowsCommandLine` (with some special code for `mono`) is used.
member x.ToStartInfo =
match x.Original with
| Some orig -> orig
| None ->
CmdLineParsing.toProcessStartInfo x.Args

/// Module for working with an `Arguments` instance
module Arguments =
/// This is the reverse of https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
let toWindowsCommandLine (a:Arguments) = a.ToWindowsCommandLine
/// Escape the given argument list according to a unix shell (bash)
let toLinuxShellCommandLine (a:Arguments) = a.ToLinuxShellCommandLine
/// Create a new command line string which can be used in a ProcessStartInfo object.
/// If given, returns the exact input of `OfWindowsCommandLine` otherwise `ToWindowsCommandLine` (with some special code for `mono`) is used.
let toStartInfo (a:Arguments) = a.ToStartInfo

/// Append the given arguments before all current arguments
let withPrefix (s:string seq) (a:Arguments) =
Arguments.OfArgs(Seq.append s a.Args)
/// Append all arguments after the current arguments
let append s (a:Arguments) =
Arguments.OfArgs(Seq.append a.Args s)

/// Append an argument prefixed by another if the value is Some.
let appendOption (paramName:string) (paramValue:string option) (a:Arguments) =
match paramValue with
| Some x -> a |> append [ paramName; x ]
| None -> a

/// Append an argument to a command line if a condition is true.
let appendIf value paramName (a:Arguments) =
if value then a |> append [ paramName ]
else a

/// Append an argument prefixed by another if the value is not null or empty
let appendNotEmpty paramName paramValue (a:Arguments) =
if String.isNullOrEmpty paramValue then a
else a |> append [ paramName; paramValue ]

/// Convert the arguments instance to a string list
let toList (a:Arguments) =
a.Args |> Array.toList

/// Convert the arguments instance to a string array
let toArray (a:Arguments) =
a.Args |> Array.toList |> Seq.toArray

/// Create a arguments instance from a list.
let ofList (a:string list) =
{ Args = a |> Seq.toArray; Original = None }

Expand Down
6 changes: 3 additions & 3 deletions src/app/Fake.Core.Process/Process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ module Process =
let UseDefaults = id

/// [omit]
[<Obsolete "Use the Arguments and Args modules/types instead">]
[<Obsolete "Use the Arguments.appendNotEmpty and the Args modules/types instead.">]
let stringParam (paramName, paramValue) =
if String.isNullOrEmpty paramValue then None
else Some(paramName, paramValue)
Expand All @@ -719,14 +719,14 @@ module Process =
let multipleStringParams paramName = Seq.map (fun x -> stringParam (paramName, x)) >> Seq.toList

/// [omit]
[<Obsolete "Use the Arguments and Args modules/types instead">]
[<Obsolete "Use the Arguments.appendOption and Args modules/types instead">]
let optionParam (paramName, paramValue) =
match paramValue with
| Some x -> Some(paramName, x.ToString())
| None -> None

/// [omit]
[<Obsolete "Use the Arguments and Args modules/types instead">]
[<Obsolete "Use the Arguments.appendIf and Args modules/types instead">]
let boolParam (paramName, paramValue) =
if paramValue then Some(paramName, null)
else None
Expand Down
86 changes: 53 additions & 33 deletions src/app/Fake.DotNet.Cli/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,18 @@ module DotNet =
type InstallerOptions =
{
/// Always download install script (otherwise install script is cached in temporary folder)
AlwaysDownload: bool;
AlwaysDownload: bool
/// Download installer from this github branch
Branch: string;
Branch: string
// Use the given directory to download the script into. If None the temp-dir is used
CustomDownloadDir: string option
}

/// Parameter default values.
static member Default = {
AlwaysDownload = false
Branch = "master"
CustomDownloadDir = None
}

/// Download .NET Core SDK installer
Expand All @@ -152,14 +155,16 @@ module DotNet =
let getInstallerUrl = if Environment.isUnix then getBashDotNetCliInstallerUrl else getPowershellDotNetCliInstallerUrl
let scriptName =
sprintf "dotnet_install_%s.%s" (md5 (Encoding.ASCII.GetBytes(param.Branch))) ext
let tempInstallerScript = Path.GetTempPath() @@ scriptName
let tempDir =
match param.CustomDownloadDir with
| None -> Path.GetTempPath()
| Some d -> d
let tempInstallerScript = tempDir @@ scriptName

// maybe download installer script
match param.AlwaysDownload || not(File.Exists(tempInstallerScript)) with
| true ->
let url = getInstallerUrl param.Branch
downloadDotNetInstallerFromUrl url tempInstallerScript
| _ -> ()
if param.AlwaysDownload || not(File.Exists(tempInstallerScript)) then
let url = getInstallerUrl param.Branch
downloadDotNetInstallerFromUrl url tempInstallerScript

tempInstallerScript

Expand All @@ -173,11 +178,11 @@ module DotNet =

/// .NET Core SDK version (used to specify version when installing .NET Core SDK)
type CliVersion =
/// most latest build on specific channel
/// Latest build on the channel (used with the -Channel option).
| Latest
/// last known good version on specific channel (Note: LKG work is in progress. Once the work is finished, this will become new default)
| Lkg
/// 4-part version in a format A.B.C.D - represents specific version of build
/// Latest coherent build on the channel; uses the latest stable package combination (used with Branch name -Channel options).
| Coherent
/// Three-part version in X.Y.Z format representing a specific build version; supersedes the -Channel option. For example: 2.0.0-preview2-006120.
| Version of string
/// Take version from global.json and fail if it is not found.
| GlobalJson
Expand All @@ -189,12 +194,20 @@ module DotNet =
{
/// Custom installer obtain (download) options
InstallerOptions: InstallerOptions -> InstallerOptions
/// .NET Core SDK channel (defaults to normalized installer branch)
/// Specifies the source channel for the installation. The possible values are:
/// - `Current` - Most current release.
/// - `LTS` - Long-Term Support channel (most current supported release).
/// - Two-part version in `X.Y` format representing a specific release (for example, `2.0` or `1.0`).
/// - Branch name. For example, release/2.0.0, release/2.0.0-preview2, or master (for nightly releases).
///
/// The default value is `LTS`. For more information on .NET support channels, see the .NET Support Policy page.
Channel: string option
/// .NET Core SDK version
Version: CliVersion
/// Custom installation directory (for local build installation)
CustomInstallDir: string option
/// Always download and run the installer, ignore potentiall existing installations.
ForceInstall : bool
/// Architecture
Architecture: CliArchitecture
/// Include symbols in the installation (Switch does not work yet. Symbols zip is not being uploaded yet)
Expand All @@ -211,6 +224,7 @@ module DotNet =
Channel = None
Version = Latest
CustomInstallDir = None
ForceInstall = false
Architecture = Auto
DebugSymbols = false
DryRun = false
Expand Down Expand Up @@ -441,7 +455,7 @@ module DotNet =
let versionParamValue =
match param.Version with
| Latest -> "latest"
| Lkg -> "lkg"
| Coherent -> "coherent"
| Version ver -> ver
| GlobalJson -> getSDKVersionFromGlobalJson()

Expand All @@ -458,17 +472,16 @@ module DotNet =
| Auto -> None
| X86 -> Some "x86"
| X64 -> Some "x64"
[
Process.boolParam ("Verbose", true)
Process.stringParam ("Channel", channelParamValue)
Process.stringParam ("Version", versionParamValue)
Process.optionParam ("Architecture", architectureParamValue)
Process.stringParam ("InstallDir", defaultArg param.CustomInstallDir defaultUserInstallDir)
Process.boolParam ("DebugSymbols", param.DebugSymbols)
Process.boolParam ("DryRun", param.DryRun)
Process.boolParam ("NoPath", param.NoPath)
] |> Process.parametersToString "-" " "

Arguments.Empty
|> Arguments.appendIf true "-Verbose"
|> Arguments.appendNotEmpty "-Channel" channelParamValue
|> Arguments.appendNotEmpty "-Version" versionParamValue
|> Arguments.appendOption "-Architecture" architectureParamValue
|> Arguments.appendNotEmpty "-InstallDir" (defaultArg param.CustomInstallDir defaultUserInstallDir)
|> Arguments.appendIf param.DebugSymbols "-DebugSymbols"
|> Arguments.appendIf param.DryRun "-DryRun"
|> Arguments.appendIf param.NoPath "-NoPath"

/// dotnet restore verbosity
type Verbosity =
Expand Down Expand Up @@ -812,11 +825,12 @@ module DotNet =
let checkVersion, fromGlobalJson =
match param.Version with
| Version version -> Some version, false
| CliVersion.Lkg -> None, false
| CliVersion.Coherent -> None, false
| CliVersion.Latest -> None, false
| CliVersion.GlobalJson -> Some (getSDKVersionFromGlobalJson()), true

let dotnetInstallations = findPossibleDotnetCliPaths (Some dir)
let dotnetInstallations =
if param.ForceInstall then Seq.empty else findPossibleDotnetCliPaths (Some dir)

let existingDotNet =
match checkVersion with
Expand Down Expand Up @@ -864,21 +878,27 @@ module DotNet =
()
let exitCode =
let args, fileName =
let installArgs = buildDotNetCliInstallArgs param
if Environment.isUnix then
let args = sprintf "%s %s" installScript (buildDotNetCliInstallArgs param)
let args = installArgs |> Arguments.withPrefix [ installScript ]
args, "bash" // Otherwise we need to set the executable flag!
else
let command = installArgs |> Arguments.withPrefix [ installScript ]
let args =
sprintf
"-ExecutionPolicy Bypass -NoProfile -NoLogo -NonInteractive -Command \"%s %s; if (-not $?) { exit -1 };\""
installScript
(buildDotNetCliInstallArgs param)
Arguments.Empty
|> Arguments.appendNotEmpty "-ExecutionPolicy" "ByPass"
|> Arguments.appendIf true "-NoProfile"
|> Arguments.appendIf true "-NoLogo"
|> Arguments.appendIf true "-NonInteractive"
// Note: The & is required when the script path contains spaces, see https://stackoverflow.com/questions/45760457/how-to-run-a-powershell-script-with-white-spaces-in-path-from-command-line
// powershell really is a waste of time
|> Arguments.appendNotEmpty "-Command" (sprintf "& %s; if (-not $?) { exit -1 };" command.ToWindowsCommandLine)
args, "powershell"
Process.execSimple (fun info ->
{ info with
FileName = fileName
WorkingDirectory = Path.GetTempPath()
Arguments = args }
WorkingDirectory = Path.GetDirectoryName fileName
Arguments = args.ToStartInfo }
) TimeSpan.MaxValue

if exitCode <> 0 then
Expand Down
4 changes: 2 additions & 2 deletions src/app/Fake.DotNet.ILMerge/ILMerge.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// ### Sample
///
/// Target.create "ILMerge" (fun _ ->
/// let target = !!./bin/Release/*.exe" |> Seq.head
/// let target = !!"./bin/Release/*.exe" |> Seq.head
/// let out = "./bin" @@ (Path.GetFileName target)
/// ILMerge.run
/// { ILMerge.Params.Create() with DebugInfo = true
Expand Down Expand Up @@ -181,4 +181,4 @@ let run parameters outputFile primaryAssembly =
failwithf "'ILMerge %s' failed." (String.separated " " args)
__.MarkSuccess()
else
raise <| NotSupportedException("ILMerge is currently not supported on mono")
raise <| NotSupportedException("ILMerge is currently not supported on mono")
7 changes: 5 additions & 2 deletions src/app/Fake.DotNet.NuGet/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@ let getNuspecProperties (nuspec : string) =
// |> getNuspecProperties

/// Default NuGet feed
let feedUrl = "http://go.microsoft.com/fwlink/?LinkID=206669"
[<Obsolete "This V1 NuGet feed url most likely doesn't work. Please consider using v3 nuget feed via `NuGet.galleryV3`.">]
let galleryV1 = "http://go.microsoft.com/fwlink/?LinkID=206669"
let galleryV2 = "https://www.nuget.org/api/v2/"
let galleryV3 = "https://api.nuget.org/v3/index.json"

// TODO: Note that this is stolen from paket code. We might want to move that into a shared FAKE library..., see https://github.com/fsprojects/Paket/blob/06ef22ba79896cd9f2a2e2eefccde08b09ab7656/src/Paket.Core/Utils.fs
#if NETSTANDARD
Expand Down Expand Up @@ -735,7 +738,7 @@ let private webClient = new WebClient()

/// [omit]
let discoverRepoUrl =
lazy (let resp = webClient.DownloadString(feedUrl)
lazy (let resp = webClient.DownloadString(galleryV1)
let doc = Xml.createDoc resp
doc.["service"].GetAttribute("xml:base"))

Expand Down
Loading

0 comments on commit 2db6e13

Please sign in to comment.