Fix repo builds not getting propagated when using the minimal console log (#18501)
Noticed in https://github.com/dotnet/installer/pull/18409 that errors aren't propagated which resulted in builds not to fail.
The fix here is to use `OnError` in the correct target (but only when using the minimal console log feature) and not set `IgnoreStandardErrorWarningFormat=true` on the Exec task that invokes the repo build script.
I also cleaned targets up as those introduced unnecessary complexity and logged in cases when they shouldn't (i.e. in dotnet.proj or package-source-build.proj).
This affected runtime which errors after 30s of building because of RuntimeOS and BaseOS being passed in in-correctly. Regressed with cca2b7bede (diff-86602308e6bb519266bc2f224ea65e39589d273804d40ad0f9c6e0eea2a263dc)
. Fixed that in runtime.proj. Kudos to Alexander who made the fix. I just copied it in form his CI PR.
This commit is contained in:
parent
db6f1a6e17
commit
d693228ff8
5 changed files with 39 additions and 38 deletions
|
@ -57,7 +57,6 @@
|
|||
|
||||
<!-- Update NuGet feeds in the repo -->
|
||||
<Target Name="UpdateNuGetConfig"
|
||||
BeforeTargets="Build"
|
||||
Condition="'$(NuGetConfigFile)' != '' or '@(NuGetConfigFiles)' != ''"
|
||||
Inputs="$(MSBuildProjectFullPath)"
|
||||
Outputs="$(BaseIntermediateOutputPath)UpdateNuGetConfig.complete">
|
||||
|
@ -146,7 +145,6 @@
|
|||
<!-- Update the SDK version in the repo's global.json file.
|
||||
This guarantees that all repositories build with the VMR's SDK version. -->
|
||||
<Target Name="UpdateGlobalJsonVersions"
|
||||
BeforeTargets="Build"
|
||||
Condition="'$(GlobalJsonFile)' != ''"
|
||||
Inputs="$(MSBuildProjectFullPath);$(MSBuildThisFileFullPath)"
|
||||
Outputs="$(BaseIntermediateOutputPath)UpdateGlobalJsonVersions.complete">
|
||||
|
@ -173,8 +171,7 @@
|
|||
|
||||
<!-- TODO: Remove when all repos use a consistent set of eng/common files: https://github.com/dotnet/source-build/issues/3710. -->
|
||||
<Target Name="UpdateEngCommonFiles"
|
||||
Condition="'$(UpdateEngCommonFiles)' == 'true' or '$(DotNetBuildSourceOnly)' != 'true'"
|
||||
BeforeTargets="Build">
|
||||
Condition="'$(UpdateEngCommonFiles)' == 'true' or '$(DotNetBuildSourceOnly)' != 'true'">
|
||||
<ItemGroup>
|
||||
<OrchestratorEngCommonFile Include="$(RepositoryEngineeringDir)common\**\*" />
|
||||
</ItemGroup>
|
||||
|
@ -187,7 +184,6 @@
|
|||
<!-- Before a repository builds, set up the version property files that override the repo's defaults.
|
||||
There are 3 files generated -->
|
||||
<Target Name="CreateBuildInputProps"
|
||||
BeforeTargets="Build"
|
||||
Inputs="$(MSBuildProjectFullPath)"
|
||||
Outputs="$(BaseIntermediateOutputPath)CreateBuildInputProps.complete">
|
||||
<ItemGroup>
|
||||
|
@ -268,31 +264,25 @@
|
|||
StopOnFirstFailure="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Build"
|
||||
DependsOnTargets="BuildRepoReferences"
|
||||
<Target Name="RepoBuild"
|
||||
Inputs="$(MSBuildProjectFullPath)"
|
||||
Outputs="$(BaseIntermediateOutputPath)Build.complete">
|
||||
Outputs="$(BaseIntermediateOutputPath)Build.complete"
|
||||
Condition="'$(BuildCommand)' != ''"
|
||||
DependsOnTargets="BuildRepoReferences;
|
||||
UpdateNuGetConfig;
|
||||
UpdateGlobalJsonVersions;
|
||||
CreateBuildInputProps;
|
||||
UpdateEngCommonFiles;
|
||||
SetSourceBuiltSdkOverrides">
|
||||
<Exec Command="$(DotnetTool) build-server shutdown" />
|
||||
|
||||
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(RepositoryName)" />
|
||||
<Message Importance="High" Text="Running command:" Condition="'$(BuildCommand)' != ''" />
|
||||
<Message Importance="High" Text=" $(BuildCommand)" Condition="'$(BuildCommand)' != ''" />
|
||||
<Message Importance="High" Text=" Log: $(RepoConsoleLogFile)" Condition="'$(BuildCommand)' != '' and '$(MinimalConsoleLogOutput)' == 'true'" />
|
||||
<Message Importance="High" Text=" With Environment Variables:" Condition="'$(BuildCommand)' != ''" />
|
||||
<Message Importance="High" Text=" %(EnvironmentVariables.Identity)" Condition="'$(BuildCommand)' != ''" />
|
||||
<CallTarget Targets="RepoBuild" />
|
||||
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(RepositoryName)...done" />
|
||||
<Message Importance="High" Text="Running command:" />
|
||||
<Message Importance="High" Text=" $(BuildCommand)" />
|
||||
<Message Importance="High" Text=" Log: $(RepoConsoleLogFile)" Condition="'$(MinimalConsoleLogOutput)' == 'true'" />
|
||||
<Message Importance="High" Text=" With Environment Variables:"/>
|
||||
<Message Importance="High" Text=" %(EnvironmentVariables.Identity)" />
|
||||
|
||||
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
|
||||
<Touch Files="$(BaseIntermediateOutputPath)Build.complete" AlwaysCreate="true">
|
||||
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
|
||||
</Touch>
|
||||
|
||||
<OnError ExecuteTargets="ReportRepoError" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RepoBuild"
|
||||
Condition="'$(BuildCommand)' != ''">
|
||||
<Message Text="DirSize Before Building $(RepositoryName)" Importance="High"
|
||||
Condition=" '$(CleanWhileBuilding)' == 'true' and '$(BuildOS)' != 'windows'" />
|
||||
<Exec Command="df -h $(RepoRoot)"
|
||||
|
@ -315,16 +305,27 @@
|
|||
|
||||
<Exec Command="$(FullCommand)"
|
||||
WorkingDirectory="$(ProjectDirectory)"
|
||||
EnvironmentVariables="@(EnvironmentVariables)"
|
||||
IgnoreStandardErrorWarningFormat="true" />
|
||||
EnvironmentVariables="@(EnvironmentVariables)" />
|
||||
|
||||
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Building $(RepositoryName)...done" />
|
||||
|
||||
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
|
||||
<Touch Files="$(BaseIntermediateOutputPath)Build.complete" AlwaysCreate="true">
|
||||
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
|
||||
</Touch>
|
||||
|
||||
<!-- Propagate errors to the output when using the minimal console log feature. -->
|
||||
<OnError ExecuteTargets="LogRepoBuildError" Condition="'$(MinimalConsoleLogOutput)' == 'true'" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ReportRepoError">
|
||||
<Target Name="LogRepoBuildError">
|
||||
<Message Importance="High" Text="$([System.IO.File]::ReadAllText('$(RepoConsoleLogFile)'))" Condition="Exists('$(RepoConsoleLogFile)') and '$(MinimalConsoleLogOutput)' == 'true'" />
|
||||
<Message Importance="High" Text="'$(RepositoryName)' failed during build." />
|
||||
<Message Importance="High" Text="See '$(RepoConsoleLogFile)' for more information." Condition="Exists('$(RepoConsoleLogFile)') and '$(MinimalConsoleLogOutput)' == 'true'" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Build" DependsOnTargets="BuildRepoReferences;RepoBuild" />
|
||||
|
||||
<Target Name="Package" AfterTargets="Build" />
|
||||
|
||||
<Target Name="GatherBuiltPackages">
|
||||
|
@ -643,7 +644,6 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="SetSourceBuiltSdkOverrides"
|
||||
BeforeTargets="Build"
|
||||
Condition="'@(SourceBuiltSdkOverride)' != ''">
|
||||
<ItemGroup>
|
||||
<EnvironmentVariables Include="SOURCE_BUILT_SDK_ID_%(SourceBuiltSdkOverride.Group)=%(SourceBuiltSdkOverride.Identity)" />
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<Target Name="CustomRepoBuild"
|
||||
AfterTargets="RepoBuild"
|
||||
DependsOnTargets="DetermineSourceBuiltSdkVersion">
|
||||
DependsOnTargets="CreateBuildInputProps;DetermineSourceBuiltSdkVersion">
|
||||
<!-- Copy PVP to packages dir in order to package them together -->
|
||||
<Copy SourceFiles="$(CurrentSourceBuiltPackageVersionPropsPath)" DestinationFiles="$(SourceBuiltPackagesPath)PackageVersions.props" />
|
||||
|
||||
|
|
|
@ -3,14 +3,20 @@
|
|||
<PropertyGroup>
|
||||
<LogVerbosityOptOut>true</LogVerbosityOptOut>
|
||||
|
||||
<_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
|
||||
<RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
|
||||
|
||||
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
|
||||
<BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))-$(TargetArchitecture)</BaseOS>
|
||||
|
||||
<!-- Use the repo root build script -->
|
||||
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
|
||||
|
||||
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)arch $(TargetArchitecture)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)os $(TargetOS)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:TargetRid=$(TargetRid)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:RuntimeOS=$(TargetOS)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:BaseOS=$(PortableRid)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:RuntimeOS=$(RuntimeOS)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:BaseOS=$(BaseOS)</BuildArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
<PropertyGroup>
|
||||
<LogVerbosityOptOut>true</LogVerbosityOptOut>
|
||||
|
||||
<!-- Propagate RID set in source-build to sdk repo -->
|
||||
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
|
||||
<_baseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</_baseOS>
|
||||
<_baseOS Condition="'$(PortableBuild)' == 'true'">$(TargetOS)</_baseOS>
|
||||
|
||||
<BuildArgs>$(BuildArgs) /p:PackageProjectUrl=https://github.com/dotnet/sdk</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:PortableRid=$(PortableRid)</BuildArgs>
|
||||
<BuildArgs>$(BuildArgs) /p:TargetRid=$(TargetRid)</BuildArgs>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<Target Name="AddLocalNuGetPackageCacheDirectory"
|
||||
BeforeTargets="Build">
|
||||
BeforeTargets="UpdateNuGetConfig">
|
||||
<MakeDir Condition="'$(LocalNuGetPackageCacheDirectory)' != ''"
|
||||
Directories="$(LocalNuGetPackageCacheDirectory)" />
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue