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

Release 5.18.1 #2410

Merged
merged 18 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## 5.18.1 - 2019-10-22

* BUGFIX: Paket module was broken - https://github.com/fsharp/FAKE/pull/2413
* BUGFIX: New `CreateProcess.withToolType` wasn't working for `ToolType.FrameworkDependentDeployment` - https://github.com/fsharp/FAKE/issues/2412
* ENHANCEMENT: Add support for local dotnet tool to fake-template and make it the default.

## 5.18.0 - 2019-10-21

* ENHANCEMENT: Add core support for local tools via `CreateProcess.withToolType`, this helper is part of `Fake.DotNet.Cli` and available after `open Fake.Core` - https://github.com/fsharp/FAKE/pull/2399
Expand Down
5 changes: 3 additions & 2 deletions help/markdown/fake-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Specifies the name of the generated build-script. Defaults to `build.fsx`.
### --bootstrap
Specifies your prefered way to bootstrap FAKE.

- `tool` (default) - Installs the FAKE dotnet sdk global tool into the `--tool-path` folder
- `local` (default) - Installs the FAKE dotnet sdk local tool into the `dotnet-tools.json` manifest. This requires an dotnet SDK version 3 or higher.
- `tool` - Installs the FAKE dotnet sdk global tool into the `--tool-path` folder
- `project` - Creates a `build.proj` and uses `DotNetCliToolReference` to bootstrap FAKE
- `none` - Does not bootstrap FAKE. Use this if you want to use a global installation of FAKE

Expand All @@ -50,4 +51,4 @@ Specifies your prefered way to define build tasks inside your build script:
Specifies the folder for the fake-cli tool. This parameter is only applicable when `tool` option is used for bootstrapping with `--bootstrap`. Defaults to `.fake`.

### --version
Specifies the version of FAKE to install. Defaults to `5.*`. This parameter is only applicable when either `tool` or `project` is used for bootstrapping.
Specifies the version of FAKE to install. Defaults to `5.*`. This parameter is only applicable when either `local`, `tool` or `project` is used for bootstrapping.
1 change: 1 addition & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ group netcore
nuget Paket.Core // prerelease
nuget NuGet.Protocol ~> 4.0 strategy: min // To support net462...
nuget Mono.Cecil prerelease
nuget Mono.Posix.NETStandard
nuget FSharp.Control.Reactive
nuget System.Reactive.Compatibility
nuget System.Security.Cryptography.Algorithms
Expand Down
311 changes: 156 additions & 155 deletions paket.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/app/Fake.Core.Process/Process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ open Fake.IO.FileSystemOperators
open Fake.Core.GuardedAwaitObservable


#if !FX_NO_HANDLE
module internal Kernel32 =
open System
open System.Text
open System.Diagnostics
#if !FX_NO_HANDLE
open System.Runtime.InteropServices
[<DllImport("Kernel32.dll", SetLastError = true)>]
extern UInt32 QueryFullProcessImageName(IntPtr hProcess, UInt32 flags, StringBuilder text, [<Out>] UInt32& size)
Expand All @@ -252,6 +252,9 @@ module internal Kernel32 =
Marshal.ThrowExceptionForHR hresult
"Error = " + string hresult + " when calling GetProcessImageFileName"
#endif
// TODO: complete, see https://github.com/dotnet/corefx/issues/1086
[<DllImport("Kernel32.dll", SetLastError = true)>]
extern UInt32 GetFinalPathNameByHandleA(IntPtr hFile, StringBuilder lpszFilePath, uint32 cchFilePath, uint32 dwFlags)

type AsyncProcessResult<'a> = { Result : System.Threading.Tasks.Task<'a>; Raw : System.Threading.Tasks.Task<RawProcessResult> }

Expand Down
8 changes: 7 additions & 1 deletion src/app/Fake.Core.Process/ProcessUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ module ProcessUtils =
|> String.split ';'
|> Seq.collect (fun postFix -> findFilesInternal dirs (tool + postFix))
|> fun findings -> Seq.append findings (findFilesInternal dirs tool)
else findFilesInternal dirs tool
else
// On unix we still want to find some extensions (paket.exe!), but we prefer without
// filesystem is case sensitive!
Environment.environVarOrDefault "PATHEXT" ".exe;.sh"
|> String.split ';'
|> Seq.collect (fun postFix -> findFilesInternal dirs (tool + postFix))
|> fun findings -> Seq.append (findFilesInternal dirs tool) findings

/// Searches the given directories for all occurrences of the given file name. Considers PATHEXT on Windows.
let tryFindFile dirs tool =
Expand Down
1 change: 1 addition & 0 deletions src/app/Fake.DotNet.Cli/CreateProcessExt.fs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module CreateProcessDotNetExt =
|> CreateProcess.withFramework
| ToolType.FrameworkDependentDeployment dotnetOptions -> // dotnet ToolPath (can be a dll)
c
|> DotNet.prefixProcess dotnetOptions.Options [c.Command.Executable]
| ToolType.SelfContainedDeployment// just ToolPath
| ToolType.GlobalTool -> // just ToolPath
c
Expand Down
31 changes: 25 additions & 6 deletions src/app/Fake.DotNet.Cli/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -769,20 +769,39 @@ module DotNet =
|> runRaw (FirstArgReplacement.ReplaceWith firstArgs) options
|> CreateProcess.map fst

/// Setup the environment in such a way that started processes use the given dotnet SDK installation.
/// Setup the environment (`PATH` and `DOTNET_ROOT`) in such a way that started processes use the given dotnet SDK installation.
/// This is useful for example when using fable, see https://github.com/fsharp/FAKE/issues/2405
/// ## Parameters
///
/// - 'buildOptions' - build common execution options
/// - 'firstArg' - the first argument (like t)
/// - 'args' - command arguments
/// - 'install' - The SDK to use (result of `DotNet.install`)
let setupEnv (install: Options -> Options) =
let options = setOptions install
let dotnetTool = System.IO.Path.GetFullPath options.DotNetCliPath
let dotnetFolder = System.IO.Path.GetDirectoryName dotnetTool
let currentPath = Environment.environVar "PATH"
if not (currentPath.Contains (dotnetFolder)) then
Environment.setEnvironVar "PATH" (dotnetFolder + string System.IO.Path.DirectorySeparatorChar + currentPath)
match currentPath with
| null | "" ->
Environment.setEnvironVar "PATH" (dotnetFolder)
| _ when not (currentPath.Contains (dotnetFolder)) ->
Environment.setEnvironVar "PATH" (dotnetFolder + string System.IO.Path.PathSeparator + currentPath)
| _ -> ()

let currentDotNetRoot = Environment.environVar "DOTNET_ROOT"
let realFolder =
if not Environment.isWindows then
#if !FX_NO_POSIX
// resolve potential symbolic link to the real location
// https://stackoverflow.com/questions/58326739/how-can-i-find-the-target-of-a-linux-symlink-in-c-sharp
Mono.Unix.UnixPath.GetRealPath(dotnetTool)
|> System.IO.Path.GetDirectoryName
#else
eprintf "Setting 'DOTNET_ROOT' to '%s' this might be wrong as we didn't follow the symlink. Please upgrade to netcore." dotnetFolder
dotnetFolder
#endif
else dotnetFolder

if String.IsNullOrEmpty currentDotNetRoot || not (currentDotNetRoot.Contains (realFolder)) then
Environment.setEnvironVar "DOTNET_ROOT" (realFolder)

/// dotnet --info command options
type InfoOptions =
Expand Down
3 changes: 3 additions & 0 deletions src/app/Fake.DotNet.Cli/Fake.DotNet.Cli.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<DefineConstants>$(DefineConstants);FX_NO_POSIX</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="VisibleTo.fs" />
Expand Down
4 changes: 3 additions & 1 deletion src/app/Fake.DotNet.Cli/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ group netcore

FSharp.Core
NETStandard.Library
Newtonsoft.Json
Newtonsoft.Json
// https://stackoverflow.com/questions/58326739/how-can-i-find-the-target-of-a-linux-symlink-in-c-sharp
Mono.Posix.NETStandard
80 changes: 47 additions & 33 deletions src/app/Fake.DotNet.Paket/Paket.fs
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,31 @@ let private startPaket (toolType: ToolType) toolPath workDir timeout args =
|> CreateProcess.withToolType toolType
|> CreateProcess.withWorkingDirectory workDir
|> CreateProcess.withTimeout timeout

let private start (c:CreateProcess<ProcessResult<_>>) =
c
|> Proc.run
|> fun r -> r.ExitCode

/// Creates a new NuGet package by using Paket pack on all paket.template files in the working directory.
/// ## Parameters
///
/// - `setParams` - Function used to manipulate the default parameters.
let pack setParams =
let parameters : PaketPackParams = PaketPackDefaults() |> setParams
use __ = Trace.traceTask "PaketPack" parameters.WorkingDir

let xmlEncode (notEncodedText : string) =
if String.IsNullOrWhiteSpace notEncodedText then ""
else XText(notEncodedText).ToString().Replace("ß", "&szlig;")
type internal StartType =
| PushFile of parameters:(PaketPushParams) * files:string
| Pack of parameters:(PaketPackParams)
| Restore of parameters:(PaketRestoreParams)

let packResult =
Arguments.Empty
let internal createProcess (runType:StartType) =
match runType with
| PushFile (parameters, file) ->
Arguments.OfArgs ["push"]
|> Arguments.appendNotEmpty "--url" parameters.PublishUrl
|> Arguments.appendNotEmpty "--endpoint" parameters.EndPoint
|> Arguments.appendNotEmpty "--api-key" parameters.ApiKey
|> Arguments.append [file]
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut
| Pack (parameters) ->
let xmlEncode (notEncodedText : string) =
if String.IsNullOrWhiteSpace notEncodedText then ""
else XText(notEncodedText).ToString().Replace("ß", "&szlig;")
Arguments.OfArgs ["pack"]
|> Arguments.appendNotEmpty "--version" parameters.Version
|> Arguments.appendNotEmpty "--build-config" parameters.BuildConfig
|> Arguments.appendNotEmpty "--build-platform" parameters.BuildPlatform
Expand All @@ -137,10 +145,30 @@ let pack setParams =
|> List.foldBack (fun t -> Arguments.append ["--exclude"; t]) parameters.ExcludedTemplates
|> List.foldBack (fun (id, v) -> Arguments.append ["--specific-version"; id; v]) parameters.SpecificVersions
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut
| Restore (parameters) ->
Arguments.OfArgs ["restore"]
|> Arguments.appendNotEmpty "--group" parameters.Group
|> Arguments.appendIf parameters.ForceDownloadOfPackages "--force"
|> Arguments.appendIf parameters.OnlyReferencedFiles "--only-referenced"
|> List.foldBack (fun ref -> Arguments.append ["--reference-files"; ref]) parameters.ReferenceFiles
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut

/// Creates a new NuGet package by using Paket pack on all paket.template files in the working directory.
/// ## Parameters
///
/// - `setParams` - Function used to manipulate the default parameters.
let pack setParams =
let parameters : PaketPackParams = PaketPackDefaults() |> setParams
use __ = Trace.traceTask "PaketPack" parameters.WorkingDir

let packResult =
createProcess (Pack parameters)
|> start

if packResult <> 0 then failwithf "Error during packing %s." parameters.WorkingDir
__.MarkSuccess()


/// Pushes the given NuGet packages to the server by using Paket push.
/// ## Parameters
///
Expand All @@ -158,12 +186,6 @@ let pushFiles setParams files =
| None -> ()

let packages = Seq.toList files
let args =
Arguments.Empty
|> Arguments.appendNotEmpty "--url" parameters.PublishUrl
|> Arguments.appendNotEmpty "--endpoint" parameters.EndPoint
|> Arguments.appendNotEmpty "--api-key" parameters.ApiKey

use __ = Trace.traceTask "PaketPush" (String.separated ", " packages)

if parameters.DegreeOfParallelism > 0 then
Expand All @@ -185,9 +207,8 @@ let pushFiles setParams files =
|> Seq.toArray
|> Array.map (fun package -> async {
let pushResult =
args
|> Arguments.append [package]
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut
createProcess (PushFile(parameters, package))
|> start
if pushResult <> 0 then failwithf "Error during pushing %s." package })

Async.Parallel tasks
Expand All @@ -197,9 +218,8 @@ let pushFiles setParams files =
else
for package in packages do
let pushResult =
args
|> Arguments.append [package]
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut
createProcess (PushFile(parameters, package))
|> start
if pushResult <> 0 then failwithf "Error during pushing %s." package
__.MarkSuccess()

Expand Down Expand Up @@ -255,17 +275,11 @@ let getDependenciesForReferencesFile (referencesFile:string) =
/// - `setParams` - Function used to manipulate the default parameters.
let restore setParams =
let parameters : PaketRestoreParams = PaketRestoreDefaults() |> setParams
let args =
Arguments.Empty
|> Arguments.appendNotEmpty "--group" parameters.Group
|> Arguments.appendIf parameters.ForceDownloadOfPackages "--force"
|> Arguments.appendIf parameters.OnlyReferencedFiles "--only-referenced"
|> List.foldBack (fun ref -> Arguments.append ["--reference-files"; ref]) parameters.ReferenceFiles

use __ = Trace.traceTask "PaketRestore" parameters.WorkingDir

let restoreResult =
startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut args
createProcess (Restore parameters)
|> start

if restoreResult <> 0 then failwithf "Error during restore %s." parameters.WorkingDir
__.MarkSuccess()
4 changes: 2 additions & 2 deletions src/legacy/FakeLib/FakeLib.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>TRACE;DEBUG;NET40;NO_DOTNETCORE_BOOTSTRAP;FX_PASSWORD;FX_WINDOWSTLE;FX_VERB;FX_NO_RUNTIME_INFORMATION;FX_CONFIGURATION_MANAGER;FX_ERROR_DIALOG;NO_VSWHERE;NO_MSBUILD_BINLOG</DefineConstants>
<DefineConstants>TRACE;DEBUG;NET40;NO_DOTNETCORE_BOOTSTRAP;FX_PASSWORD;FX_WINDOWSTLE;FX_VERB;FX_NO_RUNTIME_INFORMATION;FX_CONFIGURATION_MANAGER;FX_ERROR_DIALOG;NO_VSWHERE;NO_MSBUILD_BINLOG;FX_NO_POSIX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
<DocumentationFile>
Expand All @@ -35,7 +35,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\</OutputPath>
<DefineConstants>TRACE;NET40;NO_DOTNETCORE_BOOTSTRAP;FX_PASSWORD;FX_WINDOWSTLE;FX_VERB;FX_NO_RUNTIME_INFORMATION;FX_CONFIGURATION_MANAGER;FX_ERROR_DIALOG;NO_VSWHERE;NO_MSBUILD_BINLOG</DefineConstants>
<DefineConstants>TRACE;NET40;NO_DOTNETCORE_BOOTSTRAP;FX_PASSWORD;FX_WINDOWSTLE;FX_VERB;FX_NO_RUNTIME_INFORMATION;FX_CONFIGURATION_MANAGER;FX_ERROR_DIALOG;NO_VSWHERE;NO_MSBUILD_BINLOG;FX_NO_POSIX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\..\build\FakeLib.XML</DocumentationFile>
Expand Down
16 changes: 16 additions & 0 deletions src/template/fake-template/Content/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 1,
"isRoot": true,
"tools": {
"fake-cli": {
//#if (version == "latest")
"version": "5.17.0",
////#else
//"version": "(version)",
//#endif
"commands": [
"fake"
]
}
}
}
Loading