From a5125e47125d59e6474ff3af455b443843930d16 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Tue, 10 Mar 2020 11:36:16 -0700 Subject: [PATCH] Fix several issues in build and publishing (#889) * Make packages explicitly Shipping/Non-Shipping * Work around SDK bug that trips sourcelink validation * Cleanup properies in publishing These properties used to be needed, but they have been removed in arcade. The new workflow is to use pipeline publishing which this repo uses. * Make publishing explicit for test products that need it This will save us from hardcoding paths by making it more explicit. That way when we clean up and decouple builds we can have breaks when needed. It also brings down artifact size from 318 MB to 206 for xcopy tests needed for helix. * Correctly bubble up native build issues. --- diagnostics.yml | 18 +++++++++-- eng/Build-Native.cmd | 32 +++++++++++++------ eng/common-variables.yml | 32 ------------------- src/Directory.Build.targets | 14 ++++++-- ...Microsoft.Diagnostics.DebugServices.csproj | 2 +- ...icrosoft.Diagnostics.NETCore.Client.csproj | 2 +- .../Microsoft.Diagnostics.Repl.csproj | 2 +- .../Microsoft.Diagnostics.TestHelpers.csproj | 2 +- src/SOS/SOS.NETCore/SOS.NETCore.csproj | 3 +- src/SOS/SOS.Package/SOS.Package.csproj | 1 + .../Windows/Debugger.Tests.Config.txt | 2 +- src/SOS/SOS.UnitTests/SOS.UnitTests.csproj | 1 + src/Tools/Directory.Build.props | 1 + src/Tools/dotnet-dump/dotnet-dump.csproj | 1 + 14 files changed, 61 insertions(+), 52 deletions(-) delete mode 100644 eng/common-variables.yml diff --git a/diagnostics.yml b/diagnostics.yml index deb3d84a4b..8fe76a879f 100644 --- a/diagnostics.yml +++ b/diagnostics.yml @@ -13,7 +13,21 @@ pr: - LICENSE.TXT variables: -- template: /eng/common-variables.yml + - name: _TeamName + value: DotNetCore + - name: _InternalBuildArgs + value: '' + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _SignType + value: real + # DotNet-Diagnostics-SDL-Params provides Tsa* variables for SDL checks. + - group: DotNet-Diagnostics-SDL-Params + - name: _InternalBuildArgs + value: /p:DotNetSignType=$(_SignType) + /p:TeamName=$(_TeamName) + /p:DotNetPublishUsingPipelines=$(PublishPackages) + /p:OfficialBuildId=$(BUILD.BUILDNUMBER) stages: - stage: build @@ -248,7 +262,7 @@ stages: - template: /eng/common/templates/job/job.yml parameters: name: Sign_Package_Publish - displayName: Sign, Package, and Publish to BAR + displayName: Sign, Package, and Generate BAR Manifests dependsOn: - Windows - CentOS_7 diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index 8ab3931944..3389991565 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -10,7 +10,7 @@ set __ThisScriptFull="%~f0" set __ThisScriptDir="%~dp0" call "%__ThisScriptDir%"\setup-vs-tools.cmd -if NOT '%ERRORLEVEL%' == '0' exit /b 1 +if NOT '%ERRORLEVEL%' == '0' goto ExitWithError if defined VS160COMNTOOLS ( set "__VSToolsRoot=%VS160COMNTOOLS%" @@ -150,7 +150,7 @@ REM ============================================================================ set __DotNetCli=%__ProjectDir%\.dotnet\dotnet.exe if not exist "%__DotNetCli%" ( echo %__MsgPrefix%Assertion failed: dotnet cli not found at path "%__DotNetCli%" - exit /b 1 + goto ExitWithError ) REM ========================================================================================= @@ -180,7 +180,7 @@ if /i %__BuildCrossArch% EQU 1 ( powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED - exit /b 1 + goto ExitWithError ) if defined __SkipConfigure goto SkipConfigureCrossBuild @@ -199,7 +199,7 @@ if /i %__BuildCrossArch% EQU 1 ( :SkipConfigureCrossBuild if not exist "%__CrossCompIntermediatesDir%\install.vcxproj" ( echo %__MsgPrefix%Error: failed to generate cross-arch components build project! - exit /b 1 + goto ExitWithError ) if defined __ConfigureOnly goto SkipCrossCompBuild @@ -211,7 +211,7 @@ if /i %__BuildCrossArch% EQU 1 ( if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: echo !__BuildLog! - exit /b 1 + goto ExitWithError ) :SkipCrossCompBuild @@ -250,7 +250,7 @@ if %__Build% EQU 1 ( if not defined VSINSTALLDIR ( echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined. - exit /b 1 + goto ExitWithError ) echo Generating Version Header @@ -258,7 +258,7 @@ if %__Build% EQU 1 ( powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED - exit /b 1 + goto ExitWithError ) if defined __SkipConfigure goto SkipConfigure @@ -278,7 +278,7 @@ if %__Build% EQU 1 ( if not exist "%__IntermediatesDir%\install.vcxproj" ( echo %__MsgPrefix%Error: failed to generate native component build project! - exit /b 1 + goto ExitWithError ) set __BuildLog="%__LogDir%\Native.Build.binlog" @@ -288,7 +288,7 @@ if %__Build% EQU 1 ( if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: echo !__BuildLog! - exit /b 1 + goto ExitWithError ) :SkipNativeBuild @@ -314,6 +314,18 @@ echo %__MsgPrefix%Product binaries are available at !__BinDir! exit /b 0 +REM ========================================================================================= +REM === These two routines are intended for the exit code to propagate to the parent process +REM === Like MSBuild or Powershell. If we directly goto ExitWithError from within a if statement in +REM === any of the routines, the exit code is not propagated due to quirks of nested conditonals +REM === in delayed expansion scripts. +REM ========================================================================================= +:ExitWithError +exit /b 1 + +:ExitWithCode +exit /b !__exitCode! + REM ========================================================================================= REM === REM === Helper routines @@ -333,4 +345,4 @@ echo.-? -h -help --help: view this message. echo -architecture echo -configuration echo -verbosity -exit /b 1 +goto ExitWithError diff --git a/eng/common-variables.yml b/eng/common-variables.yml deleted file mode 100644 index c98bd86fee..0000000000 --- a/eng/common-variables.yml +++ /dev/null @@ -1,32 +0,0 @@ - -variables: - - name: _TeamName - value: DotNetCore - - name: _DotNetArtifactsCategory - value: .NETCore - - name: _InternalBuildArgs - value: '' - - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - name: _SignType - value: real - - name: _PublishBlobFeedUrl - value: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json - # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1 - # DotNet-Diagnostics-SDL-Params provides Tsa* variables for SDL checks. - # DotNet-Symbol-Server-Pats provides: provides microsoft-symbol-server-pat and symweb-symbol-server-pat - # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT - - group: DotNet-Blob-Feed - - group: DotNet-Diagnostics-SDL-Params - - group: DotNet-Symbol-Server-Pats - - group: Publish-Build-Assets - - name: _InternalBuildArgs - value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) - /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) - /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) - /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl) - /p:DotNetPublishToBlobFeed=$(PublishPackages) - /p:DotNetPublishUsingPipelines=$(PublishPackages) - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:OfficialBuildId=$(BUILD.BUILDNUMBER) \ No newline at end of file diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 1d48a1ff57..ffe4d76752 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,10 +1,20 @@ + + + + $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) + + + + - + diff --git a/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj b/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj index 49aedc5efb..1ae1f70ac3 100644 --- a/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj +++ b/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj @@ -10,7 +10,7 @@ $(Description) true true - true + false diff --git a/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj b/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj index 7e530dc181..b9fb1b55e0 100644 --- a/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj +++ b/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj @@ -10,6 +10,6 @@ $(Description) true true - true + true diff --git a/src/Microsoft.Diagnostics.Repl/Microsoft.Diagnostics.Repl.csproj b/src/Microsoft.Diagnostics.Repl/Microsoft.Diagnostics.Repl.csproj index e89e6cc018..bed51100c8 100644 --- a/src/Microsoft.Diagnostics.Repl/Microsoft.Diagnostics.Repl.csproj +++ b/src/Microsoft.Diagnostics.Repl/Microsoft.Diagnostics.Repl.csproj @@ -10,7 +10,7 @@ $(Description) true true - true + false diff --git a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj index bea8108428..5d265b47fa 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj +++ b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj @@ -9,7 +9,7 @@ $(Description) tests true - true + false diff --git a/src/SOS/SOS.NETCore/SOS.NETCore.csproj b/src/SOS/SOS.NETCore/SOS.NETCore.csproj index d4487ca8a5..90f326bd72 100644 --- a/src/SOS/SOS.NETCore/SOS.NETCore.csproj +++ b/src/SOS/SOS.NETCore/SOS.NETCore.csproj @@ -3,10 +3,11 @@ netstandard2.0 SOS.NETCore + true true ;1591;1701 .NET Core SOS - true + false diff --git a/src/SOS/SOS.Package/SOS.Package.csproj b/src/SOS/SOS.Package/SOS.Package.csproj index d429cbbbe7..cf28fc298a 100644 --- a/src/SOS/SOS.Package/SOS.Package.csproj +++ b/src/SOS/SOS.Package/SOS.Package.csproj @@ -12,6 +12,7 @@ tools $(ArtifactsPackagesDir)\GalleryManifest.xml GenerateGalleryZip;GenerateSymbolsZip + false diff --git a/src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt b/src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt index 3ee2b5eded..e708ee7f3e 100644 --- a/src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt +++ b/src/SOS/SOS.UnitTests/ConfigFiles/Windows/Debugger.Tests.Config.txt @@ -118,7 +118,7 @@ diff --git a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj index 5443f467eb..1474a15f87 100644 --- a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj +++ b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj @@ -8,6 +8,7 @@ false ;1591;1701 $(DefineConstants);CORE_CLR + true diff --git a/src/Tools/Directory.Build.props b/src/Tools/Directory.Build.props index 6ca593a9f2..0ddd89abc2 100644 --- a/src/Tools/Directory.Build.props +++ b/src/Tools/Directory.Build.props @@ -9,5 +9,6 @@ win-x64;win-x86;win-arm;osx-x64 $(OutputPath) false + true diff --git a/src/Tools/dotnet-dump/dotnet-dump.csproj b/src/Tools/dotnet-dump/dotnet-dump.csproj index 831bca3e4a..d8e22ed8cb 100644 --- a/src/Tools/dotnet-dump/dotnet-dump.csproj +++ b/src/Tools/dotnet-dump/dotnet-dump.csproj @@ -8,6 +8,7 @@ Microsoft.Diagnostic.Tools.Dump Diagnostic dump collect and analyze tool Diagnostic + true $(Description) tools/$(TargetFramework)/any