Disable inner-clone in product source-build (#18153)

This commit is contained in:
Nikola Milosavljevic 2024-01-16 19:40:26 -08:00 committed by GitHub
parent 258c6123a9
commit f708a59e1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 417 additions and 35 deletions

View file

@ -2,17 +2,24 @@
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(SkipArcadeSdkImport)' != 'true'" />
<Target Name="DetermineMicrosoftSourceBuildIntermediateInstallerVersion"
Condition="'$(DotNetBuildFromSource)' == 'true'">
<!-- Manually load the installer version from the PVP. -->
<XmlPeek XmlInputPath="$(SharedIntermediateOutputPath)PackageVersions.package-source-build.Current.props"
Query="msb:Project/msb:PropertyGroup/msb:MicrosoftSourceBuildIntermediateInstallerVersion/text()"
Namespaces="&lt;Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/&gt;">
<Output TaskParameter="Result" ItemName="MicrosoftSourceBuildIntermediateInstallerVersionItem" />
</XmlPeek>
<Target Name="DetermineSourceBuiltSdkVersion">
<PropertyGroup>
<MicrosoftSourceBuildIntermediateInstallerVersion>@(MicrosoftSourceBuildIntermediateInstallerVersionItem)</MicrosoftSourceBuildIntermediateInstallerVersion>
<MicrosoftSourceBuildIntermediateInstallerVersion Condition="'$(MicrosoftSourceBuildIntermediateInstallerVersion)' == ''">$(installerOutputPackageVersion)</MicrosoftSourceBuildIntermediateInstallerVersion>
<SdkFilenamePrefix>dotnet-sdk-</SdkFilenamePrefix>
</PropertyGroup>
<ItemGroup>
<SdkTarballItem Include="$(SourceBuiltAssetsDir)$(SdkFilenamePrefix)*$(ArchiveExtension)" />
</ItemGroup>
<!--
Extract SDK version from SDK tarball filename.
Example:
dotnet-sdk-9.0.100-alpha.1.24057.1-fedora.38-x64.tar.gz
dotnet-sdk-<SdkVersion>-<TargetRid><ArchiveExtension>
-->
<PropertyGroup>
<SdkFilename>%(SdkTarballItem.Filename)%(SdkTarballItem.Extension)</SdkFilename>
<SourceBuiltSdkVersion>$(SdkFilename.Replace('$(SdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)',''))</SourceBuiltSdkVersion>
</PropertyGroup>
</Target>

View file

@ -60,11 +60,11 @@
<Target Name="RepackageSymbols"
AfterTargets="Build"
DependsOnTargets="
DetermineMicrosoftSourceBuildIntermediateInstallerVersion;
DetermineSourceBuiltSdkVersion;
DiscoverSymbolsTarballs;
ExtractSymbolsTarballs">
<PropertyGroup>
<UnifiedSymbolsTarball>$(SharedOutputPath)dotnet-symbols-all-$(MicrosoftSourceBuildIntermediateInstallerVersion)-$(TargetRid)$(ArchiveExtension)</UnifiedSymbolsTarball>
<UnifiedSymbolsTarball>$(SharedOutputPath)dotnet-symbols-all-$(SourceBuiltSdkVersion)-$(TargetRid)$(ArchiveExtension)</UnifiedSymbolsTarball>
</PropertyGroup>
<Exec Command="tar --numeric-owner -czf $(UnifiedSymbolsTarball) *"
@ -84,7 +84,7 @@
<PropertyGroup>
<SdkSymbolsLayout>$(ArtifactsTmpDir)SdkSymbols</SdkSymbolsLayout>
<SdkSymbolsTarball>$(SharedOutputPath)dotnet-symbols-sdk-$(MicrosoftSourceBuildIntermediateInstallerVersion)-$(TargetRid)$(ArchiveExtension)</SdkSymbolsTarball>
<SdkSymbolsTarball>$(SharedOutputPath)dotnet-symbols-sdk-$(SourceBuiltSdkVersion)-$(TargetRid)$(ArchiveExtension)</SdkSymbolsTarball>
<SdkLayout>$(ArtifactsTmpDir)Sdk</SdkLayout>
<SdkTarball>%(SdkTarballItem.Identity)</SdkTarball>
</PropertyGroup>
@ -214,10 +214,10 @@
</Target>
<Target Name="CreateSmokeTestPrereqsTarballIfPrereqsExist"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion"
DependsOnTargets="DetermineSourceBuiltSdkVersion"
Condition="'@(SmokeTestsPrereqs->Count())' != '0'">
<PropertyGroup>
<SmokeTestPrereqsTarballName>$(SharedOutputPath)dotnet-smoke-test-prereqs.$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid)$(ArchiveExtension)</SmokeTestPrereqsTarballName>
<SmokeTestPrereqsTarballName>$(SharedOutputPath)dotnet-smoke-test-prereqs.$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SmokeTestPrereqsTarballName>
<SmokeTestsPrereqPackagesDir>$(SmokeTestsArtifactsDir)prereq-packages/</SmokeTestsPrereqPackagesDir>
</PropertyGroup>
@ -247,10 +247,10 @@
</Target>
<Target Name="CreatePrebuiltsTarballIfPrebuiltsExist"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion"
DependsOnTargets="DetermineSourceBuiltSdkVersion"
Condition="'@(PrebuiltFile->Count())' != '0'">
<PropertyGroup>
<TarballFilePath>$(SharedOutputPath)$(SourceBuiltPrebuiltsTarballName).$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid)$(ArchiveExtension)</TarballFilePath>
<TarballFilePath>$(SharedOutputPath)$(SourceBuiltPrebuiltsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</TarballFilePath>
<TarballWorkingDir>$(ResultingPrebuiltPackagesDir)</TarballWorkingDir>
</PropertyGroup>

View file

@ -16,6 +16,7 @@
<PackageReportDataFile>$(PackageReportDir)prebuilt-usage.xml</PackageReportDataFile>
<ProjectAssetsJsonArchiveFile>$(PackageReportDir)all-project-assets-json-files.zip</ProjectAssetsJsonArchiveFile>
<ProdConManifestFile>$(PackageReportDir)prodcon-build.xml</ProdConManifestFile>
<RepoManifestFile>$([MSBuild]::NormalizePath('$(ProjectDirectory)', 'artifacts', 'RepoManifest.xml'))</RepoManifestFile>
</PropertyGroup>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddSourceToNuGetConfig" />
@ -286,6 +287,76 @@
</ItemGroup>
</Target>
<!--
Condition should be removed after source-build picks up version of Arcade that has
source-build infra changes for removal od inner-clone in VMR build. Until then some
repos will produce intermediate packages instead of repo manifest file.
https://github.com/dotnet/source-build/issues/3930
-->
<Target Name="CopyRepoArtifacts"
AfterTargets="Package"
Condition="Exists($(RepoManifestFile))"
Inputs="$(RepoManifestFile)"
Outputs="$(BaseIntermediateOutputPath)ArtifactsCopy.complete">
<XmlPeek XmlInputPath="$(RepoManifestFile)"
Query="Build/Artifact/@Path">
<Output TaskParameter="Result" ItemName="RepoManifestArtifact" />
</XmlPeek>
<ItemGroup>
<RepoManifestAsset Include="@(RepoManifestArtifact)" Condition="'%(Extension)' != '.nupkg'"/>
<RepoManifestPackage Include="@(RepoManifestArtifact)" Condition="'%(Extension)' == '.nupkg'"/>
<RepoManifestNonShippingPackage Include="@(RepoManifestPackage)" Condition="$([System.String]::Copy('%(Identity)').Contains('$([System.IO.Path]::DirectorySeparatorChar)NonShipping$([System.IO.Path]::DirectorySeparatorChar)'))"/>
</ItemGroup>
<PropertyGroup>
<_NupkgsDestination>$(SourceBuiltPackagesPath)</_NupkgsDestination>
<_NupkgsDestination Condition="'$(RepositoryName)' == 'source-build-reference-packages'">$(ReferencePackagesDir)</_NupkgsDestination>
</PropertyGroup>
<!-- Building SBRP: At this point the References directory contains the previously-source-built SBRPs,
clear it before copying the current SBRPs. This ensures n-1 SBRPs aren't required to build the product repos. -->
<RemoveDir
Condition="'$(RepositoryName)' == 'source-build-reference-packages'"
Directories="$(ReferencePackagesDir)" />
<!-- Copy nupkgs -->
<Copy
Condition="'@(RepoManifestPackage)' != ''"
SourceFiles="@(RepoManifestPackage)"
DestinationFolder="$(_NupkgsDestination)" />
<!-- Copy assets -->
<Copy
Condition="'@(RepoManifestAsset)' != ''"
SourceFiles="@(RepoManifestAsset)"
DestinationFolder="$(SourceBuiltAssetsDir)" />
<!-- Generate non-shipping package list -->
<PropertyGroup>
<NonShippingPackagesList Condition="'@(RepoManifestNonShippingPackage)' != ''">$(PackageListsDir)$(NonShippingPackagesListPrefix)$(RepositoryName).lst</NonShippingPackagesList>
</PropertyGroup>
<WriteLinesToFile
Condition="'$(NonShippingPackagesList)' != ''"
File="$(NonShippingPackagesList)"
Lines="@(RepoManifestNonShippingPackage->'%(Filename)%(Extension)')"
Overwrite="true" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)ArtifactsCopy.complete" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<!--
This target can be removed after source-build picks up version of Arcade that has
source-build infra changes for removal od inner-clone in VMR build. Until then the target
is needed for building source-build-reference-packages and arcade repos.
https://github.com/dotnet/source-build/issues/3930
-->
<Target Name="ExtractIntermediatePackages"
AfterTargets="Package"
Inputs="$(MSBuildProjectFullPath)"

View file

@ -13,45 +13,32 @@
<Target Name="CustomRepoBuild"
AfterTargets="RepoBuild"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion">
DependsOnTargets="DetermineSourceBuiltSdkVersion">
<!-- Copy PVP to packages dir in order to package them together -->
<Copy SourceFiles="$(CurrentSourceBuiltPackageVersionPropsPath)" DestinationFiles="$(SourceBuiltPackagesPath)PackageVersions.props" />
<!-- Expand SBRP intermediate package into separate folder and remove intermediate package -->
<PropertyGroup>
<SourceBuildReferencePackagesDestination>$(SourceBuiltPackagesPath)SourceBuildReferencePackages/</SourceBuildReferencePackagesDestination>
<SBRPIntermediateWildcard>Microsoft.SourceBuild.Intermediate.source-build-reference-packages*.nupkg</SBRPIntermediateWildcard>
</PropertyGroup>
<ItemGroup>
<SourceBuildReferencePackagesIntermediatePackage Include="$(SourceBuiltPackagesPath)$(SBRPIntermediateWildcard)"/>
</ItemGroup>
<Unzip SourceFiles="@(SourceBuildReferencePackagesIntermediatePackage)"
DestinationFolder="$(SourceBuildReferencePackagesDestination)extractArtifacts"
SkipUnchangedFiles="true"
Condition="'@(SourceBuildReferencePackagesIntermediatePackage)' != ''" />
<ItemGroup>
<SourceBuildReferencePackagesNupkgFiles Include="$(SourceBuildReferencePackagesDestination)extractArtifacts/**/*.nupkg" />
<SourceBuildReferencePackagesNupkgFiles Include="$(ReferencePackagesDir)**/*.nupkg" />
</ItemGroup>
<!-- Copy reference packages from ReferencePackagesDir to blob-feed reference packages path. -->
<Copy
Condition="'@(SourceBuildReferencePackagesNupkgFiles)' != ''"
SourceFiles="@(SourceBuildReferencePackagesNupkgFiles)"
DestinationFiles="@(SourceBuildReferencePackagesNupkgFiles -> '$(SourceBuildReferencePackagesDestination)%(Filename)%(Extension)')" />
<RemoveDir
Condition="Exists('$(SourceBuildReferencePackagesDestination)extractArtifacts/')"
Directories="$(SourceBuildReferencePackagesDestination)extractArtifacts/" />
<PropertyGroup>
<SourceBuiltTarballName>$(SharedOutputPath)$(SourceBuiltArtifactsTarballName).$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
<SourceBuiltTarballName>$(SharedOutputPath)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
<SourceBuiltVersionFileName>.version</SourceBuiltVersionFileName>
</PropertyGroup>
<!-- Content of the .version file to include in the tarball -->
<ItemGroup>
<VersionFileContent Include="$(RepositoryCommit);$(MicrosoftSourceBuildIntermediateInstallerVersion)" />
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkVersion)" />
</ItemGroup>
<WriteLinesToFile

View file

@ -1,2 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--
We need to continue to use inner-clone for this repo, as there are hundreds of modified files
after a build, due to numerous patches and modifications we need to do.
Modified files make developer experience worse, as they would need to be manually reverted.
-->
<BuildArgs>$(BuildArgs) /p:UseInnerClone=true</BuildArgs>
</PropertyGroup>
</Project>

View file

@ -1,6 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--
All packages built in SBRP repo are copied to prereqs/package/reference.
Nothing gets copied to blob-feed packages cache.
This would cause an issue with validation in EnsurePackagesCreated target.
We need to skip it for SBRP repo.
-->
<SkipEnsurePackagesCreated>true</SkipEnsurePackagesCreated>
<!-- SBRP builds before Arcade so it also needs the bootstrap Arcade version -->
<UseBootstrapArcade>true</UseBootstrapArcade>

View file

@ -0,0 +1,297 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nikola Milosavljevic <nikolam@microsoft.com>
Date: Tue, 16 Jan 2024 21:26:06 +0000
Subject: [PATCH] Disable inner-clone in product source-build
---
.../tools/SourceBuild/AfterSourceBuild.proj | 34 ++++++++-
.../SourceBuild/SourceBuildArcade.targets | 71 ++++++++++++++++++-
.../SourceBuildArcadeBuild.targets | 5 +-
.../SourceBuild/SourceBuildIntermediate.proj | 56 ++-------------
4 files changed, 111 insertions(+), 55 deletions(-)
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj
index 31f544e6..0b56b22f 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj
@@ -15,7 +15,8 @@
Condition="'$(ArcadeInnerBuildFromSource)' != 'true'"
DependsOnTargets="
ReportPrebuiltUsage;
- PackSourceBuildIntermediateNupkgs" />
+ PackSourceBuildIntermediateNupkgs;
+ CreateRepoManifest" />
<Target Name="WritePrebuiltUsageData">
<ItemGroup>
@@ -26,7 +27,7 @@
<SourceBuiltPackageFiles Include="$(PreviouslySourceBuiltNupkgCacheDir)**/*.nupkg" Condition=" '$(PreviouslySourceBuiltNupkgCacheDir)' != '' " />
<!-- Add some other potential top-level project directories for a more specific report. -->
- <ProjectDirectories Include="$(CurrentRepoSourceBuildSourceDir)" />
+ <ProjectDirectories Include="$(CurrentRepoSourceBuildSourceDir)" Condition="'$(UseInnerClone)' == 'true'" />
<!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. -->
<ProjectDirectories Include="$(SourceBuildOutputDir)" />
</ItemGroup>
@@ -117,11 +118,40 @@
DestinationFiles="$(SourceBuildIntermediateNupkgLicenseFile)" />
</Target>
+ <!--
+ In VMR build we create repo manifest.
+ SB orchestrator will parse the manifest and copy the artifacts to the right locations.
+
+ This can be removed once we enable standard repo assets manifests and SB orchestrator
+ starts using it - https://github.com/dotnet/source-build/issues/3970
+ -->
+ <Target Name="CreateRepoManifest"
+ Condition="'$(DotNetBuildFromSourceFlavor)' == 'Product'"
+ DependsOnTargets="
+ GetCategorizedIntermediateNupkgContents;
+ CreateRepoSymbolsArchive">
+ <PropertyGroup>
+ <RepoManifestFile>$(ArtifactsDir)RepoManifest.xml</RepoManifestFile>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <RepoManifestLine Include='&lt;Build&gt;' />
+ <RepoManifestLine Include='&lt;Artifact Path="%(IntermediateNupkgFile.Identity)" /&gt;' />
+ <RepoManifestLine Include='&lt;/Build&gt;' />
+ </ItemGroup>
+
+ <WriteLinesToFile
+ File="$(RepoManifestFile)"
+ Lines="@(RepoManifestLine)"
+ Overwrite="true" />
+ </Target>
+
<!--
Create source-build intermediate NuGet package and supplemental intermediate NuGet packages (if
necessary) for dependency transport to downstream repos.
-->
<Target Name="PackSourceBuildIntermediateNupkgs"
+ Condition="'$(CreateIntermediatePackage)' == 'true'"
DependsOnTargets="
CopyIntermediateNupkgProjToProjectDirectory;
GetLicenseFileForIntermediateNupkgPack;
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcade.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcade.targets
index 2d1a20d5..5d91b110 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcade.targets
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcade.targets
@@ -18,9 +18,19 @@
<Import Project="$(RepositoryEngineeringDir)SourceBuild.props" Condition="Exists('$(RepositoryEngineeringDir)SourceBuild.props')" />
<PropertyGroup>
+ <!--
+ Do not use inner-clone in full product source-build, unless explicitly requested,
+ i.e. for specific repos, like source-build-externals.
+ -->
+ <UseInnerClone Condition="'$(UseInnerClone)' == '' and '$(DotNetBuildFromSourceFlavor)' != 'Product'">true</UseInnerClone>
+
+ <!-- Do not create intermediate package in full product source-build. -->
+ <CreateIntermediatePackage Condition="'$(DotNetBuildFromSourceFlavor)' != 'Product'">true</CreateIntermediatePackage>
+
<!-- Prefer abbreviations to avoid long paths (breaks on Windows) -->
<SourceBuildOutputDir Condition="'$(SourceBuildOutputDir)' == ''">$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'sb'))</SourceBuildOutputDir>
<CurrentRepoSourceBuildSourceDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildOutputDir)', 'src'))</CurrentRepoSourceBuildSourceDir>
+ <CurrentRepoSourceBuildSourceDir Condition="'$(UseInnerClone)' != 'true'">$(RepoRoot)</CurrentRepoSourceBuildSourceDir>
<CurrentRepoSourceBuildPackageCache>$([MSBuild]::NormalizeDirectory('$(SourceBuildOutputDir)', 'package-cache'))</CurrentRepoSourceBuildPackageCache>
<SourceBuildSelfPrebuiltReportDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildOutputDir)', 'prebuilt-report'))</SourceBuildSelfPrebuiltReportDir>
@@ -28,6 +38,8 @@
Keep artifacts/ inside source dir so that ancestor-based file lookups find the inner repo, not
the outer repo. The inner repo global.json and NuGet.config files may have been modified by
source-build, and we want projects inside the artifacts/ dir to respect that.
+
+ Inner-clone removal - in VMR use regular artifacts dir.
-->
<CurrentRepoSourceBuildArtifactsDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildSourceDir)', 'artifacts'))</CurrentRepoSourceBuildArtifactsDir>
<CurrentRepoSourceBuildArtifactsPackagesDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildArtifactsDir)', 'packages', '$(Configuration)'))</CurrentRepoSourceBuildArtifactsPackagesDir>
@@ -106,8 +118,8 @@
<ItemGroup>
<IntermediateNupkgFile Include="@(IntermediateNupkgArtifactFile)" PackagePath="artifacts" />
- <!-- Report goes into the 'main' intermediate nupkg. -->
- <IntermediateNupkgFile Include="$(SourceBuildSelfPrebuiltReportDir)**\*" PackagePath="prebuilt-report" />
+ <!-- Report goes into the 'main' intermediate nupkg, if we're creating it. -->
+ <IntermediateNupkgFile Condition="'$(CreateIntermediatePackage)' == 'true'" Include="$(SourceBuildSelfPrebuiltReportDir)**\*" PackagePath="prebuilt-report" />
</ItemGroup>
<RemoveDuplicates Inputs="@(IntermediateNupkgFile)">
@@ -118,6 +130,61 @@
<IntermediateNonShippingNupkgFile Include="@(IntermediatePackageFile)" Condition="$([System.Text.RegularExpressions.Regex]::Match(%(Identity),'[\\\\/]NonShipping[\\\\/]').Success)"/>
<SupplementalIntermediateNupkgCategory Include="%(IntermediatePackageFile.Category)" />
</ItemGroup>
+
+ <PropertyGroup>
+ <!-- The prefix needs to match what's defined in tarball source-build infra. Consider using a single property, in the future. -->
+ <NonShippingPackagesListPrefix>NonShipping.Packages.</NonShippingPackagesListPrefix>
+ <NonShippingPackagesList Condition="'@(IntermediateNonShippingNupkgFile)' != ''">$(CurrentRepoSourceBuildArtifactsPackagesDir)$(NonShippingPackagesListPrefix)$(GitHubRepositoryName).lst</NonShippingPackagesList>
+ </PropertyGroup>
+
+ <WriteLinesToFile
+ Condition="'$(NonShippingPackagesList)' != ''"
+ File="$(NonShippingPackagesList)"
+ Lines="@(IntermediateNonShippingNupkgFile->'%(Filename)%(Extension)')"
+ Overwrite="true" />
+ </Target>
+
+ <!--
+ Create symbols archive.
+
+ Conditioning out for Windows as the tar execution below doesn't work cross-plat.
+ -->
+ <Target Name="CreateRepoSymbolsArchive" Condition="'$(OS)' != 'Windows_NT'">
+ <PropertyGroup>
+ <SymbolsRoot>$(CurrentRepoSourceBuildArtifactsDir)</SymbolsRoot>
+ <!-- Fall back to repo root for source-build-externals or repos that don't have the regular SymbolsRoot as defined above -->
+ <SymbolsRoot Condition="!Exists('$(SymbolsRoot)') or '$(GitHubRepositoryName)' == 'source-build-externals'">$(RepoRoot)</SymbolsRoot>
+ <SymbolsArchiveLocation>$(CurrentRepoSourceBuildArtifactsPackagesDir)</SymbolsArchiveLocation>
+ <SymbolsArchiveLocation Condition="'$(GitHubRepositoryName)' == 'nuget-client' and '$(PackageOutputPath)' != ''">$([MSBuild]::EnsureTrailingSlash('$(PackageOutputPath)'))</SymbolsArchiveLocation>
+ <SymbolsList>$([MSBuild]::NormalizePath('$(SymbolsArchiveLocation)', 'symbols.lst'))</SymbolsList>
+ <SymbolsArchivePrefix>Symbols.</SymbolsArchivePrefix>
+ <!-- $(Version) and $(TargetRid) are only available when target is executed as part of intermediate package creation. -->
+ <SymbolsArchiveSuffix Condition="'$(CreateIntermediatePackage)' == 'true'">.$(Version).$(TargetRid)</SymbolsArchiveSuffix>
+ <SymbolsArchiveFile>$(SymbolsArchiveLocation)$(SymbolsArchivePrefix)$(GitHubRepositoryName)$(SymbolsArchiveSuffix)$(ArchiveExtension)</SymbolsArchiveFile>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <AbsoluteSymbolPath Include="$(SymbolsRoot)**\obj\**\*.pdb" />
+ <AbsoluteSymbolPath Condition="'@(AbsoluteSymbolPath)' != ''">
+ <RelativePath>$([MSBuild]::MakeRelative($(SymbolsRoot), %(FullPath)))</RelativePath>
+ </AbsoluteSymbolPath>
+ </ItemGroup>
+
+ <WriteLinesToFile
+ File="$(SymbolsList)"
+ Lines="@(AbsoluteSymbolPath->'%(RelativePath)')"
+ Overwrite="true"
+ Condition="'@(AbsoluteSymbolPath)' != ''" />
+
+ <Exec Command="tar --numeric-owner -czf $(SymbolsArchiveFile) --files-from=$(SymbolsList)"
+ WorkingDirectory="$(SymbolsRoot)" Condition="Exists($(SymbolsList))" />
+ <Message Importance="High" Text="Packaged symbols to $(SymbolsArchiveFile)" Condition="Exists($(SymbolsList))" />
+
+ <ItemGroup>
+ <IntermediateNupkgFile Include="$(SymbolsArchiveFile)" PackagePath="artifacts" Condition="Exists($(SymbolsArchiveFile)) and '$(CreateIntermediatePackage)' != 'true'" />
+ </ItemGroup>
+
+ <Delete Files="$(SymbolsList)" Condition="Exists($(SymbolsList))" />
</Target>
</Project>
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeBuild.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeBuild.targets
index 177a5267..18ab693c 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeBuild.targets
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeBuild.targets
@@ -11,6 +11,7 @@
<CurrentRepoSourceBuildBinlogFile>$([MSBuild]::NormalizePath('$(CurrentRepoSourceBuildArtifactsDir)', 'sourcebuild.binlog'))</CurrentRepoSourceBuildBinlogFile>
<InnerSourceBuildRepoRoot Condition="'$(InnerSourceBuildRepoRoot)' == ''">$(CurrentRepoSourceBuildSourceDir)</InnerSourceBuildRepoRoot>
+ <InnerSourceBuildRepoRoot Condition="'$(UseInnerClone)' != 'true'">$(RepoRoot)</InnerSourceBuildRepoRoot>
<CleanInnerSourceBuildRepoRoot Condition="'$(CleanInnerSourceBuildRepoRoot)' == ''">true</CleanInnerSourceBuildRepoRoot>
@@ -112,7 +113,7 @@
DependsOnTargets="CopyInnerSourceBuildRepoRoot;CloneInnerSourceBuildRepoRoot">
</Target>
- <Target Name="CopyInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' == 'true' ">
+ <Target Name="CopyInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' == 'true' and '$(UseInnerClone)' == 'true' ">
<ItemGroup>
<SourceBuildFilesToCopy Include="$(RepoRoot)/**/*" />
<SourceBuildFilesToCopy Include="$(RepoRoot)/**/.*" />
@@ -132,7 +133,7 @@
access to the git data, this also makes it easy to see what changes the source-build infra has
made, for diagnosis or exploratory purposes.
-->
- <Target Name="CloneInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' != 'true'">
+ <Target Name="CloneInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' != 'true' and '$(UseInnerClone)' == 'true' ">
<PropertyGroup>
<!--
By default, copy WIP. WIP copy helps with local machine dev work. Don't copy WIP if this is
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildIntermediate.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildIntermediate.proj
index 5b20e23c..e120e38d 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildIntermediate.proj
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildIntermediate.proj
@@ -53,6 +53,7 @@
<Target Name="GetIntermediateNupkgArtifactFiles"
DependsOnTargets="
GetCategorizedIntermediateNupkgContents;
+ CreateRepoSymbolsArchive;
GetSupplementalIntermediateNupkgManifest;
GetSymbolsArchive;
GetNonShippingNupkgList"
@@ -81,66 +82,23 @@
</Target>
<!--
- Create symbols archive and include it in the main intermediate nupkg, by default.
+ Include symbols archive in the main intermediate nupkg, by default.
Repos can select a different intermediate nupkg by defining 'SymbolsIntermediateNupkgCategory'
property in eng/SourceBuild.props.
-
- Conditioning out for Windows as the tar execution below doesn't work cross-plat.
-->
<Target Name="GetSymbolsArchive"
- Condition="'$(SupplementalIntermediateNupkgCategory)' == '$(SymbolsIntermediateNupkgCategory)' and
- '$(OS)' != 'Windows_NT'">
- <PropertyGroup>
- <SymbolsRoot>$(CurrentRepoSourceBuildArtifactsDir)</SymbolsRoot>
- <!-- Fall back to repo root for source-build-externals or repos that don't have the regular SymbolsRoot as defined above -->
- <SymbolsRoot Condition="!Exists('$(SymbolsRoot)') or '$(GitHubRepositoryName)' == 'source-build-externals'">$(RepoRoot)</SymbolsRoot>
- <SymbolsArchiveLocation>$(CurrentRepoSourceBuildArtifactsPackagesDir)</SymbolsArchiveLocation>
- <SymbolsArchiveLocation Condition="'$(GitHubRepositoryName)' == 'nuget-client'">$(PackageOutputPath)</SymbolsArchiveLocation>
- <SymbolsList>$(SymbolsArchiveLocation)\symbols.lst</SymbolsList>
- <SymbolsArchivePrefix>Symbols.</SymbolsArchivePrefix>
- <SymbolsArchiveSuffix>.$(Version).$(TargetRid)</SymbolsArchiveSuffix>
- <SymbolsArchiveName>$(SymbolsArchiveLocation)$(SymbolsArchivePrefix)$(GitHubRepositoryName)$(SymbolsArchiveSuffix)$(ArchiveExtension)</SymbolsArchiveName>
- </PropertyGroup>
-
- <ItemGroup>
- <AbsoluteSymbolPath Include="$(SymbolsRoot)\**\obj\**\*.pdb" />
- <AbsoluteSymbolPath Update="@(AbsoluteSymbolPath)" Condition="'@(AbsoluteSymbolPath)' != ''">
- <RelativePath>$([MSBuild]::MakeRelative($(SymbolsRoot), %(FullPath)))</RelativePath>
- </AbsoluteSymbolPath>
- </ItemGroup>
-
- <WriteLinesToFile
- File="$(SymbolsList)"
- Lines="@(AbsoluteSymbolPath->'%(RelativePath)')"
- Overwrite="true"
- Condition="'@(AbsoluteSymbolPath)' != ''" />
+ Condition="'$(SupplementalIntermediateNupkgCategory)' == '$(SymbolsIntermediateNupkgCategory)' and '$(SymbolsArchiveFile)' != ''">
- <Exec Command="tar --numeric-owner -czf $(SymbolsArchiveName) --files-from=$(SymbolsList)"
- WorkingDirectory="$(SymbolsRoot)" Condition="Exists($(SymbolsList))" />
- <Message Importance="High" Text="Packaged symbols to $(SymbolsArchiveName)" Condition="Exists($(SymbolsArchiveName))" />
-
- <ItemGroup Condition="Exists($(SymbolsArchiveName))">
- <Content Include="$(SymbolsArchiveName)" PackagePath="artifacts" />
+ <ItemGroup Condition="Exists($(SymbolsArchiveFile))">
+ <Content Include="$(SymbolsArchiveFile)" PackagePath="artifacts" />
</ItemGroup>
-
- <Delete Files="$(SymbolsList)" Condition="Exists($(SymbolsList))" />
</Target>
<!-- Create a list of non-shipping packages and include it in the intermediate package. -->
<Target Name="GetNonShippingNupkgList"
- Condition="'@(IntermediateNonShippingNupkgFile)' != ''">
- <PropertyGroup>
- <!-- The prefix needs to match what's defined in tarball source-build infra. Consider using a single property, in the future. -->
- <NonShippingPackagesListPrefix>NonShipping.Packages.</NonShippingPackagesListPrefix>
- <NonShippingPackagesList>$(CurrentRepoSourceBuildArtifactsPackagesDir)$(NonShippingPackagesListPrefix)$(GitHubRepositoryName).lst</NonShippingPackagesList>
- </PropertyGroup>
-
- <WriteLinesToFile
- File="$(NonShippingPackagesList)"
- Lines="@(IntermediateNonShippingNupkgFile->'%(Filename)%(Extension)')"
- Overwrite="true" />
-
+ Condition="'$(NonShippingPackagesList)' != ''"
+ DependsOnTargets="GetCategorizedIntermediateNupkgContents">
<ItemGroup>
<!-- The list of non-shipping packages goes into the "main" intermediate nupkg. -->
<Content Include="$(NonShippingPackagesList)" PackagePath="." />