Uh oh!
There was an error while loading. Please reload this page.
Run TransparentCompiler unit tests with local response files. - #16609
Conversation
nojaf
commented
Jan 30, 2024
✅ No release notes required |
0101
left a comment
There was a problem hiding this comment.
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...
Uh oh!
There was an error while loading. Please reload this page.
nojaf
commented
Jan 30, 2024
Yes, it is indeed becoming a bit of a hybrid between generated files and real files. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nojaf
commented
Jan 31, 2024
If anyone ever wants some inspiration how to apply this in a benchmark: [<MemoryDiagnoser>][<ThreadingDiagnoser>][<SimpleJob(warmupCount=1,iterationCount=4)>][<BenchmarkCategory(LongCategory)>]typeRspFileTransparentCompilerBenchmark()=let mutablebenchmark:ProjectWorkflowBuilder = Unchecked.defaultof<_>letresponseFile= FileInfo @"C:\Users\nojaf\Projects\g-research-fsharp-analyzers\src\FSharp.Analyzers\FSharp.Analyzers.rsp"letsyntheticProject= mkSyntheticProjectForResponseFile responseFile
[<ParamsAllValues>]member valUseTransparentCompiler=truewith get,set
[<GlobalSetup>]memberthis.Setup()=
benchmark <-
ProjectWorkflowBuilder(
syntheticProject,
isExistingProject =true,
useTransparentCompiler = this.UseTransparentCompiler,
runTimeout =15_000).CreateBenchmarkBuilder()[<Benchmark>]memberthis.TypeCheckLastFile()=use _ = Activity.start "Benchmark"["UseTransparentCompiler", this.UseTransparentCompiler.ToString()]letlastFile=
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: