diff --git a/.editorconfig b/.editorconfig index abd3d48553..eaad11e7db 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ root = true [*] indent_style = space # (Please don't specify an indent_size here; that has too many unintended consequences.) +trim_trailing_whitespace = true # Code files [*.{cs,csx,vb,vbx}] diff --git a/Directory.Build.props b/Directory.Build.props index 46ed60d2fa..1097d1cb03 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ false @@ -14,12 +14,7 @@ - - - $(CopyrightMicrosoft) - Apache-2.0 - - + 8.0 MicrosoftAspNetCore @@ -28,22 +23,19 @@ true true true + true + Apache-2.0 Microsoft ASP.NET Core https://go.microsoft.com/fwlink/?LinkID=288859 - - $(NoWarn);NU5125 - - $(NoWarn);MSB3277 - \ No newline at end of file + diff --git a/Directory.Build.targets b/Directory.Build.targets index 90194d2be5..c9a05daf31 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,13 +3,8 @@ - - - - - $(MicrosoftNETCorePlatformsPackageVersion) - \ No newline at end of file + diff --git a/NuGet.config b/NuGet.config index 7fa789a1df..2ba88b8eb4 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,8 +2,7 @@ - - \ No newline at end of file + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c7f0027a96..62e34fa4b2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,7 @@ +# +# See https://docs.microsoft.com/azure/devops/pipelines/yaml-schema for reference. +# + variables: - name: Build.Repository.Clean value: true @@ -10,18 +14,18 @@ variables: - name: _DotNetArtifactsCategory value: ASPNETCORETOOLING -resources: - containers: - - container: LinuxContainer - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 - options: --init # This ensures all the stray defunct processes are reaped. - trigger: -- master -- release/* + batch: true + branches: + include: + - master + - release/* pr: -- "*" + autoCancel: true + branches: + include: + - '*' jobs: # This job checks for code quality @@ -50,6 +54,60 @@ jobs: - powershell: ./restore.cmd -ci; ./eng/scripts/CodeCheck.ps1 -ci displayName: Run eng/scripts/CodeCheck.ps1 + - job: Source_Build + jobName: Source_Build + displayName: 'Test: Linux Source Build' + container: + image: centos:7 + options: --init # This ensures all the stray defunct processes are reaped. + pool: + vmImage: ubuntu-16.04 + variables: + - DotNetCoreSdkDir: $(Agent.ToolsDirectory)/dotnet + - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true + - _BuildConfig: Release + steps: + - script: | + source eng/common/native/common-library.sh + mkdir -p $HOME/bin + GetFile https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 $HOME/bin/jq + chmod +x $HOME/bin/jq + echo "##vso[task.prependpath]$HOME/bin" + displayName: Install jq + - task: UseDotNet@2 + displayName: 'Use .NET Core sdk' + inputs: + packageType: sdk + # The SDK version selected here is intentionally supposed to use the latest release + # For the purpose of building Linux distros, we can't depend on features of the SDK + # which may not exist in pre-built versions of the SDK + version: 3.0.x + installationPath: $(DotNetCoreSdkDir) + includePreviewVersions: true + + - script: ./eng/scripts/ci-source-build.sh --ci --configuration $(_BuildConfig) + displayName: Run ci-source-build.sh + + - task: PublishBuildArtifacts@1 + displayName: Upload package artifacts + # Only capture source build artifacts in PRs for the sake of inspecting + # changes that impact source-build. The artifacts from this build pipeline are never actually used. + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) + inputs: + pathtoPublish: artifacts/packages/ + artifactName: Source_Build_Packages + artifactType: Container + parallel: true + + - task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: Source_Build_Logs + continueOnError: true + condition: always() + # Three jobs for each of the three OSes we want to run on - template: /eng/common/templates/jobs/jobs.yml parameters: @@ -165,8 +223,10 @@ jobs: condition: succeeded() - job: Linux + container: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 + options: --init # This ensures all the stray defunct processes are reaped. pool: - container: LinuxContainer vmImage: ubuntu-16.04 strategy: matrix: @@ -181,3 +241,4 @@ jobs: name: Build displayName: Build condition: succeeded() + diff --git a/build.cmd b/build.cmd index e3291e911c..a454ccc91d 100644 --- a/build.cmd +++ b/build.cmd @@ -1,3 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -build -restore -pack -test %*" -exit /b %ErrorLevel% \ No newline at end of file +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build -pack %*" +exit /b %ErrorLevel% diff --git a/build.sh b/build.sh index 297d102ad2..f3e19c865e 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,4 @@ while [[ -h $source ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -"$scriptroot/eng/common/build.sh" --pack --build --restore --test $@ \ No newline at end of file +"$scriptroot/eng/common/build.sh" --restore --build --pack $@ diff --git a/eng/AfterSigning.targets b/eng/AfterSigning.targets index 316082e5ba..0f7e3a6821 100644 --- a/eng/AfterSigning.targets +++ b/eng/AfterSigning.targets @@ -1,11 +1,11 @@ - + $(ArtifactsDir)VSSetup\ Microsoft.VisualStudio.RazorExtension.vsix - - \ No newline at end of file + diff --git a/eng/MPack.targets b/eng/MPack.targets index 84dc80b533..d906f0bbb7 100644 --- a/eng/MPack.targets +++ b/eng/MPack.targets @@ -1,16 +1,16 @@  - + @@ -27,11 +27,11 @@ - + - @@ -41,7 +41,7 @@ - $(AddinDirectory)Properties\_Manifest.addin.xml + $(AddinDirectory)Properties\_Manifest.addin.xml $(IntermediateOutputPath)addin.info diff --git a/eng/Versions.props b/eng/Versions.props index 7c555a7332..54a0d76e31 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -33,7 +33,7 @@ $(AddinVersion).42424242.42 - + $(RestoreSources); https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json; https://dotnet.myget.org/F/roslyn/api/v3/index.json; diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh old mode 100644 new mode 100755 diff --git a/eng/configure-toolset.sh b/eng/configure-toolset.sh index cf4dd15b05..ea92acd6a3 100644 --- a/eng/configure-toolset.sh +++ b/eng/configure-toolset.sh @@ -2,4 +2,6 @@ # We could potentially try to find an existing installation that has all the required runtimes, # but it's unlikely one will be available. -use_installed_dotnet_cli="false" \ No newline at end of file +if [ "${DotNetBuildFromSource:-false}" = false ]; then + use_installed_dotnet_cli="false" +fi diff --git a/eng/scripts/ci-source-build.sh b/eng/scripts/ci-source-build.sh new file mode 100755 index 0000000000..de09c63d2a --- /dev/null +++ b/eng/scripts/ci-source-build.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# +# This script is meant for testing source build by imitating some of the input parameters and conditions. +# + +set -euo pipefail + +scriptroot="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +reporoot="$(dirname "$(dirname "$scriptroot")")" + +# For local development, make a backup copy of this file first +if [ ! -f "$reporoot/global.bak.json" ]; then + mv "$reporoot/global.json" "$reporoot/global.bak.json" +fi + +# Detect the current version of .NET Core installed +export SDK_VERSION=$(dotnet --version) +echo "The ambient version of .NET Core SDK version = $SDK_VERSION" + +# Update the global.json file to match the current .NET environment +cat "$reporoot/global.bak.json" | \ + jq '.sdk.version=env.SDK_VERSION' | \ + jq '.tools.dotnet=env.SDK_VERSION' | \ + jq 'del(.tools.runtimes)' \ + > "$reporoot/global.json" + +# Restore the original global.json file +trap "{ + mv "$reporoot/global.bak.json" "$reporoot/global.json" +}" EXIT + +export DotNetBuildFromSource='true' +"$reporoot/build.sh" "$@" diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj index ab0ec8c6fc..e38908b067 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj @@ -6,6 +6,7 @@ true true false + true diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/Microsoft.AspNetCore.Components.Razor.Extensions.csproj b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/Microsoft.AspNetCore.Components.Razor.Extensions.csproj index a690a69a9d..88ee6cf430 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/Microsoft.AspNetCore.Components.Razor.Extensions.csproj +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/Microsoft.AspNetCore.Components.Razor.Extensions.csproj @@ -6,6 +6,8 @@ Microsoft.AspNetCore.Components.Razor Extensions to the Razor compiler to support building Razor Components. true + + true true diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj index 4956a092a8..d678a2f023 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj @@ -5,6 +5,7 @@ netstandard2.0 false false + true diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj index 1bc47bc5d7..3da69ecd3a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj @@ -5,6 +5,7 @@ net472 false false + true diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj index f0e321e12e..937f05783c 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj @@ -5,6 +5,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the Visual Studio agnostic Razor design-time infrastructure. false false + true $(NoWarn);VSTHRD200 diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj index 33126f7eba..6ec21290e3 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj @@ -7,6 +7,7 @@ ..\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Rules\ Microsoft.VisualStudio.LanguageServices.Razor.ruleset false + true @@ -48,7 +49,7 @@ - + @@ -153,7 +154,7 @@ diff --git a/src/Razor/src/Microsoft.VisualStudio.LiveShare.Razor/Microsoft.VisualStudio.LiveShare.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.LiveShare.Razor/Microsoft.VisualStudio.LiveShare.Razor.csproj index a2c5e8e8fa..5d6a6bf064 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LiveShare.Razor/Microsoft.VisualStudio.LiveShare.Razor.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.LiveShare.Razor/Microsoft.VisualStudio.LiveShare.Razor.csproj @@ -6,6 +6,7 @@ false Microsoft.VisualStudio.LiveShare.Razor.ruleset false + true @@ -26,4 +27,4 @@ - \ No newline at end of file + diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj index ec829990af..9149d35a38 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj @@ -6,6 +6,7 @@ false $(NoWarn);MSB3277 false + true false diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj b/src/Razor/src/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj index 96fe6d0d00..e76aacc6c8 100644 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj @@ -1,10 +1,11 @@  - + net472 true Microsoft.VisualStudio.Mac.RazorAddin + true false diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj index e94b620a7c..5993874225 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj @@ -19,6 +19,7 @@ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + true false @@ -131,7 +132,7 @@ using Microsoft.VisualStudio.Shell; - diff --git a/src/Razor/src/RazorDeveloperTools/RazorDeveloperTools.csproj b/src/Razor/src/RazorDeveloperTools/RazorDeveloperTools.csproj index cae61d7f30..16e87494ca 100644 --- a/src/Razor/src/RazorDeveloperTools/RazorDeveloperTools.csproj +++ b/src/Razor/src/RazorDeveloperTools/RazorDeveloperTools.csproj @@ -17,6 +17,7 @@ false + true false @@ -105,7 +106,7 @@ - diff --git a/src/Razor/src/RazorPageGenerator/RazorPageGenerator.csproj b/src/Razor/src/RazorPageGenerator/RazorPageGenerator.csproj index d8aeb63338..b7ad492c5c 100644 --- a/src/Razor/src/RazorPageGenerator/RazorPageGenerator.csproj +++ b/src/Razor/src/RazorPageGenerator/RazorPageGenerator.csproj @@ -8,6 +8,7 @@ Exe false false + true diff --git a/src/Razor/test/Directory.Build.props b/src/Razor/test/Directory.Build.props index cd74f6e0d4..20be3c28e0 100644 --- a/src/Razor/test/Directory.Build.props +++ b/src/Razor/test/Directory.Build.props @@ -2,6 +2,7 @@ + true netcoreapp3.0 $(DeveloperBuildTestTfms) $(StandardTestTfms) diff --git a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/Microsoft.NET.Sdk.Razor.Test.csproj b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/Microsoft.NET.Sdk.Razor.Test.csproj index b3097334e7..ac9c318068 100644 --- a/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/Microsoft.NET.Sdk.Razor.Test.csproj +++ b/src/Razor/test/Microsoft.NET.Sdk.Razor.Test/Microsoft.NET.Sdk.Razor.Test.csproj @@ -63,7 +63,7 @@ $(IntermediateOutputPath)BuildVariables.generated.cs - - +