From 73c52e168569d373266cb26112b87ad3aab1296f Mon Sep 17 00:00:00 2001 From: clovett Date: Thu, 8 Sep 2016 16:52:51 -0700 Subject: [PATCH] Fix incremental compile of *.4ml files. --- Src/CommandLine/CommandLine.sln | 10 ++++++++++ .../FormulaCodeGeneratorTask.Targets | 5 +++-- .../FormulaCodeGeneratorTask/GenerateItem.cs | 5 +++-- .../FormulaCodeGeneratorTask/Task.cs | 19 +++++++++++++++++++ .../API/LittleFuncLang/LittleFuncLang.4ml | 2 +- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Src/CommandLine/CommandLine.sln b/Src/CommandLine/CommandLine.sln index d1a1852..59a745c 100644 --- a/Src/CommandLine/CommandLine.sln +++ b/Src/CommandLine/CommandLine.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine", "CommandLine. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "..\Core\Core.csproj", "{1B5724EC-FFF1-48D7-A700-AD46F0150AFC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormulaCodeGeneratorTask", "..\Extensions\FormulaCodeGeneratorTask\FormulaCodeGeneratorTask.csproj", "{3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -31,6 +33,14 @@ Global {1B5724EC-FFF1-48D7-A700-AD46F0150AFC}.Release|x64.Build.0 = Release|x64 {1B5724EC-FFF1-48D7-A700-AD46F0150AFC}.Release|x86.ActiveCfg = Release|x86 {1B5724EC-FFF1-48D7-A700-AD46F0150AFC}.Release|x86.Build.0 = Release|x86 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Debug|x64.ActiveCfg = Debug|x64 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Debug|x64.Build.0 = Debug|x64 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Debug|x86.ActiveCfg = Debug|x86 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Debug|x86.Build.0 = Debug|x86 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Release|x64.ActiveCfg = Release|x64 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Release|x64.Build.0 = Release|x64 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Release|x86.ActiveCfg = Release|x86 + {3B52B4F5-52F5-4E19-88CD-6A4A78EA0BF1}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Src/Extensions/FormulaCodeGeneratorTask/FormulaCodeGeneratorTask.Targets b/Src/Extensions/FormulaCodeGeneratorTask/FormulaCodeGeneratorTask.Targets index 8b282f8..85a7aa3 100644 --- a/Src/Extensions/FormulaCodeGeneratorTask/FormulaCodeGeneratorTask.Targets +++ b/Src/Extensions/FormulaCodeGeneratorTask/FormulaCodeGeneratorTask.Targets @@ -7,11 +7,12 @@ $(MSBuildThisFileDirectory)\bin\$(FormulaCodeGeneratorBin)\FormulaCodeGeneratorTask.dll - + - + \ No newline at end of file diff --git a/Src/Extensions/FormulaCodeGeneratorTask/GenerateItem.cs b/Src/Extensions/FormulaCodeGeneratorTask/GenerateItem.cs index bbec960..44e3965 100644 --- a/Src/Extensions/FormulaCodeGeneratorTask/GenerateItem.cs +++ b/Src/Extensions/FormulaCodeGeneratorTask/GenerateItem.cs @@ -56,9 +56,11 @@ IsObjectGraph = isObjectGraph.Trim().ToUpperInvariant() != "FALSE"; IsNewOnly = isNewOnly.Trim().ToUpperInvariant() != "FALSE"; } - + public bool Generate(FormulaCodeGeneratorTask genTask) { + var outputFile = InputFile + ".g.cs"; + var env = new Env(); try { @@ -124,7 +126,6 @@ return true; } - var outputFile = InputFile + ".g.cs"; try { var outInfo = new System.IO.FileInfo(outputFile); diff --git a/Src/Extensions/FormulaCodeGeneratorTask/Task.cs b/Src/Extensions/FormulaCodeGeneratorTask/Task.cs index 8174445..e75e15d 100644 --- a/Src/Extensions/FormulaCodeGeneratorTask/Task.cs +++ b/Src/Extensions/FormulaCodeGeneratorTask/Task.cs @@ -24,6 +24,25 @@ set; } + public string[] Outputs { + get + { + List outputs = new List(); + var inputs = GeneratorInputs.Split(inputSplits, StringSplitOptions.None); + foreach (var input in inputs) + { + var parameters = input.Split(paramSplits, StringSplitOptions.None); + if (parameters.Length > 0) + { + string inputFile = parameters[0]; + var outputFile = inputFile + ".g.cs"; + outputs.Add(outputFile); + } + } + return outputs.ToArray(); + } + } + public override bool Execute() { var inputs = GeneratorInputs.Split(inputSplits, StringSplitOptions.None); diff --git a/Tst/Tests/API/LittleFuncLang/LittleFuncLang.4ml b/Tst/Tests/API/LittleFuncLang/LittleFuncLang.4ml index ec97262..0e49749 100644 --- a/Tst/Tests/API/LittleFuncLang/LittleFuncLang.4ml +++ b/Tst/Tests/API/LittleFuncLang/LittleFuncLang.4ml @@ -14,7 +14,7 @@ parent: Subexpr + { NIL }, loc: { LEFT, RIGHT, NIL }, let: Subexpr + { NIL }). - + Subexpr(e, p, l, t) :- e is Expr, p = NIL, l = NIL, t = NIL; p is Subexpr, e = p.expr.arg1, l = LEFT, t = p.let;