Merge branch 'rel/1.1.0' into dev
This commit is contained in:
commit
8b410c5899
|
|
@ -1,4 +1,18 @@
|
||||||
{
|
{
|
||||||
|
"adx": {
|
||||||
|
"rules": [
|
||||||
|
"DefaultCompositeRule"
|
||||||
|
],
|
||||||
|
"packages": {
|
||||||
|
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation": {
|
||||||
|
"exclusions": {
|
||||||
|
"DOC_MISSING": {
|
||||||
|
"lib/netcoreapp1.1/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll": "Not a class library. Docs not required for CLI tools"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Default": {
|
"Default": {
|
||||||
"rules": [
|
"rules": [
|
||||||
"DefaultCompositeRule"
|
"DefaultCompositeRule"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
use assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
|
|
||||||
|
use namespace="System.IO"
|
||||||
|
use namespace="System.IO.Compression"
|
||||||
|
use namespace="System.Linq"
|
||||||
|
|
||||||
|
use-standard-lifecycle
|
||||||
|
k-standard-goals
|
||||||
|
|
||||||
|
#repack-x86 target='compile' if='Directory.Exists("src") && !IsLinux'
|
||||||
|
@{
|
||||||
|
var buildDir= Path.Combine(Directory.GetCurrentDirectory(), "artifacts", "build");
|
||||||
|
var projectName = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation";
|
||||||
|
var projectNupkg = Files
|
||||||
|
.Include(Path.Combine(buildDir, projectName + "*.nupkg"))
|
||||||
|
.Where(path => !path.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
|
||||||
|
.OrderByDescending(f => f) // On local builds multiple nupkgs are generated.
|
||||||
|
.First();
|
||||||
|
|
||||||
|
Log.Info("Repacking Nupkg: " + projectNupkg);
|
||||||
|
|
||||||
|
using (var zipArchive = ZipFile.Open(projectNupkg, ZipArchiveMode.Update))
|
||||||
|
{
|
||||||
|
MoveEntry(zipArchive, "lib/net451/" + projectName + ".exe", "runtimes/win7-x64/lib/net451/" + projectName + ".exe");
|
||||||
|
MoveEntry(zipArchive, "lib/net451/" + projectName + "-x86.exe", "runtimes/win7-x86/lib/net451/" + projectName + "-x86.exe");
|
||||||
|
zipArchive.CreateEntry("lib/net451/_._");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
functions @{
|
||||||
|
private static void MoveEntry(ZipArchive archive, string oldPath, string newPath)
|
||||||
|
{
|
||||||
|
var oldEntry = archive.GetEntry(oldPath);
|
||||||
|
if (oldEntry == null)
|
||||||
|
{
|
||||||
|
throw new Exception(oldPath + " was not found in package.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var newEntry = archive.CreateEntry(newPath);
|
||||||
|
using (var newStream = newEntry.Open())
|
||||||
|
using (var oldStream = oldEntry.Open())
|
||||||
|
{
|
||||||
|
oldStream.CopyTo(newStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
oldEntry.Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class CompilationOptions
|
internal class CompilationOptions
|
||||||
{
|
{
|
||||||
public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type";
|
public static readonly string ConfigureCompilationTypeTemplate = "--configure-compilation-type";
|
||||||
public static readonly string ContentRootTemplate = "--content-root";
|
public static readonly string ContentRootTemplate = "--content-root";
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public static class DebugHelper
|
internal static class DebugHelper
|
||||||
{
|
{
|
||||||
public static void HandleDebugSwitch(ref string[] args)
|
public static void HandleDebugSwitch(ref string[] args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Compilation;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class MvcServiceProvider
|
internal class MvcServiceProvider
|
||||||
{
|
{
|
||||||
private readonly string _projectPath;
|
private readonly string _projectPath;
|
||||||
private readonly string _contentRoot;
|
private readonly string _contentRoot;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class PrecompilationApplication : CommandLineApplication
|
internal class PrecompilationApplication : CommandLineApplication
|
||||||
{
|
{
|
||||||
private readonly Type _callingType;
|
private readonly Type _callingType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ using Microsoft.Extensions.CommandLineUtils;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class PrecompileRunCommand
|
internal class PrecompileRunCommand
|
||||||
{
|
{
|
||||||
private static readonly ParallelOptions ParalellOptions = new ParallelOptions
|
private static readonly ParallelOptions ParalellOptions = new ParallelOptions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using System.IO;
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.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
|
// Copied from https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.ProjectModel.Workspaces/SnkUtils.cs
|
||||||
public static class SnkUtils
|
internal static class SnkUtils
|
||||||
{
|
{
|
||||||
const byte PUBLICKEYBLOB = 0x06;
|
const byte PUBLICKEYBLOB = 0x06;
|
||||||
const byte PRIVATEKEYBLOB = 0x07;
|
const byte PRIVATEKEYBLOB = 0x07;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Razor.Evolution;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class ViewCompilationInfo
|
internal class ViewCompilationInfo
|
||||||
{
|
{
|
||||||
public ViewCompilationInfo(
|
public ViewCompilationInfo(
|
||||||
ViewFileInfo viewFileInfo,
|
ViewFileInfo viewFileInfo,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System.IO;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public struct ViewFileInfo
|
internal struct ViewFileInfo
|
||||||
{
|
{
|
||||||
public ViewFileInfo(string fullPath, string viewEnginePath)
|
public ViewFileInfo(string fullPath, string viewEnginePath)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ using Microsoft.CodeAnalysis.Text;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal
|
||||||
{
|
{
|
||||||
public class ViewInfoContainerCodeGenerator
|
internal class ViewInfoContainerCodeGenerator
|
||||||
{
|
{
|
||||||
public ViewInfoContainerCodeGenerator(
|
public ViewInfoContainerCodeGenerator(
|
||||||
CSharpCompiler compiler,
|
CSharpCompiler compiler,
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,23 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RazorViewCompilation.sln'))\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
|
<Description>Build-time references required to enable Razor view compilation as part of building the application.</Description>
|
||||||
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks>
|
||||||
<RuntimeIdentifier Condition="!$(TargetFramework.StartsWith('netcoreapp'))">win7-x64</RuntimeIdentifier>
|
<RuntimeIdentifier Condition="!$(TargetFramework.StartsWith('netcoreapp'))">win7-x64</RuntimeIdentifier>
|
||||||
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
|
<PackageTags>cshtml;razor;compilation;precompilation;aspnetcore</PackageTags>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<OutputType>exe</OutputType>
|
<OutputType>exe</OutputType>
|
||||||
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
|
<X86ProjectDirectory>..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\</X86ProjectDirectory>
|
||||||
<X86ProjectDirectory>..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\</X86ProjectDirectory>
|
</PropertyGroup>
|
||||||
<!-- Include the build outputs in the build directory (and not the lib directory) -->
|
<ItemGroup>
|
||||||
<BuildOutputTargetFolder>build</BuildOutputTargetFolder>
|
<None Include="build\**\*" Pack="true" PackagePath="%(Identity)" />
|
||||||
<ContentTargetFolders>build</ContentTargetFolders>
|
<None Include="buildMultiTargeting\*" Pack="true" PackagePath="%(Identity)" />
|
||||||
</PropertyGroup>
|
<None Include="$(X86ProjectDirectory)\bin\$(Configuration)\net451\$(MSBuildThisFileName)-x86.exe" Pack="true" PackagePath="lib\net451\$(MSBuildThisFileName)-x86.exe" />
|
||||||
<ItemGroup>
|
</ItemGroup>
|
||||||
<Content Include="build\**\*" Pack="true" PackagePath="%(Identity)" />
|
<ItemGroup>
|
||||||
<None Include="$(X86ProjectDirectory)bin\$(Configuration)\net451\$(MSBuildThisFileName)-x86.exe" Pack="true" PackagePath="build\net451\$(MSBuildThisFileName)-x86.exe" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.2.0-*" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.2.0-*" />
|
||||||
<ItemGroup>
|
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.2.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="1.2.0-*" />
|
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net451'" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.2.0-*" />
|
</ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.2.0-*" />
|
|
||||||
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net451'" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
{
|
{
|
||||||
public class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
private readonly static Type ProgramType = typeof(Program);
|
private readonly static Type ProgramType = typeof(Program);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
// 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.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
<MvcRazorContentRoot Condition="'$(MvcRazorContentRoot)'==''">$(MSBuildProjectDirectory)</MvcRazorContentRoot>
|
<MvcRazorContentRoot Condition="'$(MvcRazorContentRoot)'==''">$(MSBuildProjectDirectory)</MvcRazorContentRoot>
|
||||||
<MvcRazorExcludeViewFilesFromPublish Condition="'$(MvcRazorExcludeViewFilesFromPublish)'==''">true</MvcRazorExcludeViewFilesFromPublish>
|
<MvcRazorExcludeViewFilesFromPublish Condition="'$(MvcRazorExcludeViewFilesFromPublish)'==''">true</MvcRazorExcludeViewFilesFromPublish>
|
||||||
|
<MvcRazorExcludeRefAssembliesFromPublish Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'==''">true</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'@(MvcRazorFilesToCompile)' == ''">
|
<ItemGroup Condition="'@(MvcRazorFilesToCompile)' == ''">
|
||||||
|
|
@ -53,7 +54,7 @@
|
||||||
Condition="'$(MvcRazorCompileOnPublish)'=='true'" />
|
Condition="'$(MvcRazorCompileOnPublish)'=='true'" />
|
||||||
|
|
||||||
<Target Name="_MvcRazorResolveFilesToCompute"
|
<Target Name="_MvcRazorResolveFilesToCompute"
|
||||||
AfterTargets="ComputeFilesToPublish"
|
AfterTargets="ComputeRefAssembliesToPublish"
|
||||||
Condition="'$(MvcRazorCompileOnPublish)'=='true'">
|
Condition="'$(MvcRazorCompileOnPublish)'=='true'">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -65,6 +66,12 @@
|
||||||
<RelativePath>$([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)'))</RelativePath>
|
<RelativePath>$([System.IO.Path]::GetFileName('$(_MvcRazorOutputFullPath)'))</RelativePath>
|
||||||
</ResolvedFileToPublish>
|
</ResolvedFileToPublish>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(MvcRazorExcludeRefAssembliesFromPublish)'=='true'">
|
||||||
|
<ResolvedFileToPublish
|
||||||
|
Remove="%(ResolvedFileToPublish.Identity)"
|
||||||
|
Condition="'%(ResolvedFileToPublish.RelativePath)'=='$(RefAssembliesFolderName)\%(Filename)%(Extension)'" />
|
||||||
|
</ItemGroup>
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,12 @@
|
||||||
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config">
|
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config">
|
||||||
<Destination>$(OutputPath)$(MSBuildThisFileName)-x86.exe.config</Destination>
|
<Destination>$(OutputPath)$(MSBuildThisFileName)-x86.exe.config</Destination>
|
||||||
</FilesToCopy>
|
</FilesToCopy>
|
||||||
<FilesToCopy Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName)-x86.exe">
|
|
||||||
<Destination>$(OutputPath)$(MSBuildThisFileName)-x86.exe</Destination>
|
|
||||||
</FilesToCopy>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(PlatformTarget)'!='x86'">
|
<ItemGroup Condition="'$(PlatformTarget)'!='x86'">
|
||||||
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config" Condition="">
|
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config" Condition="">
|
||||||
<Destination>$(OutputPath)$(MSBuildThisFileName).exe.config</Destination>
|
<Destination>$(OutputPath)$(MSBuildThisFileName).exe.config</Destination>
|
||||||
</FilesToCopy>
|
</FilesToCopy>
|
||||||
<FilesToCopy Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).exe">
|
|
||||||
<Destination>$(OutputPath)$(MSBuildThisFileName).exe</Destination>
|
|
||||||
</FilesToCopy>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Copy
|
<Copy
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ExecArgs>--runtimeconfig "$(ProjectRuntimeConfigFilePath)"</ExecArgs>
|
<ExecArgs>--runtimeconfig "$(ProjectRuntimeConfigFilePath)"</ExecArgs>
|
||||||
<ExecArgs>$(ExecArgs) --depsfile "$(ProjectDepsFilePath)"</ExecArgs>
|
<ExecArgs>$(ExecArgs) --depsfile "$(ProjectDepsFilePath)"</ExecArgs>
|
||||||
<ExecArgs>$(ExecArgs) "$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll"</ExecArgs>
|
<ExecArgs>$(ExecArgs) "$(MSBuildThisFileDirectory)../../lib/netcoreapp1.1/$(MSBuildThisFileName).dll"</ExecArgs>
|
||||||
<ExecArgs>$(ExecArgs) @"$(_MvcRazorResponseFilePath)"</ExecArgs>
|
<ExecArgs>$(ExecArgs) @"$(_MvcRazorResponseFilePath)"</ExecArgs>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[ConditionalTheory(Skip = "MVC #5736")]
|
[ConditionalTheory]
|
||||||
[OSSkipCondition(OperatingSystems.Linux,
|
[OSSkipCondition(OperatingSystems.Linux,
|
||||||
SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")]
|
SkipReason = "https://github.com/NuGet/Home/issues/4243, https://github.com/NuGet/Home/issues/4240")]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX,
|
[OSSkipCondition(OperatingSystems.MacOSX,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_WorksForViewsUsingRelativePath(RuntimeFlavor flavor)
|
public async Task Precompilation_WorksForViewsUsingRelativePath(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal(RuntimeFlavor flavor)
|
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor)
|
public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor)
|
public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(ApplicationWithTagHelpersData))]
|
[MemberData(nameof(ApplicationWithTagHelpersData))]
|
||||||
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor)
|
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
public ILogger Logger { get; private set; }
|
public ILogger Logger { get; private set; }
|
||||||
|
|
||||||
public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor)
|
public IApplicationDeployer CreateDeployment(RuntimeFlavor flavor)
|
||||||
|
{
|
||||||
|
PrepareForDeployment(flavor);
|
||||||
|
var deploymentParameters = GetDeploymentParameters(flavor);
|
||||||
|
return ApplicationDeployerFactory.Create(deploymentParameters, Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void PrepareForDeployment(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
Logger = CreateLogger(flavor);
|
Logger = CreateLogger(flavor);
|
||||||
|
|
||||||
|
|
@ -46,7 +53,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
Restore();
|
Restore();
|
||||||
_isRestored = true;
|
_isRestored = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor)
|
||||||
|
{
|
||||||
var tempRestoreDirectoryEnvironment = new KeyValuePair<string, string>(
|
var tempRestoreDirectoryEnvironment = new KeyValuePair<string, string>(
|
||||||
NuGetPackagesEnvironmentKey,
|
NuGetPackagesEnvironmentKey,
|
||||||
TempRestoreDirectory);
|
TempRestoreDirectory);
|
||||||
|
|
@ -82,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return ApplicationDeployerFactory.Create(deploymentParameters, Logger);
|
return deploymentParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ILogger CreateLogger(RuntimeFlavor flavor)
|
protected virtual ILogger CreateLogger(RuntimeFlavor flavor)
|
||||||
|
|
@ -132,14 +142,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Command
|
var command = Command
|
||||||
.CreateDotNet("restore", args)
|
.CreateDotNet("restore", args)
|
||||||
.EnvironmentVariable(DotnetSkipFirstTimeExperience, "true")
|
.EnvironmentVariable(DotnetSkipFirstTimeExperience, "true")
|
||||||
.ForwardStdErr(Console.Error)
|
.CaptureStdErr()
|
||||||
.ForwardStdOut(Console.Out)
|
.CaptureStdOut()
|
||||||
.WorkingDirectory(applicationDirectory)
|
.WorkingDirectory(applicationDirectory)
|
||||||
.Execute()
|
.Execute();
|
||||||
.EnsureSuccessful();
|
|
||||||
|
if (command.ExitCode != 0)
|
||||||
|
{
|
||||||
|
throw new Exception(
|
||||||
|
$@"dotnet {command.StartInfo.Arguments} failed.
|
||||||
|
===StdOut===
|
||||||
|
{command.StdOut}
|
||||||
|
===StdErr===
|
||||||
|
{command.StdErr}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CreateTempRestoreDirectory()
|
private static string CreateTempRestoreDirectory()
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="0.3.0-*" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="0.3.0-*" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="1.2.0-*" />
|
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="1.2.0-*" />
|
||||||
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="1.0.0-preview2-003121" />
|
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="1.0.0-preview2-003121" />
|
||||||
|
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.2.0-*" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.2.0-*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="1.2.0-*" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="1.2.0-*" />
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor)
|
public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
Hello from Index: AspNetCore._Views_Home_Index_cshtml, SimpleAppMvc11.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
|
||||||
|
AspNetCore._Views_Shared__Layout_cshtml, SimpleAppMvc11.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
[ConditionalFact(Skip = "MVC #5736")]
|
[ConditionalFact]
|
||||||
[OSSkipConditionAttribute(OperatingSystems.Linux)]
|
[OSSkipConditionAttribute(OperatingSystems.Linux)]
|
||||||
[OSSkipConditionAttribute(OperatingSystems.MacOSX)]
|
[OSSkipConditionAttribute(OperatingSystems.MacOSX)]
|
||||||
public async Task Precompilation_WorksForSimpleApps()
|
public async Task Precompilation_WorksForSimpleApps()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor)
|
public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
[ConditionalFact(Skip = "MVC #5736")]
|
[ConditionalFact]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
public async Task Precompilation_WorksForSimpleApps()
|
public async Task Precompilation_WorksForSimpleApps()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
[Theory(Skip = "MVC #5736")]
|
[Theory]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor)
|
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
|
{
|
||||||
|
public class ViewCompilationOptionsTest : IClassFixture<ViewCompilationOptionsTest.TestFixture>
|
||||||
|
{
|
||||||
|
public ViewCompilationOptionsTest(TestFixture fixture)
|
||||||
|
{
|
||||||
|
Fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
|
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
|
public void Precompilation_PreventsRefAssembliesFromBeingPublished(RuntimeFlavor flavor)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using (var deployer = Fixture.CreateDeployment(flavor))
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var deploymentResult = deployer.Deploy();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||||
|
public void PublishingWithOption_AllowsPublishingRefAssemblies(RuntimeFlavor flavor)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
Fixture.PrepareForDeployment(flavor);
|
||||||
|
var deploymentParameters = Fixture.GetDeploymentParameters(flavor);
|
||||||
|
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||||
|
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||||
|
|
||||||
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.Logger))
|
||||||
|
{
|
||||||
|
// Act
|
||||||
|
var deploymentResult = deployer.Deploy();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestFixture : ApplicationTestFixture
|
||||||
|
{
|
||||||
|
public TestFixture()
|
||||||
|
: base("SimpleApp")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,4 +13,8 @@
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-*" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-*" />
|
||||||
<PackageReference Include="xunit" Version="2.2.0-*" />
|
<PackageReference Include="xunit" Version="2.2.0-*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue