Skip to content
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
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Some common use cases include:
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode>true</RestoreLockedMode>
<NoWarn>NU1603</NoWarn>
<UseArtifactsOutput>true</UseArtifactsOutput>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<!-- https://www.gresearch.co.uk/blog/article/improve-nuget-restores-with-static-graph-evaluation/ -->
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageVersion Include="Ignore" Version="0.1.50" />
<PackageVersion Include="System.IO.Abstractions" Version="20.0.4" />
<PackageVersion Include="Spectre.Console" Version="0.48.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.11" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.13-nightly.20240213.132" />

<PackageVersion Include="CliWrap" Version="3.6.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
Expand Down
11 changes: 11 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,16 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="bdn-nightly" value="https://www.myget.org/F/benchmarkdotnet/api/v3/index.json" />
</packageSources>
<packageSourceMapping>
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<packageSource key="bdn-nightly">
<package pattern="BenchmarkDotNet" />
<package pattern="BenchmarkDotNet.*" />
</packageSource>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
46 changes: 15 additions & 31 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@ let cleanFolders (input: string seq) =
}

let benchmarkAssembly =
"src"
</> "Fantomas.Benchmarks"
</> "bin"
</> "Release"
</> "net7.0"
</> "Fantomas.Benchmarks.dll"
"artifacts/bin/Fantomas.Benchmarks/release/Fantomas.Benchmarks.dll"

let semanticVersioning =
__SOURCE_DIRECTORY__
</> "src"
</> "Fantomas"
</> "artifacts"
</> "bin"
</> "Release"
</> "net6.0"
</> "Fantomas"
</> "release"
</> "SemanticVersioning.dll"

let pushPackage nupkg =
Expand All @@ -62,25 +56,11 @@ let analysisReportsDir = "analysisreports"
pipeline "Build" {
workingDir __SOURCE_DIRECTORY__
stage "RestoreTools" { run "dotnet tool restore" }
stage "Clean" {
run (
cleanFolders
[| analysisReportsDir
"bin"
"src/Fantomas.FCS/bin/Release"
"src/Fantomas.FCS/obj/Release"
"src/Fantomas.Core/bin/Release"
"src/Fantomas.Core/obj/Release"
"src/Fantomas/bin/Release"
"src/Fantomas/obj/Release"
"src/Fantomas.Client/bin/Release"
"src/Fantomas.Client/obj/Release" |]
)
}
stage "Clean" { run (cleanFolders [| analysisReportsDir; "artifacts" |]) }
stage "CheckFormat" { run "dotnet fantomas src docs build.fsx --check" }
stage "Build" { run "dotnet build -c Release" }
stage "UnitTests" { run "dotnet test -c Release" }
stage "Pack" { run "dotnet pack --no-restore -c Release -o ./bin" }
stage "Build" { run "dotnet build -c Release --tl" }
stage "UnitTests" { run "dotnet test -c Release --tl" }
stage "Pack" { run "dotnet pack --no-restore -c Release --tl" }
stage "Docs" {
whenNot { platformOSX }
envVars
Expand All @@ -94,7 +74,7 @@ pipeline "Build" {

pipeline "Benchmark" {
workingDir __SOURCE_DIRECTORY__
stage "Prepare" { run "dotnet build -c Release src/Fantomas.Benchmarks" }
stage "Prepare" { run "dotnet build -c Release src/Fantomas.Benchmarks --tl" }
stage "Benchmark" { run $"dotnet {benchmarkAssembly}" }
runIfOnlySpecified true
}
Expand Down Expand Up @@ -154,7 +134,11 @@ pipeline "PushClient" {
run (fun _ ->
async {
return!
Directory.EnumerateFiles("bin", "Fantomas.Client.*.nupkg", SearchOption.TopDirectoryOnly)
Directory.EnumerateFiles(
"artifacts/package/release",
"Fantomas.Client.*.nupkg",
SearchOption.TopDirectoryOnly
)
|> Seq.tryExactlyOne
|> Option.map pushPackage
|> Option.defaultValue (
Expand Down Expand Up @@ -449,7 +433,7 @@ pipeline "Release" {
else
// Push packages to NuGet
let nugetPackages =
Directory.EnumerateFiles("bin", "*.nupkg", SearchOption.TopDirectoryOnly)
Directory.EnumerateFiles("artifacts/package/release", "*.nupkg", SearchOption.TopDirectoryOnly)
|> Seq.filter (fun nupkg -> not (nupkg.Contains("Fantomas.Client")))
|> Seq.toArray

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/end-users/Configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ UI might be available depending on the IDE.
*)

(*** hide ***)
#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.FCS.dll"
#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.Core.dll"
#r "../../../artifacts/bin/Fantomas.FCS/release/Fantomas.FCS.dll"
#r "../../../artifacts/bin/Fantomas.Core/release/Fantomas.Core.dll"

printf $"version: {Fantomas.Core.CodeFormatter.GetVersion()}"
(*** include-output ***)
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/end-users/GeneratingCode.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ In simple scenarios this can work out, but in the long run it doesn't scale well
To illustrate the API, lets generate a simple value binding: `let a = 0`.
*)

#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.FCS.dll"
#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.Core.dll" // In production use #r "nuget: Fantomas.Core, 6.*"
#r "../../../artifacts/bin/Fantomas.FCS/release/Fantomas.FCS.dll"
#r "../../../artifacts/bin/Fantomas.Core/release/Fantomas.Core.dll" // In production use #r "nuget: Fantomas.Core, 6.*"

open Fantomas.FCS.Text
open Fantomas.Core.SyntaxOak
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/end-users/GettingStarted.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ For the overview how to use the tool, you can type the command
open System.Diagnostics

let fantomasDll =
System.IO.Path.Combine(__SOURCE_DIRECTORY__, "../../../src/Fantomas/bin/Release/net6.0/fantomas.dll")
System.IO.Path.Combine(__SOURCE_DIRECTORY__, "../../../artifacts/bin/fantomas/release/fantomas.dll")

let output =
let psi = ProcessStartInfo("dotnet", $"{fantomasDll} --help")
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions src/Fantomas.Benchmarks/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"net8.0": {
"BenchmarkDotNet": {
"type": "Direct",
"requested": "[0.13.11, )",
"resolved": "0.13.11",
"contentHash": "BSsrfesUFgrjy/MtlupiUrZKgcBCCKmFXmNaVQLrBCs0/2iE/qH1puN7lskTE9zM0+MdiCr09zKk6MXKmwmwxw==",
"requested": "[0.13.13-nightly.20240213.132, )",
"resolved": "0.13.13-nightly.20240213.132",
"contentHash": "2dGQPEr47nGnsgipskl3rWS+dVWm+xkVzS/1jAF49VdDdGh6JLQkaVv5k59UewMF6ofGV1EvF5HeO55wwTRaww==",
"dependencies": {
"BenchmarkDotNet.Annotations": "0.13.11",
"BenchmarkDotNet.Annotations": "0.13.13-nightly.20240213.132",
"CommandLineParser": "2.9.1",
"Gee.External.Capstone": "2.3.0",
"Iced": "1.17.0",
Expand Down Expand Up @@ -46,8 +46,8 @@
},
"BenchmarkDotNet.Annotations": {
"type": "Transitive",
"resolved": "0.13.11",
"contentHash": "JOX+Bhp+PNnAtu/er9iGiN8QRIrYzilxUcJbwrF8VYyTNE8r4jlewa17/FbW1G7Jp2JUZwVS1A8a0bGILKhikw=="
"resolved": "0.13.13-nightly.20240213.132",
"contentHash": "G40jV79QmtgQbqaIPUmQ2CCswnfO7j/tdL0ENbAevVsuBW5rGoxj2V3NlMiSUQO9MogRk3rWMnXytFYcRFmP4w=="
},
"CommandLineParser": {
"type": "Transitive",
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Client.Tests/Fantomas.Client.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<NoWarn>FS0988</NoWarn>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<RollForward>Major</RollForward>
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Client.Tests/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"net8.0": {
"CliWrap": {
"type": "Direct",
"requested": "[3.6.4, )",
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/Fantomas.Core.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<NoWarn>FS0988</NoWarn>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<WarningsAsErrors>FS0025</WarningsAsErrors>
<IsPackable>false</IsPackable>
<RollForward>Major</RollForward>
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"net8.0": {
"FsCheck": {
"type": "Direct",
"requested": "[2.16.5, )",
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/Fantomas.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<NoWarn>FS0988</NoWarn>
Expand Down
6 changes: 5 additions & 1 deletion src/Fantomas.Tests/Integration/ForceTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ let ``code that was invalid should be still be written`` () =
let pwd = Path.GetDirectoryName(typeof<TemporaryFileCodeSample>.Assembly.Location)

let sourceFile =
Path.Combine(pwd, "..", "..", "..", "..", "..", "tests", "data", "CheckDeclarations.fs")
Path.Combine(pwd, "..", "..", "..", "..", "tests", "data", "CheckDeclarations.fs")
|> Path.GetFullPath

if not (File.Exists sourceFile) then
failwithf $"CheckDeclarations.fs was not found at \"%s{sourceFile}\""

use outputFixture = new OutputFile()

Expand Down
10 changes: 7 additions & 3 deletions src/Fantomas.Tests/TestHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,17 @@ let getFantomasToolStartInfo arguments : ProcessStartInfo =

let configuration =
#if DEBUG
"Debug"
"debug"
#else
"Release"
"release"
#endif

let fantomasDll =
Path.Combine(pwd, "..", "..", "..", "..", "Fantomas", "bin", configuration, "net6.0", "fantomas.dll")
Path.Combine(pwd, "..", "..", "Fantomas", configuration, "fantomas.dll")
|> Path.GetFullPath

if not (File.Exists fantomasDll) then
failwithf $"The fantomas dll at \"%s{fantomasDll}\" does not exist!"

let startInfo = ProcessStartInfo("dotnet")
startInfo.UseShellExecute <- false
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"net8.0": {
"FsCheck": {
"type": "Direct",
"requested": "[2.16.5, )",
Expand Down