From: Juan Hoyos Date: Tue, 10 Mar 2020 18:36:16 +0000 (-0700) Subject: Fix several issues in build and publishing (#889) X-Git-Tag: submit/tizen_5.5/20200504.045052~11^2^2~75 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5125e47125d59e6474ff3af455b443843930d16;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git 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. --- diff --git a/diagnostics.yml b/diagnostics.yml index deb3d84a4..8fe76a879 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 8ab393194..338999156 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 c98bd86fe..000000000 --- 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 1d48a1ff5..ffe4d7675 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 49aedc5ef..1ae1f70ac 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 7e530dc18..b9fb1b55e 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 e89e6cc01..bed51100c 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 bea810842..5d265b47f 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 d4487ca8a..90f326bd7 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 d429cbbbe..cf28fc298 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 3ee2b5ede..e708ee7f3 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 5443f467e..1474a15f8 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 6ca593a9f..0ddd89abc 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 831bca3e4..d8e22ed8c 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