Skip to content

Commit 69d077c

Browse files
authored
Remove EA.RazorCompiler reference (#9649)
1 parent 96a1ad3 commit 69d077c

File tree

9 files changed

+1
-160
lines changed

9 files changed

+1
-160
lines changed

eng/Version.Details.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
<Uri>https://github.com/dotnet/roslyn</Uri>
2424
<Sha>06d7179e0a2ad184610fb9659ea35c7da8f47305</Sha>
2525
</Dependency>
26-
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler" Version="4.8.0-3.23475.1">
27-
<Uri>https://github.com/dotnet/roslyn</Uri>
28-
<Sha>06d7179e0a2ad184610fb9659ea35c7da8f47305</Sha>
29-
</Dependency>
3026
<Dependency Name="Microsoft.CodeAnalysis.Common" Version="4.8.0-3.23475.1">
3127
<Uri>https://github.com/dotnet/roslyn</Uri>
3228
<Sha>06d7179e0a2ad184610fb9659ea35c7da8f47305</Sha>

eng/Versions.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
<MicrosoftNetCompilersToolsetPackageVersion>4.8.0-3.23475.1</MicrosoftNetCompilersToolsetPackageVersion>
5656
<MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>4.8.0-3.23475.1</MicrosoftCommonLanguageServerProtocolFrameworkPackageVersion>
5757
<MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>4.8.0-3.23475.1</MicrosoftCodeAnalysisExternalAccessRazorPackageVersion>
58-
<MicrosoftCodeAnalysisExternalAccessRazorCompilerPackageVersion>4.8.0-3.23475.1</MicrosoftCodeAnalysisExternalAccessRazorCompilerPackageVersion>
5958
<MicrosoftCodeAnalysisCommonPackageVersion>4.8.0-3.23475.1</MicrosoftCodeAnalysisCommonPackageVersion>
6059
<MicrosoftCodeAnalysisCSharpPackageVersion>4.8.0-3.23475.1</MicrosoftCodeAnalysisCSharpPackageVersion>
6160
<MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>4.8.0-3.23475.1</MicrosoftCodeAnalysisCSharpEditorFeaturesPackageVersion>

src/Compiler/Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="$(MicrosoftCodeAnalysisCommonPackageVersion)" />
1212
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpPackageVersion)" />
1313
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion)" />
14-
<PackageVersion Include="Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler" Version="$(MicrosoftCodeAnalysisExternalAccessRazorCompilerPackageVersion)" />
1514
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="$(MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion)" />
1615
<PackageVersion Include="Microsoft.CSharp" Version="$(MicrosoftCSharpVersion)" />
1716
<PackageVersion Include="Microsoft.Css.Parser" Version="$(MicrosoftCssParserVersion)" />

src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,13 @@
1212
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
1313
</PropertyGroup>
1414

15-
<ItemGroup>
16-
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler" ExcludeAssets="all" GeneratePathProperty="true" />
17-
</ItemGroup>
18-
1915
<ItemGroup>
2016
<ProjectReference Include="..\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators.csproj" />
2117
<ProjectReference Include="..\tools\Microsoft.CodeAnalysis.Razor.Tooling.Internal\Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj" />
2218
</ItemGroup>
2319

2420
<Target Name="PackLayout" BeforeTargets="$(GenerateNuspecDependsOn)">
2521
<ItemGroup>
26-
<Content Include="$(PkgMicrosoft_CodeAnalysis_ExternalAccess_RazorCompiler)\lib\netstandard2.0\*.dll" PackagePath="\source-generators" />
2722
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\$(Configuration)\netstandard2.0\*.*" Exclude="$(ArtifactsBinDir)**\*.pdb" PackagePath="\source-generators" />
2823
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Tooling.Internal\$(Configuration)\netstandard2.0\Microsoft.Extensions.ObjectPool.dll" PackagePath="\source-generators" />
2924
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Tooling.Internal\$(Configuration)\netstandard2.0\System.Collections.Immutable.dll" PackagePath="\source-generators" />

src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators/Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
2020

2121
<!-- IMPORTANT: Ensure all dependencies are embedded in the transport and toolset package. -->
22-
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler" />
2322
</ItemGroup>
2423

2524
<ItemGroup>

src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators/RazorSourceGenerator.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
197197
.WithLambdaComparer((old, @new) => old.Left.Equals(@new.Left) && old.Right.SequenceEqual(@new.Right))
198198
.Combine(razorSourceGeneratorOptions);
199199

200+
// Currently unused. See https://github.com/dotnet/roslyn/issues/71024.
200201
var razorHostOutputsEnabled = analyzerConfigOptions.CheckGlobalFlagSet("EnableRazorHostOutputs");
201202
var withOptionsDesignTime = withOptions.EmptyWhen(razorHostOutputsEnabled, false);
202203

@@ -302,16 +303,6 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
302303

303304
context.AddSource(hintName, csharpDocument.GeneratedCode);
304305
});
305-
306-
// ExternalAccess.RazorCompiler does not have IVT to the new assembly.
307-
// https://github.com/dotnet/razor/issues/8400
308-
// context.RegisterHostOutput(processed(designTime: true), static (context, pair, _) =>
309-
// {
310-
// var (filePath, document) = pair;
311-
// var hintName = GetIdentifierFromPath(filePath);
312-
// context.AddOutput(hintName + ".rsg.cs", document.CodeDocument.GetCSharpDocument().GeneratedCode);
313-
// context.AddOutput(hintName + ".rsg.html", document.CodeDocument.GetHtmlDocument().GeneratedCode);
314-
// });
315306
}
316307
}
317308
}

src/Compiler/Microsoft.Net.Compilers.Razor.Toolset/Microsoft.Net.Compilers.Razor.Toolset.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
</PackageDescription>
2323
</PropertyGroup>
2424

25-
<ItemGroup>
26-
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler" ExcludeAssets="all" GeneratePathProperty="true" />
27-
</ItemGroup>
28-
2925
<ItemGroup>
3026
<ProjectReference Include="..\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators.csproj" PrivateAssets="all" />
3127
<ProjectReference Include="..\tools\Microsoft.CodeAnalysis.Razor.Tooling.Internal\Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj" PrivateAssets="all"/>
@@ -38,7 +34,6 @@
3834

3935
<Target Name="PackLayout" BeforeTargets="$(GenerateNuspecDependsOn)">
4036
<ItemGroup>
41-
<Content Include="$(PkgMicrosoft_CodeAnalysis_ExternalAccess_RazorCompiler)\lib\netstandard2.0\*.dll" PackagePath="\source-generators" />
4237
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\$(Configuration)\$(TargetFramework)\*.dll" PackagePath="\source-generators" />
4338
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Tooling.Internal\$(Configuration)\$(TargetFramework)\Microsoft.Extensions.ObjectPool.dll" PackagePath="\source-generators" />
4439
<Content Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Razor.Tooling.Internal\$(Configuration)\$(TargetFramework)\System.Collections.Immutable.dll" PackagePath="\source-generators" />

src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -131,99 +131,6 @@ public class MyModel { }
131131
Assert.Equal(2, result.GeneratedSources.Length);
132132
}
133133

134-
[Fact(Skip = "Host outputs disabled - https://github.com/dotnet/razor/issues/8400")]
135-
public async Task SourceGenerator_RazorFiles_DesignTime()
136-
{
137-
// Arrange
138-
var project = CreateTestProject(new()
139-
{
140-
["Pages/Index.razor"] = "<h1>Hello world</h1>",
141-
});
142-
143-
var compilation = await project.GetCompilationAsync();
144-
var (driver, additionalTexts, optionsProvider) = await GetDriverWithAdditionalTextAndProviderAsync(project, hostOutputs: true);
145-
146-
// Enable design-time.
147-
var options = optionsProvider.Clone();
148-
options.TestGlobalOptions["build_property.RazorDesignTime"] = "true";
149-
options.TestGlobalOptions["build_property.EnableRazorHostOutputs"] = "true";
150-
var driver2 = driver.WithUpdatedAnalyzerConfigOptions(options);
151-
152-
var result = RunGenerator(compilation!, ref driver2);
153-
154-
var pageOutput =
155-
@"#pragma checksum ""Pages/Index.razor"" ""{ff1816ec-aa5e-4d10-87f7-6f4963833460}"" ""6b5db227a6aa2228c777b0771108b184b1fc5df3""
156-
// <auto-generated/>
157-
#pragma warning disable 1591
158-
namespace MyApp.Pages
159-
{
160-
#line hidden
161-
using global::System;
162-
using global::System.Collections.Generic;
163-
using global::System.Linq;
164-
using global::System.Threading.Tasks;
165-
using global::Microsoft.AspNetCore.Components;
166-
public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
167-
{
168-
#pragma warning disable 1998
169-
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
170-
{
171-
__builder.AddMarkupContent(0, ""<h1>Hello world</h1>"");
172-
}
173-
#pragma warning restore 1998
174-
}
175-
}
176-
#pragma warning restore 1591
177-
";
178-
result.VerifyPageOutput(pageOutput);
179-
180-
result.VerifyHostOutput(
181-
(@"Pages_Index_razor.rsg.cs", @"// <auto-generated/>
182-
#pragma warning disable 1591
183-
namespace MyApp.Pages
184-
{
185-
#line hidden
186-
using global::System;
187-
using global::System.Collections.Generic;
188-
using global::System.Linq;
189-
using global::System.Threading.Tasks;
190-
using global::Microsoft.AspNetCore.Components;
191-
public partial class Index : global::Microsoft.AspNetCore.Components.ComponentBase
192-
{
193-
#pragma warning disable 219
194-
private void __RazorDirectiveTokenHelpers__() {
195-
}
196-
#pragma warning restore 219
197-
#pragma warning disable 0414
198-
private static object __o = null;
199-
#pragma warning restore 0414
200-
#pragma warning disable 1998
201-
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
202-
{
203-
}
204-
#pragma warning restore 1998
205-
}
206-
}
207-
#pragma warning restore 1591
208-
"),
209-
(@"Pages_Index_razor.rsg.html", @"<h1>Hello world</h1>"));
210-
211-
Assert.Empty(result.Diagnostics);
212-
Assert.Single(result.GeneratedSources);
213-
214-
// Enable design-time without host outputs.
215-
options = optionsProvider.Clone();
216-
options.TestGlobalOptions["build_property.RazorDesignTime"] = "true";
217-
driver2 = driver.WithUpdatedAnalyzerConfigOptions(options);
218-
219-
result = RunGenerator(compilation!, ref driver2);
220-
result.VerifyPageOutput(pageOutput);
221-
result.VerifyHostOutput();
222-
223-
Assert.Empty(result.Diagnostics);
224-
Assert.Single(result.GeneratedSources);
225-
}
226-
227134
[Fact]
228135
public async Task SourceGeneratorEvents_RazorFiles_Works()
229136
{

src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTestsBase.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
using Microsoft.CodeAnalysis;
3131
using Microsoft.CodeAnalysis.CSharp;
3232
using Microsoft.CodeAnalysis.Diagnostics;
33-
using Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler;
3433
using Microsoft.CodeAnalysis.Test.Utilities;
3534
using Microsoft.Extensions.DependencyInjection;
3635
using Microsoft.Extensions.DependencyModel;
@@ -421,29 +420,6 @@ public static GeneratorRunResult VerifyPageOutput(this GeneratorRunResult result
421420
return result;
422421
}
423422

424-
public static GeneratorRunResult VerifyHostOutput(this GeneratorRunResult result, params (string hintName, string text)[] expectedOutputs)
425-
{
426-
if (expectedOutputs.Length == 1 && string.IsNullOrWhiteSpace(expectedOutputs[0].text))
427-
{
428-
Assert.True(false, GenerateExpectedHostOutput(result));
429-
}
430-
else
431-
{
432-
var hostOutputs = result.GetHostOutputs();
433-
Assert.Equal(expectedOutputs.Length, hostOutputs.Length);
434-
for (int i = 0; i < hostOutputs.Length; i++)
435-
{
436-
var expectedOutput = expectedOutputs[i];
437-
var actualOutput = hostOutputs[i];
438-
439-
Assert.Equal(expectedOutput.hintName, actualOutput.Key);
440-
Assert.Equal(expectedOutput.text, actualOutput.Value, ignoreWhiteSpaceDifferences: true);
441-
}
442-
}
443-
444-
return result;
445-
}
446-
447423
private static string CreateBaselineDirectory(string testPath, string testName)
448424
{
449425
var baselineDirectory = Path.Join(
@@ -524,22 +500,6 @@ private static string GenerateExpectedPageOutput(GeneratorRunResult result)
524500
return sb.ToString();
525501
}
526502

527-
private static string GenerateExpectedHostOutput(GeneratorRunResult result)
528-
{
529-
StringBuilder sb = new StringBuilder("Generated Host Output:").AppendLine().AppendLine();
530-
var hostOutputs = result.GetHostOutputs();
531-
for (int i = 0; i < hostOutputs.Length; i++)
532-
{
533-
if (i > 0)
534-
{
535-
sb.AppendLine(",");
536-
}
537-
sb.Append("(@\"").Append(hostOutputs[i].Key.Replace("\"", "\"\"")).Append("\", ");
538-
sb.Append("@\"").Append(hostOutputs[i].Value.Replace("\"", "\"\"")).Append("\")");
539-
}
540-
return sb.ToString();
541-
}
542-
543503
public static GeneratorRunResult VerifyOutputsMatch(this GeneratorRunResult actual, GeneratorRunResult expected, params (int index, string replacement)[] diffs)
544504
{
545505
Assert.Equal(actual.GeneratedSources.Length, expected.GeneratedSources.Length);

0 commit comments

Comments
 (0)