From 2ac4619635c4863d030b3a97a3741ef158a3f9f8 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 13 Feb 2019 10:22:03 -0800 Subject: [PATCH] Replace custom targets for generating assembly attributes and source control info by using SDK features (#7504) --- .azure/pipelines/ci.yml | 2 +- Directory.Build.props | 56 +++++++++++++------ Directory.Build.targets | 1 + build/Maestro/Maestro.csproj | 8 +-- build/SharedFx.targets | 2 +- build/repo.targets | 1 - dockerbuild.sh | 5 +- eng/Versions.props | 2 + eng/Workarounds.targets | 6 ++ eng/targets/CSharp.Common.props | 16 ++++++ eng/targets/CSharp.Common.targets | 30 +++++++++- eng/targets/Packaging.targets | 13 +++++ eng/targets/Wix.Common.props | 4 +- ...spNetCore.Authentication.AzureAD.UI.csproj | 17 ------ ...etCore.Authentication.AzureADB2C.UI.csproj | 17 ------ .../Microsoft.AspNetCore.Blazor.Build.csproj | 2 +- .../Microsoft.AspNetCore.Blazor.Cli.csproj | 2 +- .../src/SetPackageProperties.targets | 2 +- ...crosoft.AspNetCore.Components.Build.csproj | 2 +- src/Framework/src/SharedFx.targets | 6 +- .../Microsoft.AspNetCore.App.UnitTests.csproj | 10 ++-- .../Microsoft.AspNetCore.Identity.UI.csproj | 18 ------ .../Archive/Archive.Internal.zipproj | 1 + src/Installers/Archive/Archive.Redist.zipproj | 1 + .../CustomAction/aspnetcoreCA.vcxproj | 1 + src/MusicStore/Directory.Build.props | 8 +++ .../Microsoft.AspNetCore.Mvc.Analyzers.csproj | 2 +- ...rosoft.AspNetCore.Mvc.Api.Analyzers.csproj | 2 +- ...ft.Extensions.ApiDescription.Design.csproj | 2 +- .../SetPackageProperties.targets | 2 +- version.props | 19 ++++--- 31 files changed, 155 insertions(+), 105 deletions(-) create mode 100644 src/MusicStore/Directory.Build.props diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index b4bb44fad4e..fbb6fe944f3 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -263,7 +263,7 @@ jobs: jobDisplayName: "Build: Linux Musl x64" agentOs: Linux buildScript: ./dockerbuild.sh alpine - buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch x64 --os-name linux-musl --no-build-nodejs --no-build-java -p:RepositoryBranch=$(Build.SourceBranchName) + buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch x64 --os-name linux-musl --no-build-nodejs --no-build-java installNodeJs: false afterBuild: # Remove packages that are not rid-specific. diff --git a/Directory.Build.props b/Directory.Build.props index a33ef67d4f4..ef670c06ead 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,15 +15,6 @@ https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt Apache-2.0 - - $(NoWarn);NU5125 - - $(NoWarn);NU5105 - - $(WarningsNotAsErrors);CS1591 nugetaspnet@microsoft.com @@ -42,6 +33,22 @@ Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub ($(RepositoryUrl)). We happily accept issues and PRs. + + + true + + $(NoWarn);NU5125 + + $(NoWarn);NU5105 + + $(WarningsNotAsErrors);CS1591 + + $(WarningsNotAsErrors);xUnit1004 + + $(MSBuildThisFileDirectory) @@ -49,13 +56,23 @@ git $(MSBuildThisFileDirectory)src\Shared\ $(RepositoryRoot)src\submodules\googletest\ + + true + + false + + + true + + + + + + - $(MSBuildThisFileDirectory)eng\AspNetCore.snk - true - true Debug AnyCPU $(Platform) @@ -77,16 +94,14 @@ linux-arm64 - - SHA256 + + true + true false - - - strict @@ -139,12 +154,17 @@ true true true - true + true + + false $(MSBuildThisFileDirectory)src\Mvc\src\Microsoft.AspNetCore.Mvc.Testing\Microsoft.AspNetCore.Mvc.Testing.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index 5cbafbe2578..843f5ac441c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -67,6 +67,7 @@ true + diff --git a/build/Maestro/Maestro.csproj b/build/Maestro/Maestro.csproj index e9af762aa89..14344c5f51b 100644 --- a/build/Maestro/Maestro.csproj +++ b/build/Maestro/Maestro.csproj @@ -23,15 +23,15 @@ + DependsOnTargets="GetFilesToPublish"> + RepoUri="$(BUILD_REPOSITORY_URI)" + RepoBranch="$(BUILD_SOURCEBRANCH)" + RepoCommit="$(BUILD_SOURCEVERSION)" /> diff --git a/build/SharedFx.targets b/build/SharedFx.targets index 0a3066c666b..80e29788358 100644 --- a/build/SharedFx.targets +++ b/build/SharedFx.targets @@ -21,7 +21,7 @@ - + <_RestoreGraphProjectInput>@(FxProjectToBuild) diff --git a/build/repo.targets b/build/repo.targets index eaf4a9fb1fa..ba8999ae131 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -2,7 +2,6 @@ - diff --git a/dockerbuild.sh b/dockerbuild.sh index da76a9f482d..9bbab769beb 100755 --- a/dockerbuild.sh +++ b/dockerbuild.sh @@ -98,7 +98,7 @@ fi commit_hash="$(git rev-parse HEAD || true)" if [ ! -z "$commit_hash" ]; then - build_args[${#build_args[*]}]="-p:RepositoryCommit=$commit_hash" + build_args[${#build_args[*]}]="-p:SourceRevisionId=$commit_hash" fi dockerfile="$DIR/build/docker/$image.Dockerfile" @@ -118,6 +118,9 @@ docker run \ -e TEAMCITY_VERSION \ -e BUILD_NUMBER \ -e BUILD_BUILDNUMBER \ + -e BUILD_REPOSITORY_URI \ + -e BUILD_SOURCEVERSION \ + -e BUILD_SOURCEBRANCH \ -e DOTNET_CLI_TELEMETRY_OPTOUT \ -e Configuration \ -v "$DIR:/code/build" \ diff --git a/eng/Versions.props b/eng/Versions.props index 7652805fe69..fff00512139 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -130,6 +130,8 @@ 3.0.0-build-20190130.1 1.0.0-alpha-004 15.9.0 + 1.0.0-beta2-18618-05 + 1.0.0-beta2-18618-05 4.5.0 4.4.0 diff --git a/eng/Workarounds.targets b/eng/Workarounds.targets index 9b1af1b35fd..7c9693585b5 100644 --- a/eng/Workarounds.targets +++ b/eng/Workarounds.targets @@ -1,3 +1,9 @@ + + + + diff --git a/eng/targets/CSharp.Common.props b/eng/targets/CSharp.Common.props index b8849afad77..854d6a7a8d8 100644 --- a/eng/targets/CSharp.Common.props +++ b/eng/targets/CSharp.Common.props @@ -2,6 +2,22 @@ 7.3 + + $(MSBuildThisFileDirectory)..\AspNetCore.snk + true + + + SHA256 + + + strict + + + false + false + false + false + true diff --git a/eng/targets/CSharp.Common.targets b/eng/targets/CSharp.Common.targets index 4ed1d933eb1..7836a6072e0 100644 --- a/eng/targets/CSharp.Common.targets +++ b/eng/targets/CSharp.Common.targets @@ -5,7 +5,35 @@ net$(TargetFrameworkVersion.Substring(1).Replace('.','')) .NETFramework - + + + + + + <_Parameter1>CommitHash + <_Parameter2>$(SourceRevisionId) + + + + <_Parameter1>SourceCommitUrl + <_Parameter2>$(RepositoryUrl)/tree/$(SourceRevisionId) + + + + <_Parameter1>Serviceable + <_Parameter2>True + + + + + + + $(VersionPrefix).$(FileRevisionVersion) + + + diff --git a/eng/targets/Packaging.targets b/eng/targets/Packaging.targets index 5e5b8014d88..9e29c6cd05a 100644 --- a/eng/targets/Packaging.targets +++ b/eng/targets/Packaging.targets @@ -19,4 +19,17 @@ + + $(GenerateNuspecDependsOn);_AppendRepostoryUrlToPackageDescription + + + + + $(PackageDescription) + +This package was built from the source code at $(RepositoryUrl)/tree/$(SourceRevisionId) + + + diff --git a/eng/targets/Wix.Common.props b/eng/targets/Wix.Common.props index 9875352599b..a6d4d145398 100644 --- a/eng/targets/Wix.Common.props +++ b/eng/targets/Wix.Common.props @@ -8,8 +8,8 @@ - - net461 + Native,Version=v0.0 + $(BaseIntermediateOutputPath) $(MSBuildProjectDir)\obj\ diff --git a/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj b/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj index 1605940b286..0a981c18c7f 100644 --- a/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj +++ b/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj @@ -22,21 +22,4 @@ - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - - - - - diff --git a/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj b/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj index 485d3a40851..1e674a78deb 100644 --- a/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj +++ b/src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj @@ -22,21 +22,4 @@ - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - - - - - diff --git a/src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj b/src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj index 61c027e1755..b675eaa4fc2 100644 --- a/src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj +++ b/src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj @@ -28,7 +28,7 @@ componentsversion=$(ComponentsPackageVersion); razorversion=$(MicrosoftAspNetCoreRazorDesignPackageVersion); blazormonoversion=$(MicrosoftAspNetCoreBlazorMonoPackageVersion); - repositorycommit=$(RepositoryCommit); + repositorycommit=$(SourceRevisionId); <_TargetFramework Include="$(TargetFramework)" /> diff --git a/src/Components/Blazor/Cli/src/Microsoft.AspNetCore.Blazor.Cli.csproj b/src/Components/Blazor/Cli/src/Microsoft.AspNetCore.Blazor.Cli.csproj index 5b49f24fba8..ff6b0ea7e38 100644 --- a/src/Components/Blazor/Cli/src/Microsoft.AspNetCore.Blazor.Cli.csproj +++ b/src/Components/Blazor/Cli/src/Microsoft.AspNetCore.Blazor.Cli.csproj @@ -35,7 +35,7 @@ blazorversion=$(PackageVersion); aspnetcoreversion=$(ComponentsPackageVersion); sharedfxversion=$(SharedFxVersion); - repositorycommit=$(RepositoryCommit); + repositorycommit=$(SourceRevisionId); diff --git a/src/Components/Build/src/Microsoft.AspNetCore.Components.Build.csproj b/src/Components/Build/src/Microsoft.AspNetCore.Components.Build.csproj index 9ed61e3a31d..baec1e15e39 100644 --- a/src/Components/Build/src/Microsoft.AspNetCore.Components.Build.csproj +++ b/src/Components/Build/src/Microsoft.AspNetCore.Components.Build.csproj @@ -17,7 +17,7 @@ version=$(PackageVersion); - repositorycommit=$(RepositoryCommit); + repositorycommit=$(SourceRevisionId); diff --git a/src/Framework/src/SharedFx.targets b/src/Framework/src/SharedFx.targets index 07f9de44b3f..e9b2918fc4d 100644 --- a/src/Framework/src/SharedFx.targets +++ b/src/Framework/src/SharedFx.targets @@ -174,9 +174,9 @@ This targets file should only be imported by .shfxproj files. - + - + @@ -369,7 +369,7 @@ This targets file should only be imported by .shfxproj files. projectUrl=$(PackageProjectUrl); iconUrl=$(PackageIconUrl); repositoryUrl=$(RepositoryUrl); - repositoryCommit=$(RepositoryCommit); + repositoryCommit=$(SourceRevisionId); copyright=$(Copyright); targetFramework=$(TargetFramework); symbolsAssets=$([MSBuild]::NormalizeDirectory($(SymbolsOutputPath))); diff --git a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj index 94ae36e6b5e..3173cbf4b40 100644 --- a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj +++ b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj @@ -14,10 +14,6 @@ <_Parameter1>TargetRuntimeIdentifier <_Parameter2>$(TargetRuntimeIdentifier) - - <_Parameter1>RepositoryCommit - <_Parameter2>$(RepositoryCommit) - <_Parameter1>MicrosoftNETCoreAppPackageVersion <_Parameter2>$(RuntimeFrameworkVersion) @@ -35,8 +31,12 @@ - + + + <_Parameter1>RepositoryCommit + <_Parameter2>$(SourceRevisionId) + <_Parameter1>SharedFxDependencies <_Parameter2>@(AspNetCoreAppReference);@(AspNetCoreAppReferenceAndPackage);@(ExternalAspNetCoreAppReference);@(_TransitiveExternalAspNetCoreAppReference) diff --git a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj index 24064cf10a3..f45e79b9a61 100644 --- a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj @@ -38,24 +38,6 @@ - - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - <_Parameter1>BuildNumber - <_Parameter2>$(BuildNumber) - - - - - - - - diff --git a/src/Installers/Archive/Archive.Internal.zipproj b/src/Installers/Archive/Archive.Internal.zipproj index 4939325fd27..def274cd5e8 100644 --- a/src/Installers/Archive/Archive.Internal.zipproj +++ b/src/Installers/Archive/Archive.Internal.zipproj @@ -17,6 +17,7 @@ + false true _ResolvedFxProjects diff --git a/src/Installers/Archive/Archive.Redist.zipproj b/src/Installers/Archive/Archive.Redist.zipproj index 5bd4b743733..d4a35205042 100644 --- a/src/Installers/Archive/Archive.Redist.zipproj +++ b/src/Installers/Archive/Archive.Redist.zipproj @@ -26,6 +26,7 @@ + false true _ResolvedFxProjects diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.vcxproj b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.vcxproj index b3043975948..8aafdde3c1a 100644 --- a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.vcxproj +++ b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.vcxproj @@ -3,6 +3,7 @@ $(MSBuildThisFileDirectory)..\ + false diff --git a/src/MusicStore/Directory.Build.props b/src/MusicStore/Directory.Build.props new file mode 100644 index 00000000000..b73362940b4 --- /dev/null +++ b/src/MusicStore/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + + false + + diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Analyzers/Microsoft.AspNetCore.Mvc.Analyzers.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Analyzers/Microsoft.AspNetCore.Mvc.Analyzers.csproj index 4426de887fc..1db6be9790d 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Analyzers/Microsoft.AspNetCore.Mvc.Analyzers.csproj +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Analyzers/Microsoft.AspNetCore.Mvc.Analyzers.csproj @@ -28,7 +28,7 @@ projectUrl=$(PackageProjectUrl); iconUrl=$(PackageIconUrl); repositoryUrl=$(RepositoryUrl); - repositoryCommit=$(RepositoryCommit); + repositoryCommit=$(SourceRevisionId); copyright=$(Copyright); OutputBinary=$(OutputPath)$(AssemblyName).dll; diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj index 0e279291fd9..9336651e1dc 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj @@ -33,7 +33,7 @@ projectUrl=$(PackageProjectUrl); iconUrl=$(PackageIconUrl); repositoryUrl=$(RepositoryUrl); - repositoryCommit=$(RepositoryCommit); + repositoryCommit=$(SourceRevisionId); copyright=$(Copyright); OutputBinary=$(OutputPath)$(AssemblyName).dll; diff --git a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj index d0976a5eaaf..3d40d120d8a 100644 --- a/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj +++ b/src/Mvc/src/Microsoft.Extensions.ApiDescription.Design/Microsoft.Extensions.ApiDescription.Design.csproj @@ -46,7 +46,7 @@ licenseUrl=$(PackageLicenseUrl); owners=$(Company); projectUrl=$(PackageProjectUrl); - repositoryCommit=$(RepositoryCommit); + repositoryCommit=$(SourceRevisionId); repositoryUrl=$(RepositoryUrl); tags=$(PackageTags.Replace(';', ' ')); version=$(PackageVersion); diff --git a/src/ProjectTemplates/SetPackageProperties.targets b/src/ProjectTemplates/SetPackageProperties.targets index 0d4c99dde33..d0931165148 100644 --- a/src/ProjectTemplates/SetPackageProperties.targets +++ b/src/ProjectTemplates/SetPackageProperties.targets @@ -14,7 +14,7 @@ projectUrl=$(PackageProjectUrl); repositoryUrl=$(RepositoryUrl); repositoryType=$(RepositoryType); - repositoryCommit=$(RepositoryCommit); + repositoryCommit=$(SourceRevisionId); diff --git a/version.props b/version.props index e94c8bd8e0c..bee06802153 100644 --- a/version.props +++ b/version.props @@ -8,6 +8,7 @@ Preview $(PreReleasePreviewNumber) 0.3.$(AspNetCorePatchVersion) 0.8.$(AspNetCorePatchVersion) + $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion) 1$(AspNetCoreMajorVersion) @@ -15,10 +16,10 @@ $(AspNetCorePatchVersion) $(BUILD_BUILDNUMBER) - $([System.DateTime]::Now.ToString('yyyyMMdd')).$(BUILD_NUMBER) + $([System.DateTime]::Now.ToString('yyyyMMdd')).1 - + <_BuildNumber>$(OfficialBuildId) @@ -32,18 +33,20 @@ <_BuildNumberShortDate>$([MSBuild]::Add($([MSBuild]::Add($([MSBuild]::Multiply($(_BuildNumberYY), 1000)), $([MSBuild]::Multiply($(_BuildNumberMM), 50)))), $(_BuildNumberDD))) $([System.Convert]::ToInt32($(_BuildNumberR))) - - - $(VersionSuffixBuildOfTheDay.PadLeft(2, '0')) - $(VersionSuffixBuildOfTheDay.PadLeft(4, '0')) + $(VersionSuffixBuildOfTheDay.PadLeft(2, '0')) $(_BuildNumberShortDate)-$(VersionSuffixBuildOfTheDayPadded) + + $(_BuildNumberShortDate) + + + + t000 + 42424 - t000 - $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion) $(PreReleaseLabel)-$(BuildNumberSuffix) $(PreReleaseBrandingLabel) Build $(BuildNumberSuffix)