From d31327b65d90508b5173ab4714b56e94c2bcdcde Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sat, 20 Jan 2018 16:06:33 +0000 Subject: [PATCH] don't rebuild --- src/fsharp/FSharp.Build/WriteCodeFragment.fs | 10 +++++++--- tests/scripts/compiler-perf-results.txt | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Build/WriteCodeFragment.fs b/src/fsharp/FSharp.Build/WriteCodeFragment.fs index ee8eaab2830..1002a489b10 100644 --- a/src/fsharp/FSharp.Build/WriteCodeFragment.fs +++ b/src/fsharp/FSharp.Build/WriteCodeFragment.fs @@ -113,15 +113,19 @@ open System.Reflection" let sb = StringBuilder().AppendLine(boilerplate).AppendLine() let code = Array.fold (fun (sb:StringBuilder) (item:ITaskItem) -> sb.AppendLine(WriteCodeFragment.GenerateAttribute item)) sb _assemblyAttributes code.AppendLine().AppendLine("do()") |> ignore + let fileName = _outputFile.ItemSpec let outputFileItem = - if not (isNull _outputFile) && not (isNull _outputDirectory) && not (Path.IsPathRooted(_outputFile.ItemSpec)) then - TaskItem(Path.Combine(_outputDirectory.ItemSpec, _outputFile.ItemSpec)) :> ITaskItem + if not (isNull _outputFile) && not (isNull _outputDirectory) && not (Path.IsPathRooted(fileName)) then + TaskItem(Path.Combine(_outputDirectory.ItemSpec, fileName)) :> ITaskItem elif isNull _outputFile then let tempFile = Path.Combine(Path.GetTempPath(), sprintf "tmp%s.fs" (Guid.NewGuid().ToString("N"))) TaskItem(tempFile) :> ITaskItem else _outputFile - File.WriteAllText(_outputFile.ItemSpec, code.ToString()) + let codeText = code.ToString() + let alreadyExists = (try File.Exists fileName && File.ReadAllText(fileName) = codeText with _ -> false) + if not alreadyExists then + File.WriteAllText(fileName, codeText) _outputFile <- outputFileItem true with e -> diff --git a/tests/scripts/compiler-perf-results.txt b/tests/scripts/compiler-perf-results.txt index 56be78c3cbb..ee00b0994f9 100644 --- a/tests/scripts/compiler-perf-results.txt +++ b/tests/scripts/compiler-perf-results.txt @@ -131,4 +131,3 @@ https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-t https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 ba63403cb5898596c5e875a14ce22b33ef618c01 221.58 11.19 31.91 48.23 66.05 52.99 https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 458e6c29d7e059a5a8a7b4cd7858c7d633fb5906 224.75 11.20 31.09 46.96 63.08 53.08 https://github.com/manofstick/visualfsharp.git all-your-collections-are-belong-to-us 87dafbc17b494c438b6db9e59e064736bd8a44e2 7e1fd6ac330f86597f3167e8067cfd805a89eec9 235.48 10.83 33.47 47.17 65.56 52.50 -