From 627696677ce5b4eeabe71866b58bbee0b62ab742 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Wed, 17 Jan 2018 12:52:17 -0800 Subject: [PATCH] Split up Razor SDK logic (#1934) * Split up Razor SDK logic Splitting the fragile parts of code generation into its own file. We're possibly separating the Razor SDK into a part that ships in the dotnet SDK and part that ships in a nupkg with the compiler. This means defining more of a fixed lifecycle in the main file, and treating our actual work as more like extensibility. --- ...etCore.Razor.Design.CodeGeneration.targets | 126 ++++++++++++ ...spNetCore.Razor.Design.Compilation.targets | 3 +- .../Microsoft.AspNetCore.Razor.Design.props | 12 -- .../Microsoft.AspNetCore.Razor.Design.targets | 190 +++++++----------- 4 files changed, 197 insertions(+), 134 deletions(-) create mode 100644 src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets diff --git a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets new file mode 100644 index 0000000000..5b1648e93c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets @@ -0,0 +1,126 @@ + + + + + + + <_RazorTagHelperInputCache>$(IntermediateOutputPath)$(TargetName).TagHelpers.input.cache + <_RazorTagHelperOutputCache>$(IntermediateOutputPath)$(TargetName).TagHelpers.output.cache + + + <_RazorGenerateToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.GenerateTool.dll + <_RazorTagHelperToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.TagHelperTool.dll + + + <_RazorGenerateInputsHash> + <_RazorGenerateInputsHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorCoreGenerate.cache + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_RazorGenerateOutput Include="%(RazorGenerate.GeneratedOutput)" Condition="'%(RazorGenerate.GeneratedOutput)'!=''"/> + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets index 7c81a86899..02df10972a 100644 --- a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets +++ b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets @@ -11,7 +11,7 @@ embedded files and resources, these are already present in the application's assembly. Changes: - Name="RazorCoreCompile" and DependsOnTarget="RazorCoreGenerate" + Name="RazorCoreCompile" Replace @(Compile) with @(RazorCompile) Replace @(_DebugSymbolsIntermediatePath) with @(_RazorDebugSymbolsIntermediatePath) @@ -47,7 +47,6 @@ Outputs="@(RazorIntermediateAssembly); @(_RazorDebugSymbolsIntermediatePath); $(NonExistentFile)" - DependsOnTargets="RazorCoreGenerate" Condition="'@(RazorCompile)'!=''"> - - - RazorResolveGenerateInputs;RazorCoreGenerate - RazorGenerate;RazorCoreCompile - - - - + + + ResolveRazorGenerateInputs; + ResolveAssemblyReferenceRazorGenerateInputs; + ResolveTagHelperRazorGenerateInputs + - - + + PrepareForRazorGenerate; + RazorCoreGenerate + + + + RazorGenerate; + ResolveRazorCompileInputs; + - - - - - RazorCompile;$(PrepareForRunDependsOn);_RazorCopyFilesToOutputDirectory - $(GetCopyToOutputDirectoryItemsDependsOn);_RazorGetCopyToOutputDirectoryItems + + PrepareForRazorCompile; + RazorCoreCompile + - - <_RazorTagHelperInputCache>$(IntermediateOutputPath)$(TargetName).TagHelpers.input.cache - <_RazorTagHelperOutputCache>$(IntermediateOutputPath)$(TargetName).TagHelpers.output.cache - - - <_RazorGenerateToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.GenerateTool.dll - <_RazorTagHelperToolAssembly>$(_RazorMSBuildRoot)tools\Microsoft.AspNetCore.Razor.TagHelperTool.dll - <_RazorDebugSymbolsProduced>false <_RazorDebugSymbolsProduced Condition="'$(DebugSymbols)'=='true'">true @@ -81,48 +92,45 @@ - - - - <_RazorGenerateOutput Include="@(RazorGenerate->'$(RazorGenerateOutputPath)%(RelativeDir)%(Filename).cs')" /> - + + + + + + + + + + + + + + + + + RazorCompile;$(PrepareForRunDependsOn);_RazorCopyFilesToOutputDirectory + $(GetCopyToOutputDirectoryItemsDependsOn);_RazorGetCopyToOutputDirectoryItems + + - - - - <_RazorGenerateHashFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorCoreGenerate.cache - - - - - - - - - - + - + + $(RazorGenerateOutputPath)%(RelativeDir)%(Filename).cs + @@ -130,7 +138,7 @@ Gathers input assemblies for Tag Helper discovery and compilation. Add items to @(ReferencePath) --> @@ -138,73 +146,15 @@ - - - - - - - - - - + + - - - - - - - - - - - - - - - - -