Skip to content

Commit 792d17a

Browse files
authored
Update Paket, FCS, and .NET Core (#244)
* Update Paket, FCS, and .NET Core * Update pipeline for .NET Core 3.1 * Try using .NET local tools https://stu.dev/dotnet-core-3-local-tools/ * Tool restore for Travis as well * .NET Core 3.1.100 for Travis Just need >3.x for local tools
1 parent 7926ca9 commit 792d17a

11 files changed

+114
-110
lines changed

.config/dotnet-tools.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"fake-cli": {
6+
"version": "5.19.0",
7+
"commands": [
8+
"fake"
9+
]
10+
}
11+
}
12+
}

.paket/Paket.Restore.targets

+48-41
Original file line numberDiff line numberDiff line change
@@ -20,75 +20,82 @@
2020
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
2121
<PaketExeImage>assembly</PaketExeImage>
2222
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
23-
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
23+
<MonoPath Condition="'$(MonoPath)' == '' AND Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
2424
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
2525

2626
<!-- PaketBootStrapper -->
2727
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2828
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2929
<PaketBootStrapperExeDir Condition=" Exists('$(PaketBootStrapperExePath)') " >$([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\</PaketBootStrapperExeDir>
3030

31-
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
31+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT' ">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3232
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3333

34-
<!-- Disable automagic references for F# dotnet sdk -->
35-
<!-- This will not do anything for other project types -->
36-
<!-- see https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1002-fsharp-in-dotnet-sdk.md -->
37-
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
38-
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
39-
4034
<!-- Disable Paket restore under NCrunch build -->
4135
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
4236

37+
<!-- Disable test for CLI tool completely - overrideable via properties in projects or via environment variables -->
38+
<PaketDisableCliTest Condition=" '$(PaketDisableCliTest)' == '' ">False</PaketDisableCliTest>
39+
4340
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
4441
</PropertyGroup>
4542

46-
<!-- Check if paket is available as local dotnet cli tool -->
43+
<!-- Resolve how paket should be called -->
44+
<!-- Current priority is: local (1: repo root, 2: .paket folder) => 3: as CLI tool => as bootstrapper (4: proj Bootstrapper style, 5: BootstrapperExeDir) => 6: global path variable -->
4745
<Target Name="SetPaketCommand" >
48-
49-
<!-- Call 'dotnet paket' and see if it returns without an error. Mute all the output. -->
50-
<Exec Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
51-
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
52-
</Exec>
46+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 1/2 - non-windows specific -->
47+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
48+
<!-- no windows, try native paket as default, root => tool -->
49+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
50+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
51+
</PropertyGroup>
5352

54-
<!-- If local paket tool is found, use that -->
55-
<PropertyGroup Condition=" '$(LocalPaketToolExitCode)' == '0' ">
56-
<InternalPaketCommand>dotnet paket</InternalPaketCommand>
53+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 2/2 - same across platforms -->
54+
<PropertyGroup>
55+
<!-- root => tool -->
56+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
57+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
5758
</PropertyGroup>
5859

59-
<!-- If not, then we go through our normal steps of setting the Paket command. -->
60-
<PropertyGroup Condition=" '$(LocalPaketToolExitCode)' != '0' ">
61-
<!-- windows, root => tool => proj style => bootstrapper => global -->
62-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
63-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
64-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket.exe</PaketExePath>
65-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(_PaketBootStrapperExeDir)paket.exe</PaketExePath>
66-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">paket.exe</PaketExePath>
60+
<!-- If paket hasn't be found in standard locations, test for CLI tool usage. -->
61+
<!-- First test: Is CLI configured to be used in "dotnet-tools.json"? - can result in a false negative; only a positive outcome is reliable. -->
62+
<PropertyGroup Condition=" '$(PaketExePath)' == '' ">
63+
<_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json"))</_DotnetToolsJson>
64+
<_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"'))</_ConfigContainsPaket>
65+
<_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false</_ConfigContainsPaket>
66+
</PropertyGroup>
6767

68-
<!-- no windows, try native paket as default, root => tool => proj style => mono paket => bootstrpper => global -->
69-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
70-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
71-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
68+
<!-- Second test: Call 'dotnet paket' and see if it returns without an error. Mute all the output. Only run if previous test failed and the test has not been disabled. -->
69+
<!-- WARNING: This method can lead to processes hanging forever, and should be used as little as possible. See https://github.com/fsprojects/Paket/issues/3705 for details. -->
70+
<Exec Condition=" '$(PaketExePath)' == '' AND !$(PaketDisableCliTest) AND !$(_ConfigContainsPaket)" Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
71+
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
72+
</Exec>
7273

73-
<!-- no windows, try mono paket -->
74-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
75-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
74+
<!-- If paket is installed as CLI use that. Again, only if paket haven't already been found in standard locations. -->
75+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND ($(_ConfigContainsPaket) OR '$(LocalPaketToolExitCode)' == '0') ">
76+
<_PaketCommand>dotnet paket</_PaketCommand>
77+
</PropertyGroup>
7678

77-
<!-- no windows, try bootstrapper -->
78-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket.exe</PaketExePath>
79+
<!-- If neither local files nor CLI tool can be found, final attempt is searching for boostrapper config before falling back to global path variable. -->
80+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND '$(_PaketCommand)' == '' ">
81+
<!-- Test for bootstrapper setup -->
82+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
83+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket</PaketExePath>
7984

80-
<!-- no windows, try global native paket -->
81-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' ">paket</PaketExePath>
85+
<!-- If all else fails, use global path approach. -->
86+
<PaketExePath Condition=" '$(PaketExePath)' == ''">paket</PaketExePath>
87+
</PropertyGroup>
8288

89+
<!-- If not using CLI, setup correct execution command. -->
90+
<PropertyGroup Condition=" '$(_PaketCommand)' == '' ">
8391
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
84-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</InternalPaketCommand>
85-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</InternalPaketCommand>
86-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' ">"$(PaketExePath)"</InternalPaketCommand>
87-
92+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</_PaketCommand>
93+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</_PaketCommand>
94+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)"</_PaketCommand>
8895
</PropertyGroup>
8996

9097
<!-- The way to get a property to be available outside the target is to use this task. -->
91-
<CreateProperty Value="$(InternalPaketCommand)">
98+
<CreateProperty Value="$(_PaketCommand)">
9299
<Output TaskParameter="Value" PropertyName="PaketCommand"/>
93100
</CreateProperty>
94101

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ services:
66
- docker
77
dist: xenial
88

9-
#dotnet >2.2.* currently fail on unpack
10-
dotnet: 2.2.402
9+
dotnet: 3.1.100
1110

1211
script:
1312
- ./build.sh --target BuildNetFramework

azure-pipelines.yml

+18-8
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,29 @@ jobs:
1111
pool:
1212
vmImage: 'windows-2019'
1313
steps:
14-
- script: fake.cmd build --target All
14+
- task: UseDotNet@2
15+
inputs:
16+
version: 3.1.100
17+
- script: |
18+
dotnet tool restore
19+
dotnet fake build --target All
1520
- job: macOS
1621
pool:
1722
vmImage: 'macOS-10.14'
1823
steps:
19-
- bash: . '$(Build.SourcesDirectory)/fake.sh' build --target BuildNetCore
24+
- task: UseDotNet@2
25+
inputs:
26+
version: 3.1.100
27+
- bash: |
28+
dotnet tool restore
29+
dotnet fake build --target BuildNetCore
2030
- job: Linux
2131
pool:
2232
vmImage: 'ubuntu-18.04'
2333
steps:
24-
- bash: . '$(Build.SourcesDirectory)/fake.sh' build --target BuildNetCore
25-
26-
#- script: |
27-
# echo Add other tasks to build, test, and deploy your project.
28-
# echo See https://aka.ms/yaml
29-
# displayName: 'Run a multi-line script'
34+
- task: UseDotNet@2
35+
inputs:
36+
version: 3.1.100
37+
- bash: |
38+
dotnet tool restore
39+
dotnet fake build --target BuildNetCore

build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/usr/bin/env bash
2+
dotnet tool restore
23
source fake.sh build "$@"

fake.cmd

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
SET TOOL_PATH=.fake
2-
3-
IF NOT EXIST "%TOOL_PATH%\fake.exe" (
4-
dotnet tool install fake-cli --tool-path ./%TOOL_PATH%
5-
)
6-
7-
"%TOOL_PATH%/fake.exe" %*
1+
dotnet tool restore
2+
dotnet fake %*

fake.sh

+2-25
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,5 @@
33
set -eu
44
set -o pipefail
55

6-
# workaround macOS build agent issue from https://github.com/dotnet/cli/issues/9114#issuecomment-494226139
7-
export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")"
8-
9-
# liberated from https://stackoverflow.com/a/18443300/433393
10-
realpath() {
11-
OURPWD=$PWD
12-
cd "$(dirname "$1")"
13-
LINK=$(readlink "$(basename "$1")")
14-
while [ "$LINK" ]; do
15-
cd "$(dirname "$LINK")"
16-
LINK=$(readlink "$(basename "$1")")
17-
done
18-
REALPATH="$PWD/$(basename "$1")"
19-
cd "$OURPWD"
20-
echo "$REALPATH"
21-
}
22-
23-
TOOL_PATH=$(realpath .fake)
24-
FAKE="$TOOL_PATH"/fake
25-
26-
if ! [ -e "$FAKE" ]
27-
then
28-
dotnet tool install fake-cli --tool-path "$TOOL_PATH"
29-
fi
30-
"$FAKE" "$@"
6+
dotnet tool restore
7+
dotnet fake "$@"

paket.dependencies

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
version 5.231.2
1+
version 5.241.5
22

33
framework: net472
44
source https://api.nuget.org/v3/index.json
55

6-
nuget FSharp.Compiler.Service ~> 33.0.0
6+
nuget FSharp.Compiler.Service ~> 33.0.1
77
nuget FSharp.Compiler.Tools ~> 10.2.3
88
nuget FSharp.Core = 4.7.0
99
nuget AsyncIO >= 0.1.69
1010
nuget NetMQ ~> 4.0.0.239-pre
1111
nuget Newtonsoft.Json ~> 12.0.3
1212
nuget FAKE >= 5.16.0
13-
nuget Paket.Core ~> 5.231.2
13+
nuget Paket.Core ~> 5.241.5
1414
nuget Trinet.Core.IO.Ntfs
1515
nuget system.memory 4.5.3
1616

1717
group NETCORE
1818

19-
framework: netstandard2.0, netcoreapp2.2
19+
framework: netstandard2.0, netcoreapp3.1
2020
source https://api.nuget.org/v3/index.json
2121

22-
nuget FSharp.Compiler.Service ~> 33.0.0
22+
nuget FSharp.Compiler.Service ~> 33.0.1
2323
nuget FSharp.Compiler.Tools ~> 10.2.3
2424
nuget FSharp.Core = 4.7.0
2525
nuget AsyncIO >= 0.1.69
2626
nuget NetMQ ~> 4.0.0.239-pre
2727
nuget Newtonsoft.Json ~> 12.0.3
2828
nuget FAKE >= 5.16.0
29-
nuget Paket.Core ~> 5.231.2
29+
nuget Paket.Core ~> 5.241.5
3030
nuget Trinet.Core.IO.Ntfs
3131
nuget system.memory 4.5.3
3232

0 commit comments

Comments
 (0)