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
Unify app and view assembly for Razor #16168
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
cc09a68
to
e3dbd15
Compare
7827f7c
to
68c5bd1
Compare
src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.Compilation.targets
Outdated
Show resolved
Hide resolved
|
||
RazorCoreCompile and any other targets that are needed for two-step compilation should be defined there. | ||
--> | ||
<Import Project="Microsoft.NET.Sdk.Razor.Compilation.targets" Condition="'$(_UseRazorSourceGenerator)' != 'true'"/> |
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.
Is there any fun stuff in here (properties or items) that requires it to be imported where it was previously imported? For .e.g
<!-- <Import Project="X.target" /> -->
<PropertyGroup>
<Foo>X</Foo>
</PropertyGroup>
<!-- <Import Project="Y.targets" /> -->
<PropertyGroup>
<Foo>$(Foo);X</Foo>
</PropertyGroup>
Would behave differently if you change the order in which X and Y are imported.
src/Tests/Microsoft.NET.Sdk.Razor.Tests/BuildIncrementalismTest.cs
Outdated
Show resolved
Hide resolved
src/Tests/Microsoft.NET.Sdk.Razor.Tests/BuildIncrementalismTest.cs
Outdated
Show resolved
Hide resolved
@@ -78,9 +86,18 @@ private void GenerateViews(GeneratorExecutionContext context, RazorSourceGenerat | |||
context.ReportDiagnostic(csharpDiagnostic); | |||
} | |||
|
|||
Directory.CreateDirectory(Path.GetDirectoryName(file.GeneratedOutputPath)); | |||
File.WriteAllText(file.GeneratedOutputPath, csharpDocument.GeneratedCode); |
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.
FYI @jaredpar
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -221,6 +240,13 @@ private static IReadOnlyList<TagHelperDescriptor> GetTagHelperDescriptorsFromRef | |||
return tagHelperDescriptors; | |||
} | |||
|
|||
private static void PopulateAssemblyInfo(GeneratorExecutionContext context) | |||
{ | |||
var typeInfo = "typeof(global::Microsoft.AspNetCore.Mvc.ApplicationParts.ConsolidatedAssemblyApplicationPartFactory), global::Microsoft.AspNetCore.Mvc.Razor"; |
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.
You shouldn't need this: , global::Microsoft.AspNetCore.Mvc.Razor
{ | ||
var typeInfo = "typeof(global::Microsoft.AspNetCore.Mvc.ApplicationParts.ConsolidatedAssemblyApplicationPartFactory), global::Microsoft.AspNetCore.Mvc.Razor"; | ||
var assemblyInfo = $@"[assembly: global::Microsoft.AspNetCore.Mvc.ApplicationParts.ProvideApplicationPartFactoryAttribute(""{typeInfo}"")]"; | ||
context.AddSource($"{context.Compilation.AssemblyName}.UnifiedAssembly.Info", SourceText.From(assemblyInfo, Encoding.UTF8)); |
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.
Btw, this one is ripe for being statically cached
486a71a
to
33a5d18
Compare
No description provided.