From 8653225b0cf5f45ac0418c1edde761f786e769f8 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 31 Jan 2018 15:01:13 -0800 Subject: [PATCH 1/2] Update dependencies.props to 2.1.0-preview-28193, build tools to 2.1.0-preview1-1010 [ci skip] Scripted changes: - updated travis and appveyor.yml files to only build dev, ci, and release branches - updated dependencies.props - updated korebuild-lock.txt - updated korebuild.json to release/2.1 channel --- .appveyor.yml | 16 +++++++--------- .travis.yml | 24 ++++++++++++------------ build/dependencies.props | 22 +++++++++++----------- korebuild-lock.txt | 4 ++-- korebuild.json | 4 ++-- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index c2db660b52..fd85abb361 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,19 +1,17 @@ init: - - git config --global core.autocrlf true +- git config --global core.autocrlf true branches: only: - - master - - release - - dev - - /^(.*\/)?ci-.*$/ - - /^rel\/.*/ + - dev + - /^release\/.*$/ + - /^(.*\/)?ci-.*$/ build_script: - - ps: .\run.ps1 default-build +- ps: .\run.ps1 default-build clone_depth: 1 environment: global: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: 1 -test: off -deploy: off +test: 'off' +deploy: 'off' os: Visual Studio 2017 Preview diff --git a/.travis.yml b/.travis.yml index ceaae0b3b7..28507b93b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,25 +3,25 @@ sudo: required dist: trusty env: global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - - DOTNET_CLI_TELEMETRY_OPTOUT: 1 + - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + - DOTNET_CLI_TELEMETRY_OPTOUT: 1 addons: apt: packages: - - libunwind8 + - libunwind8 mono: none os: - - linux - - osx +- linux +- osx osx_image: xcode8.2 branches: only: - - master - - release - - dev - - /^(.*\/)?ci-.*$/ - - /^rel\/.*/ + - dev + - /^release\/.*$/ + - /^(.*\/)?ci-.*$/ before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi +- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s + /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + /usr/local/lib/; fi script: - - ./build.sh +- ./build.sh diff --git a/build/dependencies.props b/build/dependencies.props index bd068cd124..02446acb1e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,21 +4,21 @@ 0.10.11 - 2.1.0-preview1-15679 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 + 2.1.0-preview1-1010 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 15.3.409 15.3.409 2.6.1 2.6.1 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 2.1.0-preview2-25711-01 - 2.1.0-preview1-28153 - 2.1.0-preview1-28153 + 2.1.0-preview1-28193 + 2.1.0-preview1-28193 2.0.0 - 2.1.0-preview1-26115-03 + 2.1.0-preview1-26122-01 15.3.0 15.0.26606 15.6.161-preview @@ -38,8 +38,8 @@ 2.0.0 10.0.1 1.1.92 - 4.5.0-preview1-26112-01 - 4.5.0-preview1-26112-01 + 4.5.0-preview1-26119-06 + 4.5.0-preview1-26119-06 9.0.1 2.7.0-beta3-62512-06 2.7.0-beta3-62512-06 diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 0518052b1b..851bfbf203 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.0-preview1-15679 -commithash:5347461137cb45a77ddcc0b55b2478092de43338 +version:2.1.0-preview1-1010 +commithash:75ca924dfbd673c38841025b04c4dcd93b84f56d diff --git a/korebuild.json b/korebuild.json index 4af8c89b72..f0fcb05ac3 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,6 +1,6 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", - "channel": "dev", + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", + "channel": "release/2.1", "toolsets": { "visualstudio": { "required": false, From 818d4256aaa8d5de8673e82ced5e06f9f9a3c490 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Thu, 1 Feb 2018 11:16:57 -0800 Subject: [PATCH 2/2] Fix #1999 The fix for this for preview1 is to ignore any files with an absolute path. MvcPrecompilation ignores files outside the project root, and we're aiming for parity. This will have a proper fix in preview2 --- .../Microsoft.AspNetCore.Razor.Design.targets | 12 +++++-- .../MSBuildIntegrationTestBase.cs | 12 +++++++ .../IntegrationTests/ProjectDirectory.cs | 10 ++++-- .../RazorGenerateIntegrationTest.cs | 32 +++++++++++++++++++ .../AppWithP2PReference.csproj | 2 ++ .../testapps/ClassLibrary/ClassLibrary.csproj | 2 ++ test/testapps/SimpleMvc/SimpleMvc.csproj | 2 ++ test/testapps/SimplePages/SimplePages.csproj | 2 ++ 8 files changed, 70 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.targets b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.targets index 5fcb47a7ce..27a54e7a17 100644 --- a/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.targets +++ b/src/Microsoft.AspNetCore.Razor.Design/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.targets @@ -167,8 +167,16 @@ - - + + + $(RazorGenerateIntermediateOutputPath)%(RelativeDir)%(Filename).cs diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs index 1bc76c5745..b69109869b 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs @@ -61,6 +61,18 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests msBuildProcessKind); } + internal void AddProjectFileContent(string content) + { + if (content == null) + { + throw new ArgumentNullException(nameof(content)); + } + + var existing = File.ReadAllText(Project.ProjectFilePath); + var updated = existing.Replace("", content); + File.WriteAllText(Project.ProjectFilePath, updated); + } + internal void ReplaceContent(string content, params string[] paths) { if (content == null) diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs index 8b117f9dff..c21f2faa2b 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs @@ -57,7 +57,10 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests CopyGlobalJson(solutionRoot, destinationPath); - return new ProjectDirectory(destinationPath, Path.Combine(destinationPath, projectName)); + return new ProjectDirectory( + destinationPath, + Path.Combine(destinationPath, projectName), + Path.Combine(destinationPath, projectName, projectName + ".csproj")); } catch { @@ -132,14 +135,17 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests } } - private ProjectDirectory(string solutionPath, string directoryPath) + private ProjectDirectory(string solutionPath, string directoryPath, string projectFilePath) { SolutionPath = solutionPath; DirectoryPath = directoryPath; + ProjectFilePath = projectFilePath; } public string DirectoryPath { get; } + public string ProjectFilePath { get;} + public string SolutionPath { get; } public void Dispose() diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs index af4dd592d1..80193b0069 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs @@ -247,5 +247,37 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "About.cs"); Assert.FileCountEquals(result, 1, RazorIntermediateOutputPath, "*.cs"); } + + [Fact] + [InitializeTestProject("SimpleMvc")] + public async Task RazorGenerate_FileWithAbsolutePath_IgnoresFile() + { + // In preview1 we totally ignore files that are specified with an absolute path + var filePath = Path.Combine(Project.SolutionPath, "temp.cshtml"); + File.WriteAllText(filePath, string.Empty); + + AddProjectFileContent($@" + + +"); + + var result = await DotnetMSBuild(RazorGenerateTarget); + + Assert.BuildPassed(result); + + // RazorGenerate should compile the assembly, but not the views. + Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.dll"); + Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.dll"); + + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "_ViewImports.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "_ViewStart.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "About.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "Contact.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "Index.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "_Layout.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "_ValidationScriptsPartial.cs"); + Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "Error.cs"); + Assert.FileCountEquals(result, 8, RazorIntermediateOutputPath, "*.cs"); + } } } diff --git a/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj b/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj index 2ef0434947..82ba010fe7 100644 --- a/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj +++ b/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj @@ -6,6 +6,8 @@ RazorSDK + + diff --git a/test/testapps/ClassLibrary/ClassLibrary.csproj b/test/testapps/ClassLibrary/ClassLibrary.csproj index 7e9ea198c6..18338f29d2 100644 --- a/test/testapps/ClassLibrary/ClassLibrary.csproj +++ b/test/testapps/ClassLibrary/ClassLibrary.csproj @@ -6,6 +6,8 @@ RazorSDK + + diff --git a/test/testapps/SimpleMvc/SimpleMvc.csproj b/test/testapps/SimpleMvc/SimpleMvc.csproj index e553d82b2a..11dac1b1da 100644 --- a/test/testapps/SimpleMvc/SimpleMvc.csproj +++ b/test/testapps/SimpleMvc/SimpleMvc.csproj @@ -6,6 +6,8 @@ RazorSDK + + diff --git a/test/testapps/SimplePages/SimplePages.csproj b/test/testapps/SimplePages/SimplePages.csproj index e553d82b2a..11dac1b1da 100644 --- a/test/testapps/SimplePages/SimplePages.csproj +++ b/test/testapps/SimplePages/SimplePages.csproj @@ -6,6 +6,8 @@ RazorSDK + +