Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit d9dfc2a

Browse files
author
N. Taylor Mullen
committed
Break project into tool and inside man projects.
- Updated xproj to match latest tooling. - Moved namespaces and classes to match the project they were in. - Renamed / split resource files for their corresponding projects. - Changed the x86 repacking to only impact the Microsoft.AspNetCore.Razor.Design project (it's the project that's always executed). - Removed Dotnet.Cli.Utils dependency form Design. We weren't making use of the reporter anyways. #80
1 parent 302ba3f commit d9dfc2a

26 files changed

Lines changed: 533 additions & 168 deletions

RazorTooling.sln

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 14
3-
VisualStudioVersion = 14.0.24720.0
3+
VisualStudioVersion = 14.0.25420.1
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{253024B2-368B-4B24-9CD3-D48E9C1EC948}"
66
EndProject
@@ -12,30 +12,51 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
EndProject
1313
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8D49C692-BA71-43C4-927F-E9E2BA8FC795}"
1414
EndProject
15-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Tools.Test", "test\Microsoft.AspNetCore.Razor.Tools.Test\Microsoft.AspNetCore.Razor.Tools.Test.xproj", "{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}"
16-
EndProject
1715
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Tools", "src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.xproj", "{6F1CAB8C-2315-46BB-B9B4-00564743590C}"
1816
EndProject
17+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Design", "src\Microsoft.AspNetCore.Razor.Design\Microsoft.AspNetCore.Razor.Design.xproj", "{60043E40-0D14-4E41-A97A-52A7A1BB5A26}"
18+
EndProject
19+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.xproj", "{C4279BCD-DADD-4354-B28D-B7FE24BAD230}"
20+
EndProject
1921
Global
2022
GlobalSection(SolutionConfigurationPlatforms) = preSolution
23+
debug_x86|Any CPU = debug_x86|Any CPU
2124
Debug|Any CPU = Debug|Any CPU
25+
release_x86|Any CPU = release_x86|Any CPU
2226
Release|Any CPU = Release|Any CPU
2327
EndGlobalSection
2428
GlobalSection(ProjectConfigurationPlatforms) = postSolution
25-
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26-
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
27-
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
28-
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
30+
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
2931
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3032
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
34+
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.release_x86|Any CPU.Build.0 = Release|Any CPU
3135
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Release|Any CPU.ActiveCfg = Release|Any CPU
3236
{6F1CAB8C-2315-46BB-B9B4-00564743590C}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.debug_x86|Any CPU.ActiveCfg = debug_x86|Any CPU
38+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.debug_x86|Any CPU.Build.0 = debug_x86|Any CPU
39+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Debug|Any CPU.Build.0 = Debug|Any CPU
41+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.release_x86|Any CPU.ActiveCfg = release_x86|Any CPU
42+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.release_x86|Any CPU.Build.0 = release_x86|Any CPU
43+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
46+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
47+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Debug|Any CPU.Build.0 = Debug|Any CPU
49+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
50+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.release_x86|Any CPU.Build.0 = Release|Any CPU
51+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.Build.0 = Release|Any CPU
3353
EndGlobalSection
3454
GlobalSection(SolutionProperties) = preSolution
3555
HideSolutionNode = FALSE
3656
EndGlobalSection
3757
GlobalSection(NestedProjects) = preSolution
38-
{AB04D3BA-0A35-4502-AD4F-E8D1B38A6E5B} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
3958
{6F1CAB8C-2315-46BB-B9B4-00564743590C} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
59+
{60043E40-0D14-4E41-A97A-52A7A1BB5A26} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
60+
{C4279BCD-DADD-4354-B28D-B7FE24BAD230} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
4061
EndGlobalSection
4162
EndGlobal

makefile.shade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use namespace="System.Linq"
55
default CONFIGURATION_LOCAL='${E("Configuration")}'
66
default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
77
default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}'
8-
default TOOL_PROJECT_NAME='Microsoft.AspNetCore.Razor.Tools'
9-
default TOOL_EXE_NAME='dotnet-razor-tooling.exe'
8+
default TOOL_PROJECT_NAME='Microsoft.AspNetCore.Razor.Design'
9+
default TOOL_EXE_NAME='Microsoft.AspNetCore.Razor.Design.exe'
1010
var VERSION='0.1'
1111
var FULL_VERSION='0.1'
1212
var AUTHORS='Microsoft Open Technologies, Inc.'

src/Microsoft.AspNetCore.Razor.Tools/Resources.Designer.cs renamed to src/Microsoft.AspNetCore.Razor.Design/DesignResources.Designer.cs

Lines changed: 20 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Microsoft.AspNetCore.Razor.Tools/Resources.resx renamed to src/Microsoft.AspNetCore.Razor.Design/DesignResources.resx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,13 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120+
<data name="CouldNotInvokeTool" xml:space="preserve">
121+
<value>Could not invoke tool. Ensure project.json has matching versions of '{0}' in the 'dependencies' section and '{1}' in the 'tools' section.</value>
122+
</data>
120123
<data name="CouldNotParseProvidedProtocol" xml:space="preserve">
121124
<value>Could not parse provided protocol '{0}'. Protocols should be valid int32 values.</value>
122125
</data>
123-
<data name="FailedToExecuteRazorTooling" xml:space="preserve">
124-
<value>Failed to execute razor-tooling: '{0}'.</value>
125-
</data>
126126
<data name="InvalidProtocolValue" xml:space="preserve">
127127
<value>'{0}'s cannot be resolved with protocol '{1}'. Protocol not supported.</value>
128128
</data>
129-
<data name="ProjectDoesNotSupportProvidedFramework" xml:space="preserve">
130-
<value>Project '{0}' does not support the provided framework '{1}'.</value>
131-
</data>
132129
</root>

src/Microsoft.AspNetCore.Razor.Tools/Internal/AssemblyTagHelperDescriptorResolver.cs renamed to src/Microsoft.AspNetCore.Razor.Design/Internal/AssemblyTagHelperDescriptorResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
88
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
99

10-
namespace Microsoft.AspNetCore.Razor.Tools.Internal
10+
namespace Microsoft.AspNetCore.Razor.Design.Internal
1111
{
1212
public class AssemblyTagHelperDescriptorResolver
1313
{
@@ -53,7 +53,7 @@ public IEnumerable<TagHelperDescriptor> Resolve(string assemblyName, ErrorSink e
5353
throw new InvalidOperationException(
5454
string.Format(
5555
CultureInfo.CurrentCulture,
56-
Resources.InvalidProtocolValue,
56+
DesignResources.InvalidProtocolValue,
5757
typeof(TagHelperDescriptor).FullName, ProtocolVersion));
5858
}
5959
}

src/Microsoft.AspNetCore.Razor.Tools/Internal/ResolveProtocolCommand.cs renamed to src/Microsoft.AspNetCore.Razor.Design/Internal/ResolveProtocolCommand.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33

44
using System;
55
using System.Globalization;
6-
using Microsoft.AspNetCore.Razor.Tools;
7-
using Microsoft.DotNet.Cli.Utils;
86
using Microsoft.Extensions.CommandLineUtils;
97

10-
namespace Microsoft.AspNetCore.Razor.Tools.Internal
8+
namespace Microsoft.AspNetCore.Razor.Design.Internal
119
{
1210
public static class ResolveProtocolCommand
1311
{
14-
internal static void Register(CommandLineApplication app)
12+
public static void Register(CommandLineApplication app)
1513
{
1614
app.Command("resolve-protocol", config =>
1715
{
@@ -28,17 +26,17 @@ internal static void Register(CommandLineApplication app)
2826
int clientProtocol;
2927
if (!int.TryParse(clientProtocolString, out clientProtocol))
3028
{
31-
Reporter.Error.WriteLine(
29+
Console.Error.WriteLine(
3230
string.Format(
3331
CultureInfo.CurrentCulture,
34-
Resources.CouldNotParseProvidedProtocol,
32+
DesignResources.CouldNotParseProvidedProtocol,
3533
clientProtocolString));
3634
return 1;
3735
}
3836

3937
var resolvedProtocol = ResolveProtocol(clientProtocol, pluginProtocol);
4038

41-
Reporter.Output.WriteLine(resolvedProtocol.ToString(CultureInfo.InvariantCulture));
39+
Console.WriteLine(resolvedProtocol.ToString(CultureInfo.InvariantCulture));
4240

4341
return 0;
4442
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0.25413" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25413</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>60043e40-0d14-4e41-a97a-52a7a1bb5a26</ProjectGuid>
10+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
11+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
12+
</PropertyGroup>
13+
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
</PropertyGroup>
17+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
18+
</Project>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Globalization;
6+
using System.Linq;
7+
using System.Reflection;
8+
9+
namespace Microsoft.AspNetCore.Razor.Design
10+
{
11+
public class Program
12+
{
13+
private readonly static Type ProgramType = typeof(Program);
14+
15+
public static int Main(string[] args)
16+
{
17+
var app = new RazorToolingApplication(ProgramType);
18+
19+
EnsureValidDispatchRecipient(ref args);
20+
21+
ResolveTagHelpersCommandBase.Register<ResolveTagHelpersRunCommand>(app);
22+
23+
return app.Execute(args);
24+
}
25+
26+
private static void EnsureValidDispatchRecipient(ref string[] args)
27+
{
28+
const string DispatcherVersionArgumentName = "--dispatcher-version";
29+
30+
if (!args.Contains(DispatcherVersionArgumentName, StringComparer.OrdinalIgnoreCase))
31+
{
32+
return;
33+
}
34+
35+
var dispatcherArgumentIndex = Array.FindIndex(
36+
args,
37+
(value) => string.Equals(value, DispatcherVersionArgumentName, StringComparison.OrdinalIgnoreCase));
38+
var dispatcherArgumentValueIndex = dispatcherArgumentIndex + 1;
39+
if (dispatcherArgumentValueIndex < args.Length)
40+
{
41+
var dispatcherVersion = args[dispatcherArgumentValueIndex];
42+
43+
var thisAssembly = ProgramType.GetTypeInfo().Assembly;
44+
var version = thisAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
45+
?.InformationalVersion
46+
?? thisAssembly.GetName().Version.ToString();
47+
48+
if (string.Equals(dispatcherVersion, version, StringComparison.Ordinal))
49+
{
50+
// Remove dispatcher arguments from
51+
var preDispatcherArgument = args.Take(dispatcherArgumentIndex);
52+
var postDispatcherArgument = args.Skip(dispatcherArgumentIndex + 2);
53+
var newProgramArguments = preDispatcherArgument.Concat(postDispatcherArgument);
54+
args = newProgramArguments.ToArray();
55+
return;
56+
}
57+
}
58+
59+
var thisAssemblyName = typeof(Program).GetTypeInfo().Assembly.GetName().Name;
60+
61+
// Could not validate the dispatcher version.
62+
throw new InvalidOperationException(
63+
string.Format(
64+
CultureInfo.CurrentCulture,
65+
DesignResources.CouldNotInvokeTool,
66+
thisAssemblyName,
67+
"Microsoft.AspNetCore.Razor.Tools"));
68+
}
69+
}
70+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Reflection;
5+
using System.Resources;
6+
7+
[assembly: AssemblyMetadata("Serviceable", "True")]
8+
[assembly: NeutralResourcesLanguage("en-us")]
9+
[assembly: AssemblyCompany("Microsoft Corporation.")]
10+
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
11+
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]

0 commit comments

Comments
 (0)