-
Couldn't load subscription status.
- Fork 833
Run TransparentCompiler unit tests with local response files. #16609
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
Conversation
✅ No release notes required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks!
It will probably need a refactoring at some point, since it's not just synthetic projects anymore. Maybe ProjectWorkflowBuilder could just work with FSharpProjectSnapshot eventually...
tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs
Outdated
Show resolved
Hide resolved
Yes, it is indeed becoming a bit of a hybrid between generated files and real files. |
tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs
Outdated
Show resolved
Hide resolved
tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs
Show resolved
Hide resolved
|
If anyone ever wants some inspiration how to apply this in a benchmark:
[<MemoryDiagnoser>]
[<ThreadingDiagnoser>]
[<SimpleJob(warmupCount=1,iterationCount=4)>]
[<BenchmarkCategory(LongCategory)>]
type RspFileTransparentCompilerBenchmark() =
let mutable benchmark : ProjectWorkflowBuilder = Unchecked.defaultof<_>
let responseFile = FileInfo @"C:\Users\nojaf\Projects\g-research-fsharp-analyzers\src\FSharp.Analyzers\FSharp.Analyzers.rsp"
let syntheticProject = mkSyntheticProjectForResponseFile responseFile
[<ParamsAllValues>]
member val UseTransparentCompiler = true with get,set
[<GlobalSetup>]
member this.Setup() =
benchmark <-
ProjectWorkflowBuilder(
syntheticProject,
isExistingProject = true,
useTransparentCompiler = this.UseTransparentCompiler,
runTimeout = 15_000).CreateBenchmarkBuilder()
[<Benchmark>]
member this.TypeCheckLastFile() =
use _ = Activity.start "Benchmark" [
"UseTransparentCompiler", this.UseTransparentCompiler.ToString()
]
let lastFile =
syntheticProject.SourceFiles
|> List.tryLast
|> Option.map (fun sf -> sf.Id)
match lastFile with
| None -> failwithf "Last file of project could not be found"
| Some lastFile ->
benchmark {
clearCache
checkFile lastFile expectOk
}I'm not sure this exact thing is useful to contribute but at least there is a trace of it now on the internet. |
Description
To experiment with the new Transparent Compiler on local projects, I've implemented infrastructure capable of handling a response file from a local project. This approach mirrors the tests in CompilationFromCmdlineArgsTests, offering valuable insights for local testing.
How to generate a response file?
Poor man's response file
Just run your regular
dotnet build -v:nwith Verbosity set to normal, wait until you seeCoreCompileand grab the compiler arguments.Via script
The scrape.fsx script does a build of a project and extracts it from the bin log file.
Via Telplin
My Telplin tool has a bit of a hidden feature that it can save the response file without generating any signatures at all.
dotnet tool install -g telplinand thentelplin --only-record MyProject.fsprojChecklist
Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated: