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

Update to dotnet 7. #779

Merged
merged 4 commits into from
Nov 17, 2022
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: 0 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"isRoot": true,
"tools": {
"fake-cli": {
"version": "5.23.0",
"commands": [
"fake"
]
},
"paket": {
"version": "7.1.5",
"commands": [
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
- name: Restore .NET local tools
run: dotnet tool restore
- name: Restore packages
run: dotnet paket restore
- name: Check code formatting conforms (run 'dotnet fantomas src tests docs build.fsx --recurse' to repair)
run: dotnet fantomas src tests docs build.fsx -r --check
- name: Check code formatting conforms (run 'dotnet fantomas src tests docs build --recurse' to repair)
run: dotnet fantomas src tests docs build -r --check
- name: Build and test
run: dotnet fake run build.fsx
run: dotnet run --project ./build/build.fsproj
10 changes: 5 additions & 5 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
- name: Restore .NET local tools
run: dotnet tool restore
- name: Restore packages
run: dotnet paket restore
- name: Check code formatting conforms (run 'dotnet fantomas src tests docs build.fsx --recurse' to repair)
run: dotnet fantomas src tests docs build.fsx -r --check
- name: Check code formatting conforms (run 'dotnet fantomas src tests docs build --recurse' to repair)
run: dotnet fantomas src tests docs build -r --check
- name: Build and test
run: dotnet fake run build.fsx
run: dotnet run --project ./build/build.fsproj
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions FSharp.Formatting.sln
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{FAD5
docs\content\navbar-fixed-right.css = docs\content\navbar-fixed-right.css
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build\build.fsproj", "{8B442E7B-A6B3-4B6B-A127-895E20FDAE84}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -227,6 +229,10 @@ Global
{CB78F0EA-8005-4735-A02C-B86CEDC29D85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB78F0EA-8005-4735-A02C-B86CEDC29D85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB78F0EA-8005-4735-A02C-B86CEDC29D85}.Release|Any CPU.Build.0 = Release|Any CPU
{8B442E7B-A6B3-4B6B-A127-895E20FDAE84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B442E7B-A6B3-4B6B-A127-895E20FDAE84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B442E7B-A6B3-4B6B-A127-895E20FDAE84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B442E7B-A6B3-4B6B-A127-895E20FDAE84}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ See https://fsprojects.github.io/FSharp.Formatting/
Once built, you can run the command-line tool to self-build the docs for this directory using

dotnet build
src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe watch
src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe build --clean
src\fsdocs-tool\bin\Debug\net7.0\fsdocs.exe watch
src\fsdocs-tool\bin\Debug\net7.0\fsdocs.exe build --clean


## Maintainer(s)
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 17.0.0

* Update to .NET 7.0.100

## 16.1.1

* [Fix arguments naming and escape operator name in usageHtml](https://github.com/fsprojects/FSharp.Formatting/pull/765/)
Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set PAKET_SKIP_RESTORE_TARGETS true

dotnet tool restore
dotnet paket restore
dotnet fake build %*
dotnet run --project .\build\build.fsproj -- %*
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export PAKET_SKIP_RESTORE_TARGETS=true

dotnet tool restore && \
dotnet paket restore && \
dotnet fake run build.fsx "$@"
dotnet run --project ./build/build.fsproj -- "$@"
95 changes: 51 additions & 44 deletions build.fsx → build/build.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// This is a FAKE 5.0 script, run using
// dotnet fake build

#r "paket: groupref fake //"

#if !FAKE
#load ".fake/build.fsx/intellisense.fsx"
#r "netstandard"
#endif

open System
open System.Xml.Linq
open Fake.Core
Expand All @@ -16,23 +6,21 @@ open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fake.DotNet
open Fake.IO
open Fake.Tools

Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let root = Path.combine __SOURCE_DIRECTORY__ ".."
Environment.CurrentDirectory <- root

// Information about the project to be used at NuGet and in AssemblyInfo files
let project = "FSharp.Formatting"

let summary =
"A package of libraries for building great F# documentation, samples and blogs"
let summary = "A package of libraries for building great F# documentation, samples and blogs"

let license = "Apache 2.0 License"

let configuration =
DotNet.BuildConfiguration.fromEnvironVarOrDefault "configuration" DotNet.BuildConfiguration.Release
let configuration = DotNet.BuildConfiguration.fromEnvironVarOrDefault "configuration" DotNet.BuildConfiguration.Release

// Folder to deposit deploy artifacts
let artifactsDir = __SOURCE_DIRECTORY__ @@ "artifacts"
let artifactsDir = root @@ "artifacts"

// Read release notes document
let release = ReleaseNotes.load "RELEASE_NOTES.md"
Expand All @@ -41,8 +29,7 @@ let projectRepo = "https://github.com/fsprojects/FSharp.Formatting"

// --------------------------------------------------------------------------------------
// Generate assembly info files with the right version & up-to-date information

Target.create "AssemblyInfo" (fun _ ->
let assemblyInfo _ =
let info =
[ AssemblyInfo.Product project
AssemblyInfo.Description summary
Expand All @@ -64,51 +51,48 @@ Target.create "AssemblyInfo" (fun _ ->
)
)

versionProps.Save("version.props"))
versionProps.Save("version.props")

// Clean build results
// --------------------------------------------------------------------------------------

Target.create "Clean" (fun _ ->
let clean _ =
!!artifactsDir ++ "temp" |> Shell.cleanDirs
// in case the above pattern is empty as it only matches existing stuff
[ "bin"; "temp"; "tests/bin" ] |> Seq.iter Directory.ensure)
[ "bin"; "temp"; "tests/bin" ] |> Seq.iter Directory.ensure

// Build library
// --------------------------------------------------------------------------------------

let solutionFile = "FSharp.Formatting.sln"

Target.create "Build" (fun _ ->
let build _ =
solutionFile
|> DotNet.build (fun opts -> { opts with Configuration = configuration }))
|> DotNet.build (fun opts -> { opts with Configuration = configuration })

Target.create "Tests" (fun _ ->
let tests _ =
solutionFile
|> DotNet.test (fun opts ->
{ opts with
Blame = true
NoBuild = true
Framework = Some "net6.0"
Framework = Some "net7.0"
Configuration = configuration
ResultsDirectory = Some "TestResults"
Logger = Some "trx" }))
Logger = Some "trx" })

// --------------------------------------------------------------------------------------
// Build a NuGet package

Target.create "NuGet" (fun _ ->
let nuget _ =
DotNet.pack
(fun pack ->
{ pack with
OutputPath = Some artifactsDir
Configuration = configuration })
solutionFile)
solutionFile

// Generate the documentation by dogfooding the tools pacakge
// --------------------------------------------------------------------------------------

Target.create "GenerateDocs" (fun _ ->
let generateDocs _ =
Shell.cleanDir ".fsdocs"
Shell.cleanDir ".packages"
// Τhe tool has been uninstalled when the
Expand All @@ -133,17 +117,40 @@ Target.create "GenerateDocs" (fun _ ->
|> ignore
// DotNet.exec id "fsdocs" "build --strict --clean --properties Configuration=Release" |> ignore
// DotNet.exec id "tool" "uninstall --local fsdocs-tool" |> ignore
Shell.cleanDir ".packages")
Shell.cleanDir ".packages"

let initTargets () =
Target.create "AssemblyInfo" assemblyInfo
Target.create "Clean" clean
Target.create "Build" build
Target.create "Tests" tests
Target.create "NuGet" nuget
Target.create "GenerateDocs" generateDocs
Target.create "All" ignore

// clean and recreate assembly inform on release
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "NuGet"
==> "Tests"
==> "GenerateDocs"
==> "All"
|> ignore

//-----------------------------------------------------------------------------
// Target Start
//-----------------------------------------------------------------------------
[<EntryPoint>]
let main argv =
argv
|> Array.toList
|> Context.FakeExecutionContext.Create false "build.fsx"
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext

Target.create "All" ignore
initTargets ()

// clean and recreate assembly inform on release
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "NuGet"
==> "Tests"
==> "GenerateDocs"
==> "All"
Target.runOrDefaultWithArguments "All"

Target.runOrDefault "All"
0 // return an integer exit code
14 changes: 14 additions & 0 deletions build/build.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<WarnOn>3390;$(WarnOn)</WarnOn>
<IsPackable>false</IsPackable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="build.fs" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
12 changes: 12 additions & 0 deletions build/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
group Fake

FSharp.Core
Fake.Core.Target
Fake.Core.ReleaseNotes
Fake.DotNet.AssemblyInfoFile
Fake.DotNet.Cli
Fake.DotNet.Testing.NUnit
Fake.DotNet.NuGet
Fake.DotNet.MsBuild
Fake.Tools.Git
Fake.DotNet.Paket
Loading