Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Commit

Permalink
Re-organize the package layout
Browse files Browse the repository at this point in the history
* Rename the tool to Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
* Commonize code between the netcoreapp and net451 build targets
* Pass in arguments as a response file.
* Make strong naming work
  • Loading branch information
pranavkm committed Jan 6, 2017
1 parent 13cf0ae commit 0fd59af
Show file tree
Hide file tree
Showing 52 changed files with 3,061 additions and 594 deletions.
3 changes: 2 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<packageSources>
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Local" value="D:\work\katana\Hosting\artifacts\build" />
</packageSources>
</configuration>
</configuration>
12 changes: 3 additions & 9 deletions RazorViewCompilation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26014.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{01707B64-7DC7-4B5A-B0BB-7CD2773AA297}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -17,15 +17,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0398AFFF-5
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj", "{46C9A4B2-8B1C-451B-B670-C194901D66AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Test.csproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EC60EE94-72A3-4CEC-ADF2-2A8AEDC094B2}"
ProjectSection(SolutionItems) = preProject
testapps\SimpleApp\SimpleApp.csproj = testapps\SimpleApp\SimpleApp.csproj
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleApp", "testapps\SimpleApp\SimpleApp.csproj", "{1140C5E1-1C9A-4895-BB7E-C2AB2C320472}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test", "test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test.csproj", "{E0D75B4E-839F-4F80-9B1F-B33F616BCC5F}"
EndProject

Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion makefile.shade
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ use-standard-lifecycle
k-standard-goals

#build-pack target='compile'
dotnet command='pack --output $PSScriptRoot/artifacts/build Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.csproj' dotnetDir='${Path.Combine(Directory.GetCurrentDirectory(), "src", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design")}'
dotnet command='pack --output ${Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build")}' dotnetDir='${Path.Combine(Directory.GetCurrentDirectory(), "src", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation")}'

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.Extensions.CommandLineUtils;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class CommonOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Diagnostics;
using System.Linq;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public static class DebugHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class MvcServiceProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Microsoft.Extensions.CommandLineUtils;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class PrecompilationApplication : CommandLineApplication
{
Expand Down Expand Up @@ -33,7 +35,7 @@ public PrecompilationApplication(Type callingType)
{
try
{
return base.Execute(args);
return base.Execute(ExpandResponseFiles(args));
}
catch (Exception ex)
{
Expand All @@ -49,5 +51,22 @@ private string GetInformationalVersion()
var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
return attribute.InformationalVersion;
}

private static string[] ExpandResponseFiles(string[] args)
{
var expandedArgs = new List<string>();
foreach (var arg in args)
{
if (!arg.StartsWith("@", StringComparison.Ordinal))
{
expandedArgs.Add(arg);
}

var fileName = arg.Substring(1);
expandedArgs.AddRange(File.ReadLines(fileName));
}

return expandedArgs.ToArray();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.FileProviders;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class PrecompileRunCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Immutable;
using System.IO;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
// Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs
public static class SnkUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.Extensions.CommandLineUtils;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class StrongNameOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
using Microsoft.AspNetCore.Razor.CodeGenerators;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class ViewCompilationInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design.Internal
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
{
public class ViewInfoContainerCodeGenerator
{
Expand Down Expand Up @@ -63,15 +63,16 @@ public void AddAssemblyMetadata(
if (!string.IsNullOrEmpty(strongNameOptions.KeyFile))
{
var updatedOptions = Compilation.Options.WithStrongNameProvider(new DesktopStrongNameProvider());
var keyFilePath = Path.GetFullPath(strongNameOptions.KeyFile);

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || strongNameOptions.PublicSign)
{
updatedOptions = updatedOptions.WithCryptoPublicKey(
SnkUtils.ExtractPublicKey(File.ReadAllBytes(strongNameOptions.KeyFile)));
SnkUtils.ExtractPublicKey(File.ReadAllBytes(keyFilePath)));
}
else
{
updatedOptions = updatedOptions.WithCryptoKeyFile(strongNameOptions.KeyFile)
updatedOptions = updatedOptions.WithCryptoKeyFile(keyFilePath)
.WithDelaySign(strongNameOptions.DelaySign);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
<PreserveCompilationContext>true</PreserveCompilationContext>
<OutputType>exe</OutputType>

<!-- Include the build outputs in the build directory (and not the lib directory) -->
<BuildOutputTargetFolder>build</BuildOutputTargetFolder>
</PropertyGroup>

<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<None Include="build/**/*.targets" Pack="true" PackagePath="build/%(RecursiveDir)%(FileName)%(Extension)" />
<None Include="build/**/*.*" Pack="true" PackagePath="build/%(RecursiveDir)%(FileName)%(Extension)" />
<None Include="buildCrossTargeting/*.targets" Pack="true" PackagePath="buildCrossTargeting/%(FileName)%(Extension)" />

</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.1.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.1.0-*" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.0-*" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
</ItemGroup>

</Project>
Loading

0 comments on commit 0fd59af

Please sign in to comment.