-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Johluo/migrate more tooling #22294
Merged
Merged
Johluo/migrate more tooling #22294
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1c99d2e
Reorganize source code in preparation to move into aspnet/AspNetCore
rynowak 7f725e0
Pass filekind through the workspace layer
rynowak e4a6865
Don't associate Roslyn workspace project with ProjectSnapshot.
NTaylorMullen 045bd10
Merge branch 'release/vs16.0-preview4'
NTaylorMullen 440b049
Merge remote-tracking branch 'origin/release/vs16.0-preview4'
NTaylorMullen f121101
Merge branch 'release/vs16.0-preview4'
NTaylorMullen 5f57299
Merge branch 'release/vs16.0-preview4'
ajaybhargavb e2d2beb
Merge branch 'release/vs16.0-preview4'
NTaylorMullen 740b1d3
Move TagHelperResolver to CodeAnalysis.Workspaces
NTaylorMullen b2b8ca6
Added RazorSyntaxGenerator to the repo (dotnet/aspnetcore-tooling#313)
ajaybhargavb c7dcbd8
Added missed files to RazorSyntaxGenerator (dotnet/aspnetcore-tooling…
ajaybhargavb 6747e90
Preserve diagnostics when rewriting Red nodes (dotnet/aspnetcore-tool…
ajaybhargavb ec503be
Flow RootNamespace from MSBuild (dotnet/aspnetcore-tooling#331)
ajaybhargavb b1aef03
Expand RazorProject.GetItem to take in FileKinds when getting items.
NTaylorMullen 5d1b6db
Add support for source-build (dotnet/aspnetcore-tooling#620)
natemcmaster 0c84b3a
Serialize project state from VS to project.razor.json (dotnet/aspnetc…
ryanbrandenburg 986d465
Fix PoliCheck failures.
NTaylorMullen 4bdf89b
Fix more policheck failures in MSN.cshtml\n\nCommit migrated from htt…
NTaylorMullen 7b56497
Merge branch 'master' of ..\aspnetcore-tooling2\
68fea5b
Remove files that should stay in aspnetcore-tooling
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark] |
58 changes: 58 additions & 0 deletions
58
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.IO; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.AspNetCore.Mvc.Razor.Extensions; | ||
using Microsoft.AspNetCore.Razor.Language; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Performance | ||
{ | ||
public class CodeGenerationBenchmark | ||
{ | ||
public CodeGenerationBenchmark() | ||
{ | ||
var current = new DirectoryInfo(AppContext.BaseDirectory); | ||
while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml"))) | ||
{ | ||
current = current.Parent; | ||
} | ||
|
||
var root = current; | ||
var fileSystem = RazorProjectFileSystem.Create(root.FullName); | ||
|
||
ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ; | ||
|
||
MSN = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"), FileKinds.Legacy); | ||
} | ||
|
||
public RazorProjectEngine ProjectEngine { get; } | ||
|
||
public RazorProjectItem MSN { get; } | ||
|
||
[Benchmark(Description = "Razor Design Time Code Generation of MSN.com")] | ||
public void CodeGeneration_DesignTime_LargeStaticFile() | ||
{ | ||
var codeDocument = ProjectEngine.ProcessDesignTime(MSN); | ||
var generated = codeDocument.GetCSharpDocument(); | ||
|
||
if (generated.Diagnostics.Count != 0) | ||
{ | ||
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); | ||
} | ||
} | ||
|
||
[Benchmark(Description = "Razor Runtime Code Generation of MSN.com")] | ||
public void CodeGeneration_Runtime_LargeStaticFile() | ||
{ | ||
var codeDocument = ProjectEngine.Process(MSN); | ||
var generated = codeDocument.GetCSharpDocument(); | ||
|
||
if (generated.Diagnostics.Count != 0) | ||
{ | ||
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); | ||
} | ||
} | ||
} | ||
} |
3,983 changes: 3,983 additions & 0 deletions
3,983
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...perf/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<OutputType>Exe</OutputType> | ||
<ServerGarbageCollection>true</ServerGarbageCollection> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<IsPackable>false</IsPackable> | ||
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" /> | ||
<Reference Include="BenchmarkDotNet" /> | ||
<Reference Include="Newtonsoft.Json" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(SharedSourceRoot)BenchmarkRunner\*.cs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
77 changes: 77 additions & 0 deletions
77
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/SyntaxTreeGenerationBenckmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.AspNetCore.Mvc.Razor.Extensions; | ||
using Microsoft.AspNetCore.Razor.Language; | ||
|
||
namespace Microsoft.AspNetCore.Razor.Performance | ||
{ | ||
public class SyntaxTreeGenerationBenchmark | ||
{ | ||
public SyntaxTreeGenerationBenchmark() | ||
{ | ||
var current = new DirectoryInfo(AppContext.BaseDirectory); | ||
while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml"))) | ||
{ | ||
current = current.Parent; | ||
} | ||
|
||
var root = current; | ||
var fileSystem = RazorProjectFileSystem.Create(root.FullName); | ||
|
||
ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ; | ||
|
||
var projectItem = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"), FileKinds.Legacy); | ||
MSN = RazorSourceDocument.ReadFrom(projectItem); | ||
|
||
var directiveFeature = ProjectEngine.EngineFeatures.OfType<IRazorDirectiveFeature>().FirstOrDefault(); | ||
Directives = directiveFeature?.Directives.ToArray() ?? Array.Empty<DirectiveDescriptor>(); | ||
} | ||
|
||
public RazorProjectEngine ProjectEngine { get; } | ||
|
||
public RazorSourceDocument MSN { get; } | ||
|
||
public DirectiveDescriptor[] Directives { get; } | ||
|
||
[Benchmark(Description = "Razor Design Time Syntax Tree Generation of MSN.com")] | ||
public void SyntaxTreeGeneration_DesignTime_LargeStaticFile() | ||
{ | ||
var options = RazorParserOptions.CreateDesignTime(o => | ||
{ | ||
foreach (var directive in Directives) | ||
{ | ||
o.Directives.Add(directive); | ||
} | ||
}); | ||
var syntaxTree = RazorSyntaxTree.Parse(MSN, options); | ||
|
||
if (syntaxTree.Diagnostics.Count != 0) | ||
{ | ||
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics)); | ||
} | ||
} | ||
|
||
[Benchmark(Description = "Razor Runtime Syntax Tree Generation of MSN.com")] | ||
public void SyntaxTreeGeneration_Runtime_LargeStaticFile() | ||
{ | ||
var options = RazorParserOptions.Create(o => | ||
{ | ||
foreach (var directive in Directives) | ||
{ | ||
o.Directives.Add(directive); | ||
} | ||
}); | ||
var syntaxTree = RazorSyntaxTree.Parse(MSN, options); | ||
|
||
if (syntaxTree.Diagnostics.Count != 0) | ||
{ | ||
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics)); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Compile the solution in Release mode (so binaries are available in release) | ||
|
||
To run a specific benchmark add it as parameter. | ||
``` | ||
dotnet run -c Release <benchmark_name> | ||
``` | ||
|
||
If you run without any parameters, you'll be offered the list of all benchmarks and get to choose. | ||
``` | ||
dotnet run -c Release | ||
``` |
1 change: 1 addition & 0 deletions
1
src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/taghelpers.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍