-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update .NET, Paket, Fake, packages, build scripts
We have replaced Fake CLI with a project in order to use .NET 7.0. See fsprojects/FAKE#2719 and https://fake.build/guide/getting-started.html#Run-FAKE-using-a-dedicated-build-project . We are not sure if the resulting solution is optimal or "best practice".
- Loading branch information
1 parent
9f45775
commit cc3182b
Showing
19 changed files
with
380 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
# See https://stackoverflow.com/a/3355423 | ||
cd "$(dirname "$0")" | ||
|
||
dotnet tool restore | ||
dotnet paket restore | ||
|
||
# See https://github.com/TheAngryByrd/MiniScaffold/blob/master/build.sh | ||
FAKE_DETAILED_ERRORS=true dotnet run --project ./build/build.fsproj -- -t "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
open Fake.IO | ||
open Fake.IO.Globbing.Operators //enables !! and globbing | ||
open Fake.IO.FileSystemOperators | ||
open Fake.Core | ||
open Fake.DotNet | ||
open Fake.Tools | ||
open Fake.Core.TargetOperators | ||
|
||
open System.Runtime.InteropServices | ||
|
||
|
||
[<EntryPoint>] | ||
let main argv = | ||
argv | ||
|> Array.toList | ||
|> Context.FakeExecutionContext.Create false "build.fs" | ||
|> Context.RuntimeContext.Fake | ||
|> Context.setExecutionContext | ||
|
||
Target.initEnvironment() | ||
|
||
// From https://fake.build/guide/dotnet-cli.html#Minimal-working-example | ||
let install = lazy DotNet.install DotNet.Versions.FromGlobalJson | ||
let inline dotnetSimple arg = DotNet.Options.lift install.Value arg | ||
|
||
Target.create "Clean" (fun _ -> | ||
let res = DotNet.exec dotnetSimple "clean" "" // "ivm-implementations.sln" | ||
if not res.OK then failwithf "'dotnet clean' failed with code %i" res.ExitCode | ||
) | ||
|
||
Target.create "Test" (fun _ -> | ||
// TODO: Reduce output noise when running tests / running in general | ||
DotNet.test dotnetSimple "." | ||
) | ||
|
||
// Since Git.Information.getLastTag only sees annotated tags | ||
let getLastTag () = | ||
Git.CommandHelper.getGitResult "." "describe --tags --abbrev=0" |> Seq.head | ||
|
||
let publish (alsoZip: bool) (runtimes: string list) = | ||
let framework = "net7.0" | ||
let tag = getLastTag () | ||
let version = tag.Substring 1 | ||
Trace.log $"Publishing {tag}..." | ||
|
||
for runtime in runtimes do | ||
let releaseDir = "Command" </> "bin" </> "release" </> framework </> runtime | ||
let publishDir = releaseDir </> "publish" | ||
|
||
Shell.cleanDir publishDir | ||
|
||
// Inspired by https://github.com/cannorin/flxble/blob/master/build.fsx | ||
let opt (options: DotNet.PublishOptions) = | ||
{ | ||
options with | ||
Configuration = DotNet.BuildConfiguration.Release | ||
SelfContained = Some true | ||
Runtime = Some runtime | ||
|
||
MSBuildParams = | ||
{ | ||
options.MSBuildParams with | ||
// DisableInternalBinLog = true // https://gitter.im/fsharp/FAKE?at=5e6a729be203784a55a350db | ||
Properties = | ||
("PackAsTool", "false") | ||
:: ("TargetFramework", framework) | ||
:: ("PublishSingleFile", "true") | ||
:: ("PublishTrimmed", "true") | ||
:: ("AssemblyVersion", version) | ||
:: options.MSBuildParams.Properties | ||
} | ||
} | ||
DotNet.publish (dotnetSimple >> opt) "Command" | ||
|
||
if alsoZip then | ||
// Put the executable and .pdb file in one zip file. | ||
// This overwrites any existing zip file. | ||
!! (publishDir </> "*") |> Zip.zip publishDir (releaseDir </> sprintf "%s_%s.zip" tag runtime) | ||
|
||
// Publish and zip for all platforms (after clean and test) | ||
Target.create "Publish" <| fun _ -> | ||
publish true ["osx-x64"; "linux-x64"; "win-x64"] | ||
|
||
// Publish for current platform | ||
Target.create "Pub" <| fun _ -> | ||
let runtime = | ||
if RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then "osx-x64" | ||
else if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then "win-x64" | ||
else "linux-x64" | ||
publish false [runtime] | ||
|
||
ignore <| [ | ||
"Clean" ==> "Publish" | ||
"Clean" ?=> "Test" | ||
"Test" ==> "Publish" | ||
] | ||
|
||
Target.runOrDefaultWithArguments "Publish" | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="build.fs" /> | ||
</ItemGroup> | ||
<Import Project="..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Fake.IO.FileSystem | ||
Fake.IO.Zip | ||
Fake.DotNet.Cli | ||
Fake.Tools.Git | ||
Fake.Core.Target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.302", | ||
"rollForward": "latestMinor" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.