Get source-build working in main (#15315)

This commit is contained in:
Michael Simons 2023-01-20 10:42:16 -06:00 committed by GitHub
parent 4e9a08ecf3
commit 4ff5179103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 47 deletions

View file

@ -369,18 +369,15 @@ stages:
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
# TODO: Disable source-build builds in PR validation until source-build is more sustainable
# Tracking issue: https://github.com/dotnet/source-build/issues/3214
#
# In case the VMR Build stage needs to be temporarily disabled, please make sure that
# the VMR synchronization step is run to validate that the PR can be merged and later
# synchronized into the VMR without problems.
# You can do this by allowing the Synchronize_VMR stage from above in PRs.
# - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
# - template: eng/pipelines/templates/stages/vmr-build.yml
# parameters:
# vmrBranch: ${{ parameters.vmrBranch }}
# isBuiltFromVmr: false
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: eng/pipelines/templates/stages/vmr-build.yml
parameters:
vmrBranch: ${{ parameters.vmrBranch }}
isBuiltFromVmr: false
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- stage: Publish

View file

@ -24,6 +24,6 @@
or minor release, prebuilts may be needed. When the release is mature, prebuilts are not
necessary, and this property is removed from the file.
-->
<PrivateSourceBuiltArtifactsPackageVersion>7.0.100.2</PrivateSourceBuiltArtifactsPackageVersion>
<PrivateSourceBuiltArtifactsPackageVersion>0.1.0-8.0.100-2</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
</Project>

View file

@ -15,6 +15,7 @@
<RepoConsoleLogFile>$(LoggingDir)$(RepositoryName).log</RepoConsoleLogFile>
<RedirectRepoOutputToLog Condition="'$(MinimalConsoleLogOutput)' == 'true'">&gt;&gt; $(RepoConsoleLogFile) 2&gt;&amp;1</RedirectRepoOutputToLog>
<IsStable Condition="'$(UseStableVersions)' == 'true'">true</IsStable>
<NetCurrent>net8.0</NetCurrent>
<PackagesOutput>$(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/</PackagesOutput>
@ -68,7 +69,7 @@
<EnvironmentVariables Include="_InitializeDotNetCli=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="_DotNetInstallDir=$(DotNetCliToolDir)" />
<EnvironmentVariables Include="_InitializeToolset=$(SourceBuiltSdksDir)Microsoft.DotNet.Arcade.Sdk/tools/Build.proj" Condition="'$(UseBootstrapArcade)' != 'true'" />
<EnvironmentVariables Include="_OverrideArcadeInitializeBuildToolFramework=net7.0" />
<EnvironmentVariables Include="_OverrideArcadeInitializeBuildToolFramework=$(NetCurrent)" />
<EnvironmentVariables Include="DotNetUseShippingVersions=true" />

View file

@ -107,45 +107,16 @@
Condition="'$(EngCommonToolsShFile)' != ''"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(RepoCompletedSemaphorePath)UpdateBuildToolFramework.complete" >
<!-- Use a relative find in NewText to avoid regex matches with parent directories.
See https://github.com/dotnet/source-build/issues/1914 for details. -->
<PropertyGroup>
<ArcadeSdkReplacementText>
logger_path=&quot;%24toolset_dir&quot;/%24%28cd &quot;$toolset_dir&quot; &amp;&amp; find . -name Microsoft.DotNet.Arcade.Sdk.dll \( -regex &apos;.*netcoreapp2.1.*&apos; -or -regex &apos;.*net7.0.*&apos; \) )
</ArcadeSdkReplacementText>
<ArcadeLoggingReplacementText>
logger_path=&quot;%24toolset_dir&quot;/%24%28cd &quot;$toolset_dir&quot; &amp;&amp; find . -name Microsoft.DotNet.ArcadeLogging.dll \( -regex &apos;.*netcoreapp2.1.*&apos; -or -regex &apos;.*net7.0.*&apos; \) )
</ArcadeLoggingReplacementText>
<LoggerPathReplacementText>
$(ArcadeLoggingReplacementText)
if [[ ! -f $logger_path ]]; then
$(ArcadeSdkReplacementText)
fi
</LoggerPathReplacementText>
</PropertyGroup>
<!-- Arcade has added a new ArcadeLogging library (see: https://github.com/dotnet/arcade/pull/6739)
This adds additional scenarios when modifying tools.sh to search for the logger_path. Source-build
builds arcade after the change, so the logger is no longer found in Microsoft.DotNet.Arcade.Sdk,
rather, it has moved to Microsoft.DotNet.ArcadeLogging.
The scenarios are: -->
<!-- 1. Repo has old tools.sh - replace with new search for logger_path from updated tools.sh which looks for ArcadeLogging first,
but make the source-build search changes to find the right dll. -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="local logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll&quot;"
NewText="$(LoggerPathReplacementText)" />
<!-- 2. Repo has updated tools.sh, replace 2 logger_path statements with source-build search equivalents to find the right dll -->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="local logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll&quot;"
NewText="$(ArcadeLoggingReplacementText)" />
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="logger_path=&quot;$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll&quot;"
NewText="$(ArcadeSdkReplacementText)" />
<!-- 3. Repo has 3rd generation of tools.sh. In this case, we set an override for _InitializeBuildToolFramework -->
<!-- Update the BuildToolFramework for repos that have not adopted the current version of Arcade-->
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="_InitializeBuildToolFramework=&quot;netcoreapp3.1&quot;"
NewText="_InitializeBuildToolFramework=&quot;%24{_OverrideArcadeInitializeBuildToolFramework-netcoreapp3.1}&quot;" />
NewText="_InitializeBuildToolFramework=&quot;$(NetCurrent)&quot;"
Condition="'$(UseBootstrapArcade)' != 'true'" />
<ReplaceTextInFile InputFile="$(EngCommonToolsShFile)"
OldText="_InitializeBuildToolFramework=&quot;net7.0&quot;"
NewText="_InitializeBuildToolFramework=&quot;$(NetCurrent)&quot;"
Condition="'$(UseBootstrapArcade)' != 'true'" />
<!-- Temporary workaround for when the ci option is specified, non-zero exit are swallowed which prevents builds from failing within
the build process. https://github.com/dotnet/source-build/issues/2307 -->

View file

@ -55,7 +55,7 @@ index a467fb579..acd5db8bc 100644
- <MicrosoftCodeAnalysisExecutableVersion Condition="'$(MicrosoftCodeAnalysisExecutableVersion)' == ''">3.8.0</MicrosoftCodeAnalysisExecutableVersion>
- </PropertyGroup>
<PropertyGroup>
<VersionPrefix>3.3.4</VersionPrefix>
<VersionPrefix>3.3.5</VersionPrefix>
<PreReleaseVersionLabel>beta1</PreReleaseVersionLabel>
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index c7c28fd9f..e5be9e028 100644