Skip to content

Commit

Permalink
Fix several issues in build and publishing (#889)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
hoyosjs authored Mar 10, 2020
1 parent ee8ed80 commit a5125e4
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 52 deletions.
18 changes: 16 additions & 2 deletions diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
32 changes: 22 additions & 10 deletions eng/Build-Native.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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%"
Expand Down Expand Up @@ -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 =========================================================================================
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -250,15 +250,15 @@ if %__Build% EQU 1 (

if not defined VSINSTALLDIR (
echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined.
exit /b 1
goto ExitWithError
)

echo Generating Version Header
set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
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

Expand All @@ -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"

Expand All @@ -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
Expand All @@ -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
Expand All @@ -333,4 +345,4 @@ echo.-? -h -help --help: view this message.
echo -architecture <x64|x86|arm|arm64>
echo -configuration <debug|release>
echo -verbosity <q[uiet]|m[inimal]|n[ormal]|d[etailed]|diag[nostic]>
exit /b 1
goto ExitWithError
32 changes: 0 additions & 32 deletions eng/common-variables.yml

This file was deleted.

14 changes: 12 additions & 2 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<!-- Work around https://github.com/dotnet/sourcelink/issues/572
Remove once we build using an SDK that contains https://github.com/dotnet/sdk/pull/10613 -->
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>

<!-- Remove this once arcade version is bumped -->
<!-- We need this for the binplacing for testing assets.
This should be removed at some point as it's brittle (harcodes versions and creates native-managed coupling). -->
<Target Name="_PublishPackageReferences"
AfterTargets="PostBuildEvent"
Condition="$(IsPublishable) == 'true'"
Condition="$(NeedsPublishing) == 'true'"
DependsOnTargets="$(_BeforePublishNoBuildTargets);$(_CorePublishTargets)" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<IsShippingAssembly>true</IsShippingAssembly>
<IsShippingPackage>false</IsShippingPackage>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<IsShippingAssembly>true</IsShippingAssembly>
<IsShipping>true</IsShipping>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<IsShippingAssembly>true</IsShippingAssembly>
<IsShippingPackage>false</IsShippingPackage>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<PackageTags>tests</PackageTags>
<IncludeSymbols>true</IncludeSymbols>
<IsShippingAssembly>true</IsShippingAssembly>
<IsShipping>false</IsShipping>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/SOS/SOS.NETCore/SOS.NETCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>SOS.NETCore</AssemblyName>
<NeedsPublishing>true</NeedsPublishing>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>;1591;1701</NoWarn>
<Description>.NET Core SOS</Description>
<IsShippingAssembly>true</IsShippingAssembly>
<IsShippingPackage>false</IsShippingPackage>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/SOS/SOS.Package/SOS.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<SOSPackagePathPrefix>tools</SOSPackagePathPrefix>
<GalleryManifestName>$(ArtifactsPackagesDir)\GalleryManifest.xml</GalleryManifestName>
<BeforePack>GenerateGalleryZip;GenerateSymbolsZip</BeforePack>
<IsShippingPackage>false</IsShippingPackage>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<Option>
<TestName>SOS.DualRuntimes</TestName>
<!-- The assembly path, class and function name of the desktop test code to load/run -->
<DesktopTestParameters>$(RootBinDir)\bin\SymbolTestDll\$(TargetConfiguration)\$(DesktopFramework)\publish\SymbolTestDll.dll SymbolTestDll.TestClass ThrowException</DesktopTestParameters>
<DesktopTestParameters>$(RootBinDir)\bin\SymbolTestDll\$(TargetConfiguration)\$(DesktopFramework)\SymbolTestDll.dll SymbolTestDll.TestClass ThrowException</DesktopTestParameters>
</Option>
</Options>
<Options>
Expand Down
1 change: 1 addition & 0 deletions src/SOS/SOS.UnitTests/SOS.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IsPackable>false</IsPackable>
<NoWarn>;1591;1701</NoWarn>
<DefineConstants>$(DefineConstants);CORE_CLR</DefineConstants>
<NeedsPublishing>true</NeedsPublishing>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Tools/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;win-arm;osx-x64</PackAsToolShimRuntimeIdentifiers>
<PackagedShimOutputRootDirectory>$(OutputPath)</PackagedShimOutputRootDirectory>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsShipping>true</IsShipping>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/Tools/dotnet-dump/dotnet-dump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<RootNamespace>Microsoft.Diagnostic.Tools.Dump</RootNamespace>
<Description>Diagnostic dump collect and analyze tool</Description>
<PackageTags>Diagnostic</PackageTags>
<NeedsPublishing>true</NeedsPublishing>
<PackageReleaseNotes>$(Description)</PackageReleaseNotes>
<SOSPackagePathPrefix>tools/$(TargetFramework)/any</SOSPackagePathPrefix>
</PropertyGroup>
Expand Down

0 comments on commit a5125e4

Please sign in to comment.