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

Publish AOT artefacts for Fantomas #3090

Draft
wants to merge 28 commits into
base: v7.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d92e7ea
Initial move to net8.0
TobyShaw May 31, 2024
0ffbda7
Revert changes to package lock file
TobyShaw May 31, 2024
9eef6e5
Argu swapped for Fargo, %A gone, fails to arg parse in AOT mode though
TobyShaw May 31, 2024
061a5e0
Fix based on https://github.com/dotnet/fsharp/issues/15488
TobyShaw Jun 1, 2024
125a45c
Fix formatting, remove some %As
TobyShaw Jun 3, 2024
175844a
Merge branch 'main' into publish-aot
TobyShaw Jun 10, 2024
fad7331
Merge branch 'main' into publish-aot
TobyShaw Jul 8, 2024
e46e67d
Revert package.lock changes
TobyShaw Jul 8, 2024
e50a116
Update lock files
TobyShaw Jul 8, 2024
9a9e85e
Update lock files
TobyShaw Jul 8, 2024
68de57c
More fixes to lock files
TobyShaw Jul 8, 2024
ca9203d
Improve help text + arg parsing
TobyShaw Jul 8, 2024
81f072a
Fix literal formatting tests
TobyShaw Jul 8, 2024
2121002
Add comment about UInt16s
TobyShaw Jul 8, 2024
e3d8e61
Add files to github release
TobyShaw Jul 8, 2024
9d85c94
Fix formatting
TobyShaw Jul 8, 2024
a8b226e
Only AOT when explicitly stated
TobyShaw Jul 8, 2024
65ddf64
Fix args again, back to builder
TobyShaw Jul 8, 2024
d582cb5
Merge branch 'main' into publish-aot
TobyShaw Jul 10, 2024
03c3105
Update Fantomas.fsproj
TobyShaw Jul 10, 2024
dc99723
Update build.fsx
TobyShaw Jul 10, 2024
dd7b8b9
Update Directory.Build.props
TobyShaw Jul 10, 2024
d15dd0e
Delete src/Fantomas.Client/packages.linux-x64.lock.json
TobyShaw Jul 10, 2024
2b56ab9
Delete src/Fantomas.Core/packages.linux-x64.lock.json
TobyShaw Jul 10, 2024
f36dedd
Delete src/Fantomas.FCS/packages.linux-x64.lock.json
TobyShaw Jul 10, 2024
5875dad
Delete src/Fantomas/packages.linux-x64.lock.json
TobyShaw Jul 10, 2024
59a8707
Merge branch 'main' into publish-aot
TobyShaw Aug 3, 2024
8e3ea71
Formatting
TobyShaw Aug 3, 2024
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
&& apt-get -y install git iproute2 procps lsb-release clang libz-dev \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,5 @@ tests/.repositories/**

# Analyzer files
.analyzerpackages
*.sarif
*.sarif
.fake
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="FSharp.Core" Version="6.0.1"/>
<PackageVersion Include="FSharp.Core" Version="8.0.100"/>
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="7.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
Expand All @@ -22,7 +22,7 @@
<PackageVersion Include="Serilog" Version="3.1.1"/>
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="SerilogTraceListener" Version="3.2.1-dev-00011" />
<PackageVersion Include="Argu" Version="6.2.4" />
<PackageVersion Include="Fargo.Cmdline" Version="1.1.14" />
<PackageVersion Include="Thoth.Json.Net" Version="8.0.0" />
<PackageVersion Include="editorconfig" Version="0.15.0" />
<PackageVersion Include="Ignore" Version="0.1.50" />
Expand Down
11 changes: 10 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pipeline "Build" {
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 "PublishAOT" {
run
"dotnet publish src/Fantomas/Fantomas.fsproj -r linux-x64 -c Release -p:DoPublishAot=yes -p:RestoreLockedMode=false --tl"
}
stage "Docs" {
whenNot { platformOSX }
envVars
Expand Down Expand Up @@ -441,12 +445,17 @@ pipeline "Release" {
|> Seq.filter (fun nupkg -> not (nupkg.Contains("Fantomas.Client")))
|> Seq.toArray

let aotCompiledExecutableFiles =
[ "fantomas"; "fantomas.dbg" ]
|> List.map (fun file -> $"artifacts/publish/Fantomas/release_linux-x64/%s{file}")

let! nugetExitCodes = nugetPackages |> Array.map pushPackage |> Async.Sequential

let notes = getReleaseNotes currentRelease lastRelease
let noteFile = Path.GetTempFileName()
File.WriteAllText(noteFile, notes)
let files = nugetPackages |> String.concat " "
let files =
[ yield! nugetPackages; yield! aotCompiledExecutableFiles ] |> String.concat " "

// We create a draft release for minor and majors. Those that requires a manual publish.
// This is to allow us to add additional release notes when it makes sense.
Expand Down
46 changes: 21 additions & 25 deletions fake-sample/script.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,29 @@ open Fake.DotNet

let sourceFiles = !! "*.fs"

Target.create
"CheckFormat"
(fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> sprintf "%s --check"
|> DotNet.exec id "fantomas"
Target.create "CheckFormat" (fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> sprintf "%s --check"
|> DotNet.exec id "fantomas"

if result.ExitCode = 0 then
Trace.log "No files need formatting"
elif result.ExitCode = 99 then
failwith "Some files need formatting, check output for more info"
else
Trace.logf "Errors while formatting: %A" result.Errors)
if result.ExitCode = 0 then
Trace.log "No files need formatting"
elif result.ExitCode = 99 then
failwith "Some files need formatting, check output for more info"
else
Trace.logf "Errors while formatting: %A" result.Errors)

Target.create
"Format"
(fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> DotNet.exec id "fantomas"
Target.create "Format" (fun _ ->
let result =
sourceFiles
|> Seq.map (sprintf "\"%s\"")
|> String.concat " "
|> DotNet.exec id "fantomas"

if not result.OK then
printfn "Errors while formatting all files: %A" result.Messages)
if not result.OK then
printfn "Errors while formatting all files: %A" result.Messages)

Target.runOrList ()
10 changes: 5 additions & 5 deletions src/Fantomas.Benchmarks/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
Expand Down Expand Up @@ -274,14 +274,14 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"Fantomas.FCS": "[1.0.0, )"
}
},
"fantomas.fcs": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Client.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
Expand Down
10 changes: 5 additions & 5 deletions src/Fantomas.Core.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"FsUnit": {
"type": "Direct",
Expand Down Expand Up @@ -149,14 +149,14 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"Fantomas.FCS": "[1.0.0, )"
}
},
"fantomas.fcs": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
Expand Down
35 changes: 21 additions & 14 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,27 @@ let mkConstant (creationAide: CreationAide) c r : Constant =
match c with
| SynConst.Unit -> mkUnit r |> Constant.Unit
| SynConst.Bool b -> stn (if b then "true" else "false") r |> Constant.FromText
| SynConst.Byte v -> orElse $"%A{v}"
| SynConst.SByte v -> orElse $"%A{v}"
| SynConst.Int16 v -> orElse $"%A{v}"
| SynConst.Int32 v -> orElse $"%A{v}"
| SynConst.Int64 v -> orElse $"%A{v}"
| SynConst.UInt16 v -> orElse $"%A{v}"
| SynConst.UInt16s v -> orElse $"%A{v}"
| SynConst.UInt32 v -> orElse $"%A{v}"
| SynConst.UInt64 v -> orElse $"%A{v}"
| SynConst.Double v -> orElse $"%A{v}"
| SynConst.Single v -> orElse $"%A{v}"
| SynConst.Decimal v -> orElse $"%A{v}"
| SynConst.IntPtr v -> orElse $"%A{v}"
| SynConst.UIntPtr v -> orElse $"%A{v}"
| SynConst.Byte v -> orElse (v.ToString() + "uy")
| SynConst.SByte v -> orElse (v.ToString() + "y")
| SynConst.Int16 v -> orElse (v.ToString() + "s")
| SynConst.Int32 v -> orElse (v.ToString())
| SynConst.Int64 v -> orElse (v.ToString() + "L")
| SynConst.UInt16 v -> orElse (v.ToString() + "us")
// This formatting is likely imperfect, but SynConst.UInt16s is only used internally to the F# compiler.
| SynConst.UInt16s v ->
orElse (
v
|> Array.map (fun uint16 -> (uint16.ToString() + "us"))
|> String.concat "; "
|> sprintf "[| %s |]"
)
| SynConst.UInt32 v -> orElse (v.ToString() + "u")
| SynConst.UInt64 v -> orElse (v.ToString() + "uL")
| SynConst.Double v -> orElse (v.ToString("r"))
| SynConst.Single v -> orElse (v.ToString("r") + "f")
| SynConst.Decimal v -> orElse (sprintf "%sM" (v.ToString()))
| SynConst.IntPtr v -> orElse (v.ToString() + "n")
| SynConst.UIntPtr v -> orElse (v.ToString() + "un")
| SynConst.UserNum(v, s) ->
let fallback () = $"%s{v}%s{s}"
stn (creationAide.TextFromSource fallback r) r |> Constant.FromText
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core/Selection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ let mkTreeWithSingleNode (node: Node) : TreeForSelection =
let printTriviaNode (node: Node) : unit =
let rec visit (level: int) (node: Node) =
let name = node.GetType().Name
printfn "%s%s: %A" ("".PadRight(level * 2)) name node.Range
printfn "%s%s: %O" ("".PadRight(level * 2)) name node.Range
Array.iter (visit (level + 1)) node.Children

visit 0 node
Expand Down
8 changes: 4 additions & 4 deletions src/Fantomas.Core/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
Expand Down Expand Up @@ -127,7 +127,7 @@
"fantomas.fcs": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.FCS/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"FsLexYacc": {
"type": "Direct",
Expand Down
46 changes: 16 additions & 30 deletions src/Fantomas.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
},
"FSharp.Core": {
"type": "Direct",
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
"requested": "[8.0.100, )",
"resolved": "8.0.100",
"contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"FsUnit": {
"type": "Direct",
Expand Down Expand Up @@ -331,14 +331,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "gWwQv/Ug1qWJmHCmN17nAbxJYmQBM/E94QxKLksvUiiKB1Ld3Sc/eK1lgmbSjDFxkQhVuayI/cGFZhpBSodLrg==",
"dependencies": {
"System.Security.Cryptography.ProtectedData": "4.4.0"
}
},
"System.Diagnostics.Debug": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -719,11 +711,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Security.Cryptography.ProtectedData": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
},
"System.Security.Cryptography.X509Certificates": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -825,10 +812,10 @@
"fantomas": {
"type": "Project",
"dependencies": {
"Argu": "[6.2.4, )",
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"Fantomas.Client": "[1.0.0, )",
"Fantomas.Core": "[1.0.0, )",
"Fargo.Cmdline": "[1.1.14, )",
"Ignore": "[0.1.50, )",
"Serilog": "[3.1.1, )",
"Serilog.Sinks.Console": "[5.0.1, )",
Expand All @@ -851,36 +838,35 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"Fantomas.FCS": "[1.0.0, )"
}
},
"fantomas.fcs": {
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"FSharp.Core": "[8.0.100, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
}
},
"Argu": {
"type": "CentralTransitive",
"requested": "[6.2.4, )",
"resolved": "6.2.4",
"contentHash": "RuANu8+L1P2HWozmbRXkj6MQGYwP5DL2wdARfBPtRjsLS8TSgwYjOKxMnY5LtjmHLlMBD3u2+MfbAy8xMGg8Qg==",
"dependencies": {
"FSharp.Core": "6.0.7",
"System.Configuration.ConfigurationManager": "4.4.0"
}
},
"editorconfig": {
"type": "CentralTransitive",
"requested": "[0.15.0, )",
"resolved": "0.15.0",
"contentHash": "NuUxFbycSCOhl0WzmNZ8ksSMrTHBFzTASkil+IOqXpqTXszokKjy6ihxMdjArGaC+AaLLq4nxfGVFLi6KWyFJg=="
},
"Fargo.CmdLine": {
"type": "CentralTransitive",
"requested": "[1.1.14, )",
"resolved": "1.1.14",
"contentHash": "gzlReYsGi3CWO4GUKFtEjzB4C85+/kzVrUPXt0sB2kNCB/Cc/ih7RkXPR9yF6AhOdXQ2QcPc2yeBi4SAUMJLlg==",
"dependencies": {
"FSharp.Core": "7.0.400"
}
},
"Ignore": {
"type": "CentralTransitive",
"requested": "[0.1.50, )",
Expand Down
Loading
Loading