Refactor source-build archives infra (#15135)

This commit is contained in:
Michael Simons 2022-12-15 16:21:48 -06:00 committed by GitHub
parent a3cd81a9fc
commit 6b37d32420
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 44 deletions

View file

@ -190,28 +190,6 @@
<MicrosoftNETTestSdkVersion>17.5.0-preview-20221209-03</MicrosoftNETTestSdkVersion>
<MicrosoftExtensionsLoggingConsoleVersion>8.0.0-alpha.1.22557.12</MicrosoftExtensionsLoggingConsoleVersion>
</PropertyGroup>
<!-- dependencies for source-build tarball -->
<PropertyGroup>
<!-- These two MicrosoftBuild versions are required to build tarball tasks
These tasks will eventually move to Arcade and then these can be
removed. See https://github.com/dotnet/source-build/issues/2295 -->
<MicrosoftBuildFrameworkVersion>15.7.179</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.7.179</MicrosoftBuildUtilitiesCoreVersion>
<!--
Building .NET from source depends on one or two tar.gz files depending on the branch's current
source-buildability status.
PrivateSourceBuiltArtifactsPackageVersion is a tar.gz of .NET build outputs from a previous
build needed to build the current version of .NET. This is always defined, because .NET needs
to be bootstrappable at any point in time.
PrivateSourceBuiltPrebuiltsPackageVersion is a tar.gz of assets downloaded from the internet
that are needed to build the current version of .NET. Early in the lifecycle of a .NET major
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</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
<!-- Workload manifest package versions -->
<PropertyGroup>
<MauiFeatureBand>7.0.100</MauiFeatureBand>

View file

@ -9,4 +9,21 @@
<PropertyGroup>
<HumanizerCorePackageVersion>2.2.0</HumanizerCorePackageVersion>
</PropertyGroup>
<PropertyGroup>
<!--
Building .NET from source depends on one or two tar.gz files depending on the branch's current
source-buildability status.
PrivateSourceBuiltArtifactsPackageVersion is a tar.gz of .NET build outputs from a previous
build needed to build the current version of .NET. This is always defined, because .NET needs
to be bootstrappable at any point in time.
PrivateSourceBuiltPrebuiltsPackageVersion is a tar.gz of assets downloaded from the internet
that are needed to build the current version of .NET. Early in the lifecycle of a .NET major
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</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
</Project>

View file

@ -39,12 +39,6 @@ while :; do
shift
done
# Check for the archive text file which describes the location of the archive files to download
if [ ! -f $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt ]; then
echo " ERROR: $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt does not exist. Cannot determine which archives to download. Exiting..."
exit -1
fi
downloadArtifacts=true
downloadPrebuilts=true
installDotnet=true
@ -57,13 +51,15 @@ then
fi
# Check if Private.SourceBuilt artifacts archive exists
if [ -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Artifacts.*.tar.gz ]; then
artifactsBaseFileName="Private.SourceBuilt.Artifacts"
if [ -f $SCRIPT_ROOT/packages/archive/$artifactsBaseFileName.*.tar.gz ]; then
echo " Private.SourceBuilt.Artifacts.*.tar.gz exists...it will not be downloaded"
downloadArtifacts=false
fi
# Check if Private.SourceBuilt prebuilts archive exists
if [ -f $SCRIPT_ROOT/packages/archive/Private.SourceBuilt.Prebuilts.*.tar.gz ]; then
prebuiltsBaseFileName="Private.SourceBuilt.Prebuilts"
if [ -f $SCRIPT_ROOT/packages/archive/$prebuiltsBaseFileName.*.tar.gz ]; then
echo " Private.SourceBuilt.Prebuilts.*.tar.gz exists...it will not be downloaded"
downloadPrebuilts=false
fi
@ -74,21 +70,38 @@ if [ -d $SCRIPT_ROOT/.dotnet ]; then
installDotnet=false;
fi
# Read the archive text file to get the archives to download and download them
while read -r line; do
if [[ $line == *"Private.SourceBuilt.Artifacts"* ]]; then
if [ "$downloadArtifacts" == "true" ]; then
echo " Downloading source-built artifacts from $line..."
(cd $SCRIPT_ROOT/packages/archive/ && curl --retry 5 -O $line)
fi
function DownloadArchive {
archiveType="$1"
baseFileName="$2"
isRequired="$3"
sourceBuiltArtifactsTarballUrl="https://dotnetcli.azureedge.net/source-built-artifacts/assets/"
packageVersionsPath="$SCRIPT_ROOT/eng/Versions.props"
notFoundMessage="No source-built $archiveType found to download..."
echo " Looking for source-built $archiveType to download..."
archiveVersionLine=`grep -m 1 "<PrivateSourceBuilt${archiveType}PackageVersion>" "$packageVersionsPath" || :`
versionPattern="<PrivateSourceBuilt${archiveType}PackageVersion>(.*)</PrivateSourceBuilt${archiveType}PackageVersion>"
if [[ $archiveVersionLine =~ $versionPattern ]]; then
archiveUrl="${sourceBuiltArtifactsTarballUrl}${baseFileName}.${BASH_REMATCH[1]}.tar.gz"
echo " Downloading source-built $archiveType from $archiveUrl..."
(cd $SCRIPT_ROOT/packages/archive/ && curl --retry 5 -O $archiveUrl)
elif [ "$isRequired" == "true" ]; then
echo " ERROR: $notFoundMessage"
exit -1
else
echo " $notFoundMessage"
fi
if [[ $line == *"Private.SourceBuilt.Prebuilts"* ]]; then
if [ "$downloadPrebuilts" == "true" ]; then
echo " Downloading source-built prebuilts from $line..."
(cd $SCRIPT_ROOT/packages/archive/ && curl --retry 5 -O $line)
fi
fi
done < $SCRIPT_ROOT/packages/archive/archiveArtifacts.txt
}
# Read the eng/Versions.props to get the archives to download and download them
if [ "$downloadArtifacts" == "true" ]; then
DownloadArchive "Artifacts" $artifactsBaseFileName "true"
fi
if [ "$downloadPrebuilts" == "true" ]; then
DownloadArchive "Prebuilts" $prebuiltsBaseFileName "false"
fi
# Check for the version of dotnet to install
if [ "$installDotnet" == "true" ]; then