Browse Source

Bump .NET Arcade to 8.0.0-beta.23516.4

pull/1927/head
Kévin Chalet 2 years ago
parent
commit
2db6b371f1
  1. 4
      .github/workflows/build.yml
  2. 2
      Directory.Build.props
  3. 8
      eng/Version.Details.xml
  4. 4
      eng/common/BuildConfiguration/build-configuration.json
  5. 2
      eng/common/SetupNugetSources.ps1
  6. 2
      eng/common/SetupNugetSources.sh
  7. 2
      eng/common/build.ps1
  8. 2
      eng/common/cross/arm/sources.list.xenial
  9. 2
      eng/common/cross/arm64/sources.list.xenial
  10. 4
      eng/common/cross/build-android-rootfs.sh
  11. 336
      eng/common/cross/build-rootfs.sh
  12. 61
      eng/common/cross/tizen-build-rootfs.sh
  13. 172
      eng/common/cross/tizen-fetch.sh
  14. 65
      eng/common/cross/toolchain.cmake
  15. 4
      eng/common/dotnet-install.sh
  16. 53
      eng/common/generate-locproject.ps1
  17. 9
      eng/common/init-tools-native.ps1
  18. 29
      eng/common/loc/P22DotNetHtmlLocalization.lss
  19. 83
      eng/common/native/init-compiler.sh
  20. 130
      eng/common/native/init-distro-rid.sh
  21. 80
      eng/common/native/init-os-and-arch.sh
  22. 2
      eng/common/sdk-task.ps1
  23. 5
      eng/common/sdl/NuGet.config
  24. 42
      eng/common/sdl/configure-sdl-tool.ps1
  25. 4
      eng/common/sdl/execute-all-sdl-tools.ps1
  26. 20
      eng/common/sdl/extract-artifact-packages.ps1
  27. 1
      eng/common/sdl/sdl.ps1
  28. 75
      eng/common/sdl/trim-assets-version.ps1
  29. 14
      eng/common/templates/job/execute-sdl.yml
  30. 90
      eng/common/templates/job/job.yml
  31. 43
      eng/common/templates/job/onelocbuild.yml
  32. 20
      eng/common/templates/job/publish-build-assets.yml
  33. 7
      eng/common/templates/job/source-build.yml
  34. 11
      eng/common/templates/job/source-index-stage1.yml
  35. 9
      eng/common/templates/jobs/jobs.yml
  36. 2
      eng/common/templates/jobs/source-build.yml
  37. 4
      eng/common/templates/post-build/common-variables.yml
  38. 20
      eng/common/templates/post-build/post-build.yml
  39. 13
      eng/common/templates/steps/component-governance.yml
  40. 8
      eng/common/templates/steps/execute-sdl.yml
  41. 4
      eng/common/templates/steps/generate-sbom.yml
  42. 29
      eng/common/templates/steps/source-build.yml
  43. 57
      eng/common/templates/variables/pool-providers.yml
  44. 61
      eng/common/tools.ps1
  45. 61
      eng/common/tools.sh
  46. 4
      global.json

4
.github/workflows/build.yml

@ -66,12 +66,12 @@ jobs:
- name: Build, test and pack - name: Build, test and pack
if: ${{ runner.os == 'Windows' }} if: ${{ runner.os == 'Windows' }}
run: eng\common\CIBuild.cmd -configuration Release -prepareMachine -integrationTest run: eng\common\CIBuild.cmd -configuration Release -prepareMachine -integrationTest /p:SuppressSymbolPackageFormatValidation=true
- name: Build, test and pack - name: Build, test and pack
if: ${{ runner.os != 'Windows' }} if: ${{ runner.os != 'Windows' }}
shell: pwsh shell: pwsh
run: ./eng/common/cibuild.sh -configuration Release -prepareMachine -integrationTest run: ./eng/common/cibuild.sh -configuration Release -prepareMachine -integrationTest /p:SuppressSymbolPackageFormatValidation=true
- name: Publish logs - name: Publish logs
if: ${{ always() }} if: ${{ always() }}

2
Directory.Build.props

@ -6,7 +6,7 @@
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers> <EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>preview</AnalysisLevel> <AnalysisLevel>preview</AnalysisLevel>
<NoWarn>$(NoWarn);CS1591;NU5118;NU5128</NoWarn> <NoWarn>$(NoWarn);CS1591;NU5118;NU5128;xUnit2002</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>

8
eng/Version.Details.xml

@ -5,14 +5,14 @@
</ProductDependencies> </ProductDependencies>
<ToolsetDependencies> <ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22513.4"> <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23516.4">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>02e28316bf35d1028683ee313f0794776bff18d1</Sha> <Sha>39042b4048580366d35a7c1c4f4ce8fc0dbea4b4</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="7.0.0-beta.22513.4"> <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.23516.4">
<Uri>https://github.com/dotnet/arcade</Uri> <Uri>https://github.com/dotnet/arcade</Uri>
<Sha>02e28316bf35d1028683ee313f0794776bff18d1</Sha> <Sha>39042b4048580366d35a7c1c4f4ce8fc0dbea4b4</Sha>
</Dependency> </Dependency>
</ToolsetDependencies> </ToolsetDependencies>

4
eng/common/BuildConfiguration/build-configuration.json

@ -0,0 +1,4 @@
{
"RetryCountLimit": 1,
"RetryByAnyError": false
}

2
eng/common/SetupNugetSources.ps1

@ -153,7 +153,7 @@ if ($dotnet31Source -ne $null) {
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
} }
$dotnetVersions = @('5','6','7') $dotnetVersions = @('5','6','7','8')
foreach ($dotnetVersion in $dotnetVersions) { foreach ($dotnetVersion in $dotnetVersions) {
$feedPrefix = "dotnet" + $dotnetVersion; $feedPrefix = "dotnet" + $dotnetVersion;

2
eng/common/SetupNugetSources.sh

@ -105,7 +105,7 @@ if [ "$?" == "0" ]; then
PackageSources+=('dotnet3.1-internal-transport') PackageSources+=('dotnet3.1-internal-transport')
fi fi
DotNetVersions=('5' '6' '7') DotNetVersions=('5' '6' '7' '8')
for DotNetVersion in ${DotNetVersions[@]} ; do for DotNetVersion in ${DotNetVersions[@]} ; do
FeedPrefix="dotnet${DotNetVersion}"; FeedPrefix="dotnet${DotNetVersion}";

2
eng/common/build.ps1

@ -67,8 +67,8 @@ function Print-Usage() {
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)"
Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio"
Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)"
Write-Host "" Write-Host ""
Write-Host "Command line arguments not listed above are passed thru to msbuild." Write-Host "Command line arguments not listed above are passed thru to msbuild."

2
eng/common/cross/arm/sources.list.xenial

@ -8,4 +8,4 @@ deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse

2
eng/common/cross/arm64/sources.list.xenial

@ -8,4 +8,4 @@ deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse

4
eng/common/cross/build-android-rootfs.sh

@ -107,12 +107,12 @@ __AndroidPackages+=" liblzma"
__AndroidPackages+=" krb5" __AndroidPackages+=" krb5"
__AndroidPackages+=" openssl" __AndroidPackages+=" openssl"
for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\ for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-$__AndroidArch/Packages |\
grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do
if [[ "$path" != "Filename:" ]]; then if [[ "$path" != "Filename:" ]]; then
echo "Working on: $path" echo "Working on: $path"
wget -qO- http://termux.net/$path | dpkg -x - "$__TmpDir" wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$__TmpDir"
fi fi
done done

336
eng/common/cross/build-rootfs.sh

@ -6,13 +6,15 @@ usage()
{ {
echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir <directory>]" echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir <directory>]"
echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86" echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86"
echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.13 or alpine3.14. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine"
echo " for FreeBSD can be: freebsd12, freebsd13" echo " for alpine can be specified with version: alpineX.YY or alpineedge"
echo " for illumos can be: illumos" echo " for FreeBSD can be: freebsd12, freebsd13"
echo " for Haiku can be: haiku." echo " for illumos can be: illumos"
echo " for Haiku can be: haiku."
echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD"
echo "llvmx[.y] - optional, LLVM version for LLVM related packages." echo "llvmx[.y] - optional, LLVM version for LLVM related packages."
echo "--skipunmount - optional, will skip the unmount of rootfs folder." echo "--skipunmount - optional, will skip the unmount of rootfs folder."
echo "--skipsigcheck - optional, will skip package signature checks (allowing untrusted packages)."
echo "--use-mirror - optional, use mirror URL to fetch resources, when available." echo "--use-mirror - optional, use mirror URL to fetch resources, when available."
echo "--jobs N - optional, restrict to N jobs." echo "--jobs N - optional, restrict to N jobs."
exit 1 exit 1
@ -25,6 +27,7 @@ __AlpineArch=armv7
__FreeBSDArch=arm __FreeBSDArch=arm
__FreeBSDMachineArch=armv7 __FreeBSDMachineArch=armv7
__IllumosArch=arm7 __IllumosArch=arm7
__HaikuArch=arm
__QEMUArch=arm __QEMUArch=arm
__UbuntuArch=armhf __UbuntuArch=armhf
__UbuntuRepo="http://ports.ubuntu.com/" __UbuntuRepo="http://ports.ubuntu.com/"
@ -48,12 +51,14 @@ __UbuntuPackages+=" symlinks"
__UbuntuPackages+=" libicu-dev" __UbuntuPackages+=" libicu-dev"
__UbuntuPackages+=" liblttng-ust-dev" __UbuntuPackages+=" liblttng-ust-dev"
__UbuntuPackages+=" libunwind8-dev" __UbuntuPackages+=" libunwind8-dev"
__UbuntuPackages+=" libnuma-dev"
__AlpinePackages+=" gettext-dev" __AlpinePackages+=" gettext-dev"
__AlpinePackages+=" icu-dev" __AlpinePackages+=" icu-dev"
__AlpinePackages+=" libunwind-dev" __AlpinePackages+=" libunwind-dev"
__AlpinePackages+=" lttng-ust-dev" __AlpinePackages+=" lttng-ust-dev"
__AlpinePackages+=" compiler-rt-static" __AlpinePackages+=" compiler-rt"
__AlpinePackages+=" numactl-dev"
# runtime libraries' dependencies # runtime libraries' dependencies
__UbuntuPackages+=" libcurl4-openssl-dev" __UbuntuPackages+=" libcurl4-openssl-dev"
@ -66,7 +71,7 @@ __AlpinePackages+=" krb5-dev"
__AlpinePackages+=" openssl-dev" __AlpinePackages+=" openssl-dev"
__AlpinePackages+=" zlib-dev" __AlpinePackages+=" zlib-dev"
__FreeBSDBase="12.3-RELEASE" __FreeBSDBase="12.4-RELEASE"
__FreeBSDPkg="1.17.0" __FreeBSDPkg="1.17.0"
__FreeBSDABI="12" __FreeBSDABI="12"
__FreeBSDPackages="libunwind" __FreeBSDPackages="libunwind"
@ -81,8 +86,12 @@ __IllumosPackages+=" mit-krb5"
__IllumosPackages+=" openssl" __IllumosPackages+=" openssl"
__IllumosPackages+=" zlib" __IllumosPackages+=" zlib"
__HaikuPackages="gmp" __HaikuPackages="gcc_syslibs"
__HaikuPackages+=" gcc_syslibs_devel"
__HaikuPackages+=" gmp"
__HaikuPackages+=" gmp_devel" __HaikuPackages+=" gmp_devel"
__HaikuPackages+=" icu66"
__HaikuPackages+=" icu66_devel"
__HaikuPackages+=" krb5" __HaikuPackages+=" krb5"
__HaikuPackages+=" krb5_devel" __HaikuPackages+=" krb5_devel"
__HaikuPackages+=" libiconv" __HaikuPackages+=" libiconv"
@ -91,12 +100,36 @@ __HaikuPackages+=" llvm12_libunwind"
__HaikuPackages+=" llvm12_libunwind_devel" __HaikuPackages+=" llvm12_libunwind_devel"
__HaikuPackages+=" mpfr" __HaikuPackages+=" mpfr"
__HaikuPackages+=" mpfr_devel" __HaikuPackages+=" mpfr_devel"
__HaikuPackages+=" openssl"
__HaikuPackages+=" openssl_devel"
__HaikuPackages+=" zlib"
__HaikuPackages+=" zlib_devel"
# ML.NET dependencies # ML.NET dependencies
__UbuntuPackages+=" libomp5" __UbuntuPackages+=" libomp5"
__UbuntuPackages+=" libomp-dev" __UbuntuPackages+=" libomp-dev"
# Taken from https://github.com/alpinelinux/alpine-chroot-install/blob/6d08f12a8a70dd9b9dc7d997c88aa7789cc03c42/alpine-chroot-install#L85-L133
__AlpineKeys='
4a6a0840:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1yHJxQgsHQREclQu4Ohe\nqxTxd1tHcNnvnQTu/UrTky8wWvgXT+jpveroeWWnzmsYlDI93eLI2ORakxb3gA2O\nQ0Ry4ws8vhaxLQGC74uQR5+/yYrLuTKydFzuPaS1dK19qJPXB8GMdmFOijnXX4SA\njixuHLe1WW7kZVtjL7nufvpXkWBGjsfrvskdNA/5MfxAeBbqPgaq0QMEfxMAn6/R\nL5kNepi/Vr4S39Xvf2DzWkTLEK8pcnjNkt9/aafhWqFVW7m3HCAII6h/qlQNQKSo\nGuH34Q8GsFG30izUENV9avY7hSLq7nggsvknlNBZtFUcmGoQrtx3FmyYsIC8/R+B\nywIDAQAB
5243ef4b:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvNijDxJ8kloskKQpJdx+\nmTMVFFUGDoDCbulnhZMJoKNkSuZOzBoFC94omYPtxnIcBdWBGnrm6ncbKRlR+6oy\nDO0W7c44uHKCFGFqBhDasdI4RCYP+fcIX/lyMh6MLbOxqS22TwSLhCVjTyJeeH7K\naA7vqk+QSsF4TGbYzQDDpg7+6aAcNzg6InNePaywA6hbT0JXbxnDWsB+2/LLSF2G\nmnhJlJrWB1WGjkz23ONIWk85W4S0XB/ewDefd4Ly/zyIciastA7Zqnh7p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njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ==
'
__Keyring= __Keyring=
__SkipSigCheck=0
__UseMirror=0 __UseMirror=0
__UnprocessedBuildArgs= __UnprocessedBuildArgs=
@ -143,47 +176,56 @@ while :; do
__Keyring="--keyring /usr/share/keyrings/raspbian-archive-keyring.gpg" __Keyring="--keyring /usr/share/keyrings/raspbian-archive-keyring.gpg"
fi fi
;; ;;
ppc64le)
__BuildArch=ppc64le
__UbuntuArch=ppc64el
__UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp5//')
unset __LLDB_Package
;;
riscv64) riscv64)
__BuildArch=riscv64 __BuildArch=riscv64
__AlpineArch=riscv64
__AlpinePackages="${__AlpinePackages// lldb-dev/}"
__QEMUArch=riscv64
__UbuntuArch=riscv64 __UbuntuArch=riscv64
__UbuntuRepo="http://deb.debian.org/debian-ports" __UbuntuRepo="http://deb.debian.org/debian-ports"
__CodeName=sid __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//')
unset __LLDB_Package unset __LLDB_Package
if [[ -e "/usr/share/keyrings/debian-ports-archive-keyring.gpg" ]]; then if [[ -e "/usr/share/keyrings/debian-ports-archive-keyring.gpg" ]]; then
__Keyring="--keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --include=debian-ports-archive-keyring" __Keyring="--keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --include=debian-ports-archive-keyring"
fi fi
;; ;;
ppc64le)
__BuildArch=ppc64le
__AlpineArch=ppc64le
__QEMUArch=ppc64le
__UbuntuArch=ppc64el
__UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp5/}"
unset __LLDB_Package
;;
s390x) s390x)
__BuildArch=s390x __BuildArch=s390x
__AlpineArch=s390x
__QEMUArch=s390x
__UbuntuArch=s390x __UbuntuArch=s390x
__UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//') __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp-dev//') __UbuntuPackages="${__UbuntuPackages// libomp-dev/}"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp5//') __UbuntuPackages="${__UbuntuPackages// libomp5/}"
unset __LLDB_Package unset __LLDB_Package
;; ;;
x64) x64)
__BuildArch=x64 __BuildArch=x64
__AlpineArch=x86_64
__UbuntuArch=amd64 __UbuntuArch=amd64
__FreeBSDArch=amd64 __FreeBSDArch=amd64
__FreeBSDMachineArch=amd64 __FreeBSDMachineArch=amd64
__illumosArch=x86_64 __illumosArch=x86_64
__UbuntuRepo= __HaikuArch=x86_64
__UbuntuRepo="http://archive.ubuntu.com/ubuntu/"
;; ;;
x86) x86)
__BuildArch=x86 __BuildArch=x86
__UbuntuArch=i386 __UbuntuArch=i386
__AlpineArch=x86
__UbuntuRepo="http://archive.ubuntu.com/ubuntu/" __UbuntuRepo="http://archive.ubuntu.com/ubuntu/"
;; ;;
lldb*) lldb*)
@ -238,34 +280,59 @@ while :; do
;; ;;
jessie) # Debian 8 jessie) # Debian 8
__CodeName=jessie __CodeName=jessie
__UbuntuRepo="http://ftp.debian.org/debian/"
if [[ -z "$__UbuntuRepo" ]]; then
__UbuntuRepo="http://ftp.debian.org/debian/"
fi
;; ;;
stretch) # Debian 9 stretch) # Debian 9
__CodeName=stretch __CodeName=stretch
__UbuntuRepo="http://ftp.debian.org/debian/"
__LLDB_Package="liblldb-6.0-dev" __LLDB_Package="liblldb-6.0-dev"
if [[ -z "$__UbuntuRepo" ]]; then
__UbuntuRepo="http://ftp.debian.org/debian/"
fi
;; ;;
buster) # Debian 10 buster) # Debian 10
__CodeName=buster __CodeName=buster
__UbuntuRepo="http://ftp.debian.org/debian/"
__LLDB_Package="liblldb-6.0-dev" __LLDB_Package="liblldb-6.0-dev"
if [[ -z "$__UbuntuRepo" ]]; then
__UbuntuRepo="http://ftp.debian.org/debian/"
fi
;;
bullseye) # Debian 11
__CodeName=bullseye
if [[ -z "$__UbuntuRepo" ]]; then
__UbuntuRepo="http://ftp.debian.org/debian/"
fi
;;
sid) # Debian sid
__CodeName=sid
if [[ -z "$__UbuntuRepo" ]]; then
__UbuntuRepo="http://ftp.debian.org/debian/"
fi
;; ;;
tizen) tizen)
__CodeName= __CodeName=
__UbuntuRepo= __UbuntuRepo=
__Tizen=tizen __Tizen=tizen
;; ;;
alpine|alpine3.13) alpine*)
__CodeName=alpine __CodeName=alpine
__UbuntuRepo= __UbuntuRepo=
__AlpineVersion=3.13 version="${lowerI/alpine/}"
__AlpinePackages+=" llvm10-libs"
;; if [[ "$version" == "edge" ]]; then
alpine3.14) __AlpineVersion=edge
__CodeName=alpine else
__UbuntuRepo= parts=(${version//./ })
__AlpineVersion=3.14 __AlpineMajorVersion="${parts[0]}"
__AlpinePackages+=" llvm11-libs" __AlpineMinoVersion="${parts[1]}"
__AlpineVersion="$__AlpineMajorVersion.$__AlpineMinoVersion"
fi
;; ;;
freebsd12) freebsd12)
__CodeName=freebsd __CodeName=freebsd
@ -273,7 +340,7 @@ while :; do
;; ;;
freebsd13) freebsd13)
__CodeName=freebsd __CodeName=freebsd
__FreeBSDBase="13.0-RELEASE" __FreeBSDBase="13.2-RELEASE"
__FreeBSDABI="13" __FreeBSDABI="13"
__SkipUnmount=1 __SkipUnmount=1
;; ;;
@ -283,12 +350,14 @@ while :; do
;; ;;
haiku) haiku)
__CodeName=haiku __CodeName=haiku
__BuildArch=x64
__SkipUnmount=1 __SkipUnmount=1
;; ;;
--skipunmount) --skipunmount)
__SkipUnmount=1 __SkipUnmount=1
;; ;;
--skipsigcheck)
__SkipSigCheck=1
;;
--rootfsdir|-rootfsdir) --rootfsdir|-rootfsdir)
shift shift
__RootfsDir="$1" __RootfsDir="$1"
@ -308,10 +377,47 @@ while :; do
shift shift
done done
case "$__AlpineVersion" in
3.14) __AlpinePackages+=" llvm11-libs" ;;
3.15) __AlpinePackages+=" llvm12-libs" ;;
3.16) __AlpinePackages+=" llvm13-libs" ;;
3.17) __AlpinePackages+=" llvm15-libs" ;;
edge) __AlpineLlvmLibsLookup=1 ;;
*)
if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then
__AlpineVersion=3.15 # minimum version that supports lldb-dev
__AlpinePackages+=" llvm12-libs"
elif [[ "$__AlpineArch" == "x86" ]]; then
__AlpineVersion=3.17 # minimum version that supports lldb-dev
__AlpinePackages+=" llvm15-libs"
elif [[ "$__AlpineArch" == "riscv64" ]]; then
__AlpineLlvmLibsLookup=1
__AlpineVersion=edge # minimum version with APKINDEX.tar.gz (packages archive)
else
__AlpineVersion=3.13 # 3.13 to maximize compatibility
__AlpinePackages+=" llvm10-libs"
if [[ "$__AlpineArch" == "armv7" ]]; then
__AlpinePackages="${__AlpinePackages//numactl-dev/}"
fi
fi
esac
if [[ "$__AlpineVersion" =~ 3\.1[345] ]]; then
# compiler-rt--static was merged in compiler-rt package in alpine 3.16
# for older versions, we need compiler-rt--static, so replace the name
__AlpinePackages="${__AlpinePackages/compiler-rt/compiler-rt-static}"
fi
if [[ "$__BuildArch" == "armel" ]]; then if [[ "$__BuildArch" == "armel" ]]; then
__LLDB_Package="lldb-3.5-dev" __LLDB_Package="lldb-3.5-dev"
fi fi
if [[ "$__CodeName" == "xenial" && "$__UbuntuArch" == "armhf" ]]; then
# libnuma-dev is not available on armhf for xenial
__UbuntuPackages="${__UbuntuPackages//libnuma-dev/}"
fi
__UbuntuPackages+=" ${__LLDB_Package:-}" __UbuntuPackages+=" ${__LLDB_Package:-}"
if [[ -n "$__LLVM_MajorVersion" ]]; then if [[ -n "$__LLVM_MajorVersion" ]]; then
@ -337,18 +443,59 @@ mkdir -p "$__RootfsDir"
__RootfsDir="$( cd "$__RootfsDir" && pwd )" __RootfsDir="$( cd "$__RootfsDir" && pwd )"
if [[ "$__CodeName" == "alpine" ]]; then if [[ "$__CodeName" == "alpine" ]]; then
__ApkToolsVersion=2.9.1 __ApkToolsVersion=2.12.11
__ApkToolsSHA512SUM=53e57b49230da07ef44ee0765b9592580308c407a8d4da7125550957bb72cb59638e04f8892a18b584451c8d841d1c7cb0f0ab680cc323a3015776affaa3be33
__ApkToolsDir="$(mktemp -d)" __ApkToolsDir="$(mktemp -d)"
wget "https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz" -P "$__ApkToolsDir" __ApkKeysDir="$(mktemp -d)"
tar -xf "$__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz" -C "$__ApkToolsDir"
mkdir -p "$__RootfsDir"/usr/bin wget "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic//v$__ApkToolsVersion/x86_64/apk.static" -P "$__ApkToolsDir"
cp -v "/usr/bin/qemu-$__QEMUArch-static" "$__RootfsDir/usr/bin" echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk.static" | sha512sum -c
chmod +x "$__ApkToolsDir/apk.static"
if [[ -f "/usr/bin/qemu-$__QEMUArch-static" ]]; then
mkdir -p "$__RootfsDir"/usr/bin
cp -v "/usr/bin/qemu-$__QEMUArch-static" "$__RootfsDir/usr/bin"
fi
if [[ "$__AlpineVersion" == "edge" ]]; then
version=edge
else
version="v$__AlpineVersion"
fi
for line in $__AlpineKeys; do
id="${line%%:*}"
content="${line#*:}"
echo -e "-----BEGIN PUBLIC KEY-----\n$content\n-----END PUBLIC KEY-----" > "$__ApkKeysDir/alpine-devel@lists.alpinelinux.org-$id.rsa.pub"
done
if [[ "$__SkipSigCheck" == "1" ]]; then
__ApkSignatureArg="--allow-untrusted"
else
__ApkSignatureArg="--keys-dir $__ApkKeysDir"
fi
# initialize DB
"$__ApkToolsDir/apk.static" \
-X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \
-X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \
-U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" --initdb add
if [[ "$__AlpineLlvmLibsLookup" == 1 ]]; then
__AlpinePackages+=" $("$__ApkToolsDir/apk.static" \
-X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \
-X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \
-U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \
search 'llvm*-libs' | sort | tail -1 | sed 's/-[^-]*//2g')"
fi
"$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk" \ # install all packages in one go
-X "http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main" \ "$__ApkToolsDir/apk.static" \
-X "http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \
-U --allow-untrusted --root "$__RootfsDir" --arch "$__AlpineArch" --initdb \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \
add $__AlpinePackages -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \
add $__AlpinePackages
rm -r "$__ApkToolsDir" rm -r "$__ApkToolsDir"
elif [[ "$__CodeName" == "freebsd" ]]; then elif [[ "$__CodeName" == "freebsd" ]]; then
@ -391,9 +538,9 @@ elif [[ "$__CodeName" == "illumos" ]]; then
--with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \
--disable-libquadmath-support --disable-shared --enable-tls --disable-libquadmath-support --disable-shared --enable-tls
make -j "$JOBS" && make install && cd .. make -j "$JOBS" && make install && cd ..
BaseUrl=https://pkgsrc.joyent.com BaseUrl=https://pkgsrc.smartos.org
if [[ "$__UseMirror" == 1 ]]; then if [[ "$__UseMirror" == 1 ]]; then
BaseUrl=http://pkgsrc.smartos.skylime.net BaseUrl=https://pkgsrc.smartos.skylime.net
fi fi
BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All"
echo "Downloading manifest" echo "Downloading manifest"
@ -402,7 +549,8 @@ elif [[ "$__CodeName" == "illumos" ]]; then
read -ra array <<<"$__IllumosPackages" read -ra array <<<"$__IllumosPackages"
for package in "${array[@]}"; do for package in "${array[@]}"; do
echo "Installing '$package'" echo "Installing '$package'"
package="$(grep ">$package-[0-9]" All | sed -En 's/.*href="(.*)\.tgz".*/\1/p')" # find last occurrence of package in listing and extract its name
package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)"
echo "Resolved name '$package'" echo "Resolved name '$package'"
wget "$BaseUrl"/"$package".tgz wget "$BaseUrl"/"$package".tgz
ar -x "$package".tgz ar -x "$package".tgz
@ -420,69 +568,61 @@ elif [[ "$__CodeName" == "illumos" ]]; then
elif [[ "$__CodeName" == "haiku" ]]; then elif [[ "$__CodeName" == "haiku" ]]; then
JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"}
echo "Building Haiku sysroot for x86_64" echo "Building Haiku sysroot for $__HaikuArch"
mkdir -p "$__RootfsDir/tmp" mkdir -p "$__RootfsDir/tmp"
cd "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp"
git clone -b hrev56235 https://review.haiku-os.org/haiku
git clone -b btrev43195 https://review.haiku-os.org/buildtools mkdir "$__RootfsDir/tmp/download"
cd "$__RootfsDir/tmp/buildtools" && git checkout 7487388f5110021d400b9f3b88e1a7f310dc066d
echo "Downloading Haiku package tool"
# Fetch some unmerged patches git clone https://github.com/haiku/haiku-toolchains-ubuntu --depth 1 $__RootfsDir/tmp/script
cd "$__RootfsDir/tmp/haiku" wget -O "$__RootfsDir/tmp/download/hosttools.zip" $($__RootfsDir/tmp/script/fetch.sh --hosttools)
## Add development build profile (slimmer than nightly) unzip -o "$__RootfsDir/tmp/download/hosttools.zip" -d "$__RootfsDir/tmp/bin"
git fetch origin refs/changes/64/4164/1 && git -c commit.gpgsign=false cherry-pick FETCH_HEAD
DepotBaseUrl="https://depot.haiku-os.org/__api/v2/pkg/get-pkg"
# Build jam HpkgBaseUrl="https://eu.hpkg.haiku-os.org/haiku/master/$__HaikuArch/current"
cd "$__RootfsDir/tmp/buildtools/jam"
make # Download Haiku packages
echo "Downloading Haiku packages"
# Configure cross tools
echo "Building cross-compiler"
mkdir -p "$__RootfsDir/generated"
cd "$__RootfsDir/generated"
"$__RootfsDir/tmp/haiku/configure" -j"$JOBS" --sysroot "$__RootfsDir" --cross-tools-source "$__RootfsDir/tmp/buildtools" --build-cross-tools x86_64
# Build Haiku packages
echo "Building Haiku"
echo 'HAIKU_BUILD_PROFILE = "development-raw" ;' > UserProfileConfig
"$__RootfsDir/tmp/buildtools/jam/jam0" -j"$JOBS" -q '<build>package' '<repository>Haiku'
BaseUrl="https://depot.haiku-os.org/__api/v2/pkg/get-pkg"
# Download additional packages
echo "Downloading additional required packages"
read -ra array <<<"$__HaikuPackages" read -ra array <<<"$__HaikuPackages"
for package in "${array[@]}"; do for package in "${array[@]}"; do
echo "Downloading $package..." echo "Downloading $package..."
# API documented here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L60 # API documented here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L60
# The schema here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L598 # The schema here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L598
hpkgDownloadUrl="$(wget -qO- --post-data='{"name":"'"$package"'","repositorySourceCode":"haikuports_x86_64","versionType":"LATEST","naturalLanguageCode":"en"}' \ hpkgDownloadUrl="$(wget -qO- --post-data='{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \
--header='Content-Type:application/json' "$BaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" --header='Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')"
wget -P "$__RootfsDir/generated/download" "$hpkgDownloadUrl" wget -P "$__RootfsDir/tmp/download" "$hpkgDownloadUrl"
done
for package in haiku haiku_devel; do
echo "Downloading $package..."
hpkgVersion="$(wget -qO- $HpkgBaseUrl | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')"
wget -P "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg"
done done
# Setup the sysroot # Set up the sysroot
echo "Setting up sysroot and extracting needed packages" echo "Setting up sysroot and extracting required packages"
mkdir -p "$__RootfsDir/boot/system" mkdir -p "$__RootfsDir/boot/system"
for file in "$__RootfsDir/generated/objects/haiku/x86_64/packaging/packages/"*.hpkg; do for file in "$__RootfsDir/tmp/download/"*.hpkg; do
"$__RootfsDir/generated/objects/linux/x86_64/release/tools/package/package" extract -C "$__RootfsDir/boot/system" "$file" echo "Extracting $file..."
done LD_LIBRARY_PATH="$__RootfsDir/tmp/bin" "$__RootfsDir/tmp/bin/package" extract -C "$__RootfsDir/boot/system" "$file"
for file in "$__RootfsDir/generated/download/"*.hpkg; do
"$__RootfsDir/generated/objects/linux/x86_64/release/tools/package/package" extract -C "$__RootfsDir/boot/system" "$file"
done done
# Download buildtools
echo "Downloading Haiku buildtools"
wget -O "$__RootfsDir/tmp/download/buildtools.zip" $($__RootfsDir/tmp/script/fetch.sh --buildtools --arch=$__HaikuArch)
unzip -o "$__RootfsDir/tmp/download/buildtools.zip" -d "$__RootfsDir"
# Cleaning up temporary files # Cleaning up temporary files
echo "Cleaning up temporary files" echo "Cleaning up temporary files"
popd
rm -rf "$__RootfsDir/tmp" rm -rf "$__RootfsDir/tmp"
for name in "$__RootfsDir/generated/"*; do
if [[ "$name" =~ "cross-tools-" ]]; then
: # Keep the cross-compiler
else
rm -rf "$name"
fi
done
elif [[ -n "$__CodeName" ]]; then elif [[ -n "$__CodeName" ]]; then
qemu-debootstrap $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo"
if [[ "$__SkipSigCheck" == "0" ]]; then
__Keyring="$__Keyring --force-check-gpg"
fi
debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo"
cp "$__CrossDir/$__BuildArch/sources.list.$__CodeName" "$__RootfsDir/etc/apt/sources.list" cp "$__CrossDir/$__BuildArch/sources.list.$__CodeName" "$__RootfsDir/etc/apt/sources.list"
chroot "$__RootfsDir" apt-get update chroot "$__RootfsDir" apt-get update
chroot "$__RootfsDir" apt-get -f -y install chroot "$__RootfsDir" apt-get -f -y install
@ -500,7 +640,7 @@ elif [[ -n "$__CodeName" ]]; then
popd popd
fi fi
elif [[ "$__Tizen" == "tizen" ]]; then elif [[ "$__Tizen" == "tizen" ]]; then
ROOTFS_DIR="$__RootfsDir" "$__CrossDir/$__BuildArch/tizen-build-rootfs.sh" ROOTFS_DIR="$__RootfsDir" "$__CrossDir/tizen-build-rootfs.sh" "$__BuildArch"
else else
echo "Unsupported target platform." echo "Unsupported target platform."
usage; usage;

61
eng/common/cross/tizen-build-rootfs.sh

@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -e
ARCH=$1
LINK_ARCH=$ARCH
case "$ARCH" in
arm)
TIZEN_ARCH="armv7hl"
;;
armel)
TIZEN_ARCH="armv7l"
LINK_ARCH="arm"
;;
arm64)
TIZEN_ARCH="aarch64"
;;
x86)
TIZEN_ARCH="i686"
;;
x64)
TIZEN_ARCH="x86_64"
LINK_ARCH="x86"
;;
*)
echo "Unsupported architecture for tizen: $ARCH"
exit 1
esac
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
__TIZEN_CROSSDIR="$__CrossDir/${ARCH}/tizen"
if [[ -z "$ROOTFS_DIR" ]]; then
echo "ROOTFS_DIR is not defined."
exit 1;
fi
TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
mkdir -p $TIZEN_TMP_DIR
# Download files
echo ">>Start downloading files"
VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH
echo "<<Finish downloading files"
echo ">>Start constructing Tizen rootfs"
TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
cd $ROOTFS_DIR
for f in $TIZEN_RPM_FILES; do
rpm2cpio $f | cpio -idm --quiet
done
echo "<<Finish constructing Tizen rootfs"
# Cleanup tmp
rm -rf $TIZEN_TMP_DIR
# Configure Tizen rootfs
echo ">>Start configuring Tizen rootfs"
ln -sfn asm-${LINK_ARCH} ./usr/include/asm
patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
echo "<<Finish configuring Tizen rootfs"

172
eng/common/cross/tizen-fetch.sh

@ -0,0 +1,172 @@
#!/usr/bin/env bash
set -e
if [[ -z "${VERBOSE// }" ]] || [ "$VERBOSE" -ne "$VERBOSE" ] 2>/dev/null; then
VERBOSE=0
fi
Log()
{
if [ $VERBOSE -ge $1 ]; then
echo ${@:2}
fi
}
Inform()
{
Log 1 -e "\x1B[0;34m$@\x1B[m"
}
Debug()
{
Log 2 -e "\x1B[0;32m$@\x1B[m"
}
Error()
{
>&2 Log 0 -e "\x1B[0;31m$@\x1B[m"
}
Fetch()
{
URL=$1
FILE=$2
PROGRESS=$3
if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then
CURL_OPT="--progress-bar"
else
CURL_OPT="--silent"
fi
curl $CURL_OPT $URL > $FILE
}
hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; }
hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; }
hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; }
TMPDIR=$1
if [ ! -d $TMPDIR ]; then
TMPDIR=./tizen_tmp
Debug "Create temporary directory : $TMPDIR"
mkdir -p $TMPDIR
fi
TIZEN_ARCH=$2
TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen
BUILD_XML=build.xml
REPOMD_XML=repomd.xml
PRIMARY_XML=primary.xml
TARGET_URL="http://__not_initialized"
Xpath_get()
{
XPATH_RESULT=''
XPATH=$1
XML_FILE=$2
RESULT=$(xmllint --xpath $XPATH $XML_FILE)
if [[ -z ${RESULT// } ]]; then
Error "Can not find target from $XML_FILE"
Debug "Xpath = $XPATH"
exit 1
fi
XPATH_RESULT=$RESULT
}
fetch_tizen_pkgs_init()
{
TARGET=$1
PROFILE=$2
Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE"
TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs
if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi
mkdir -p $TMP_PKG_DIR
PKG_URL=$TIZEN_URL/$PROFILE/latest
BUILD_XML_URL=$PKG_URL/$BUILD_XML
TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML
TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML
TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML
TMP_PRIMARYGZ=${TMP_PRIMARY}.gz
Fetch $BUILD_XML_URL $TMP_BUILD
Debug "fetch $BUILD_XML_URL to $TMP_BUILD"
TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()"
Xpath_get $TARGET_XPATH $TMP_BUILD
TARGET_PATH=$XPATH_RESULT
TARGET_URL=$PKG_URL/$TARGET_PATH
REPOMD_URL=$TARGET_URL/repodata/repomd.xml
PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)'
Fetch $REPOMD_URL $TMP_REPOMD
Debug "fetch $REPOMD_URL to $TMP_REPOMD"
Xpath_get $PRIMARY_XPATH $TMP_REPOMD
PRIMARY_XML_PATH=$XPATH_RESULT
PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH
Fetch $PRIMARY_URL $TMP_PRIMARYGZ
Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ"
gunzip $TMP_PRIMARYGZ
Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY"
}
fetch_tizen_pkgs()
{
ARCH=$1
PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)'
PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())'
for pkg in ${@:2}
do
Inform "Fetching... $pkg"
XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg}
XPATH=${XPATH/_ARCH_/$ARCH}
Xpath_get $XPATH $TMP_PRIMARY
PKG_PATH=$XPATH_RESULT
XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg}
XPATH=${XPATH/_ARCH_/$ARCH}
Xpath_get $XPATH $TMP_PRIMARY
CHECKSUM=$XPATH_RESULT
PKG_URL=$TARGET_URL/$PKG_PATH
PKG_FILE=$(basename $PKG_PATH)
PKG_PATH=$TMPDIR/$PKG_FILE
Debug "Download $PKG_URL to $PKG_PATH"
Fetch $PKG_URL $PKG_PATH true
echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null
if [ $? -ne 0 ]; then
Error "Fail to fetch $PKG_URL to $PKG_PATH"
Debug "Checksum = $CHECKSUM"
exit 1
fi
done
}
Inform "Initialize ${TIZEN_ARCH} base"
fetch_tizen_pkgs_init standard Tizen-Base
Inform "fetch common packages"
fetch_tizen_pkgs ${TIZEN_ARCH} gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils
Inform "fetch coreclr packages"
fetch_tizen_pkgs ${TIZEN_ARCH} lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu
Inform "fetch corefx packages"
fetch_tizen_pkgs ${TIZEN_ARCH} libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel
Inform "Initialize standard unified"
fetch_tizen_pkgs_init standard Tizen-Unified
Inform "fetch corefx packages"
fetch_tizen_pkgs ${TIZEN_ARCH} gssdp gssdp-devel tizen-release

65
eng/common/cross/toolchain.cmake

@ -1,5 +1,13 @@
set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
# reset platform variables (e.g. cmake 3.25 sets LINUX=1)
unset(LINUX)
unset(FREEBSD)
unset(ILLUMOS)
unset(ANDROID)
unset(TIZEN)
unset(HAIKU)
set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
set(CMAKE_SYSTEM_NAME FreeBSD) set(CMAKE_SYSTEM_NAME FreeBSD)
@ -9,6 +17,7 @@ elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc)
set(ILLUMOS 1) set(ILLUMOS 1)
elseif(EXISTS ${CROSS_ROOTFS}/boot/system/develop/headers/config/HaikuConfig.h) elseif(EXISTS ${CROSS_ROOTFS}/boot/system/develop/headers/config/HaikuConfig.h)
set(CMAKE_SYSTEM_NAME Haiku) set(CMAKE_SYSTEM_NAME Haiku)
set(HAIKU 1)
else() else()
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_NAME Linux)
set(LINUX 1) set(LINUX 1)
@ -60,16 +69,30 @@ elseif(TARGET_ARCH_NAME STREQUAL "armv6")
endif() endif()
elseif(TARGET_ARCH_NAME STREQUAL "ppc64le") elseif(TARGET_ARCH_NAME STREQUAL "ppc64le")
set(CMAKE_SYSTEM_PROCESSOR ppc64le) set(CMAKE_SYSTEM_PROCESSOR ppc64le)
set(TOOLCHAIN "powerpc64le-linux-gnu") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/powerpc64le-alpine-linux-musl)
set(TOOLCHAIN "powerpc64le-alpine-linux-musl")
else()
set(TOOLCHAIN "powerpc64le-linux-gnu")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "riscv64") elseif(TARGET_ARCH_NAME STREQUAL "riscv64")
set(CMAKE_SYSTEM_PROCESSOR riscv64) set(CMAKE_SYSTEM_PROCESSOR riscv64)
set(TOOLCHAIN "riscv64-linux-gnu") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
set(TOOLCHAIN "riscv64-alpine-linux-musl")
else()
set(TOOLCHAIN "riscv64-linux-gnu")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "s390x") elseif(TARGET_ARCH_NAME STREQUAL "s390x")
set(CMAKE_SYSTEM_PROCESSOR s390x) set(CMAKE_SYSTEM_PROCESSOR s390x)
set(TOOLCHAIN "s390x-linux-gnu") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl)
set(TOOLCHAIN "s390x-alpine-linux-musl")
else()
set(TOOLCHAIN "s390x-linux-gnu")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x64") elseif(TARGET_ARCH_NAME STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64) set(CMAKE_SYSTEM_PROCESSOR x86_64)
if(LINUX) if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl)
set(TOOLCHAIN "x86_64-alpine-linux-musl")
elseif(LINUX)
set(TOOLCHAIN "x86_64-linux-gnu") set(TOOLCHAIN "x86_64-linux-gnu")
if(TIZEN) if(TIZEN)
set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0") set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0")
@ -79,11 +102,15 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64")
elseif(ILLUMOS) elseif(ILLUMOS)
set(TOOLCHAIN "x86_64-illumos") set(TOOLCHAIN "x86_64-illumos")
elseif(HAIKU) elseif(HAIKU)
set(TOOLCHAIN "x64_64-unknown-haiku") set(TOOLCHAIN "x86_64-unknown-haiku")
endif() endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86") elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR i686) set(CMAKE_SYSTEM_PROCESSOR i686)
set(TOOLCHAIN "i686-linux-gnu") if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
set(TOOLCHAIN "i586-alpine-linux-musl")
else()
set(TOOLCHAIN "i686-linux-gnu")
endif()
if(TIZEN) if(TIZEN)
set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0") set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0")
endif() endif()
@ -113,6 +140,10 @@ if(TIZEN)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/i586-tizen-linux-gnu) include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/i586-tizen-linux-gnu)
endif() endif()
if(TARGET_ARCH_NAME STREQUAL "x64")
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/x86_64-tizen-linux-gnu)
endif()
endif() endif()
if(ANDROID) if(ANDROID)
@ -176,6 +207,7 @@ elseif(ILLUMOS)
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp")
elseif(HAIKU) elseif(HAIKU)
set(CMAKE_SYSROOT "${CROSS_ROOTFS}") set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin")
set(TOOLSET_PREFIX ${TOOLCHAIN}-) set(TOOLSET_PREFIX ${TOOLCHAIN}-)
function(locate_toolchain_exec exec var) function(locate_toolchain_exec exec var)
@ -185,10 +217,7 @@ elseif(HAIKU)
return() return()
endif() endif()
set(SEARCH_PATH "${CROSS_ROOTFS}/generated/cross-tools-x86_64/bin")
find_program(EXEC_LOCATION_${exec} find_program(EXEC_LOCATION_${exec}
PATHS ${SEARCH_PATH}
NAMES NAMES
"${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}"
"${TOOLSET_PREFIX}${exec}") "${TOOLSET_PREFIX}${exec}")
@ -241,7 +270,7 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
endif() endif()
elseif(TARGET_ARCH_NAME STREQUAL "arm64") elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64)$")
if(TIZEN) if(TIZEN)
add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64")
@ -253,8 +282,11 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64")
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}")
endif() endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86") elseif(TARGET_ARCH_NAME STREQUAL "x86")
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
add_toolchain_linker_flag("--target=${TOOLCHAIN}")
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}")
endif()
add_toolchain_linker_flag(-m32) add_toolchain_linker_flag(-m32)
if(TIZEN) if(TIZEN)
add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib")
@ -264,11 +296,14 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
elseif(ILLUMOS) elseif(ILLUMOS)
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib")
elseif(HAIKU)
add_toolchain_linker_flag("-lnetwork")
add_toolchain_linker_flag("-lroot")
endif() endif()
# Specify compile options # Specify compile options
if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU) if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU)
set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
@ -287,10 +322,16 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
# persist variables across multiple try_compile passes
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLR_ARM_FPU_TYPE CLR_ARM_FPU_CAPABILITY)
if(TARGET_ARCH_NAME STREQUAL "armel") if(TARGET_ARCH_NAME STREQUAL "armel")
add_compile_options(-mfloat-abi=softfp) add_compile_options(-mfloat-abi=softfp)
endif() endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86") elseif(TARGET_ARCH_NAME STREQUAL "x86")
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
add_compile_options(--target=${TOOLCHAIN})
endif()
add_compile_options(-m32) add_compile_options(-m32)
add_compile_options(-Wno-error=unused-command-line-argument) add_compile_options(-Wno-error=unused-command-line-argument)
endif() endif()

4
eng/common/dotnet-install.sh

@ -54,6 +54,10 @@ cpuname=$(uname -m)
case $cpuname in case $cpuname in
arm64|aarch64) arm64|aarch64)
buildarch=arm64 buildarch=arm64
if [ "$(getconf LONG_BIT)" -lt 64 ]; then
# This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS)
buildarch=arm
fi
;; ;;
loongarch64) loongarch64)
buildarch=loongarch64 buildarch=loongarch64

53
eng/common/generate-locproject.ps1

@ -34,6 +34,25 @@ $jsonTemplateFiles | ForEach-Object {
$jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern $jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
$wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them $wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them
if (-not $wxlFiles) {
$wxlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\1033\\.+\.wxl" } # pick up en files (1033 = en) specifically so we can copy them to use as the neutral xlf files
if ($wxlEnFiles) {
$wxlFiles = @()
$wxlEnFiles | ForEach-Object {
$destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)"
$wxlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
}
}
}
$macosHtmlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\.lproj\\.+\.html$" } # add installer HTML files
$macosHtmlFiles = @()
if ($macosHtmlEnFiles) {
$macosHtmlEnFiles | ForEach-Object {
$destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)"
$macosHtmlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
}
}
$xlfFiles = @() $xlfFiles = @()
@ -91,6 +110,7 @@ $locJson = @{
) )
}, },
@{ @{
LanguageSet = $LanguageSet
CloneLanguageSet = "WiX_CloneLanguages" CloneLanguageSet = "WiX_CloneLanguages"
LssFiles = @( "wxl_loc.lss" ) LssFiles = @( "wxl_loc.lss" )
LocItems = @( LocItems = @(
@ -98,8 +118,7 @@ $locJson = @{
$outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\"
$continue = $true $continue = $true
foreach ($exclusion in $exclusions.Exclusions) { foreach ($exclusion in $exclusions.Exclusions) {
if ($_.FullName.Contains($exclusion)) if ($_.FullName.Contains($exclusion)) {
{
$continue = $false $continue = $false
} }
} }
@ -110,11 +129,39 @@ $locJson = @{
SourceFile = $sourceFile SourceFile = $sourceFile
CopyOption = "LangIDOnPath" CopyOption = "LangIDOnPath"
OutputPath = $outputPath OutputPath = $outputPath
Languages = "cs-CZ;de-DE;es-ES;fr-FR;it-IT;ja-JP;ko-KR;pl-PL;pt-BR;ru-RU;tr-TR;zh-CN;zh-TW"
} }
} }
} }
) )
},
@{
LanguageSet = $LanguageSet
CloneLanguageSet = "VS_macOS_CloneLanguages"
LssFiles = @( ".\eng\common\loc\P22DotNetHtmlLocalization.lss" )
LocItems = @(
$macosHtmlFiles | ForEach-Object {
$outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\"
$continue = $true
foreach ($exclusion in $exclusions.Exclusions) {
if ($_.FullName.Contains($exclusion)) {
$continue = $false
}
}
$sourceFile = ($_.FullName | Resolve-Path -Relative)
$lciFile = $sourceFile + ".lci"
if ($continue) {
$result = @{
SourceFile = $sourceFile
CopyOption = "LangIDOnPath"
OutputPath = $outputPath
}
if (Test-Path $lciFile -PathType Leaf) {
$result["LciFile"] = $lciFile
}
return $result
}
}
)
} }
) )
} }

9
eng/common/init-tools-native.ps1

@ -83,7 +83,8 @@ try {
Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue
if ($NativeTools) { if ($NativeTools) {
if ($PathPromotion -eq $True) { if ($PathPromotion -eq $True) {
if ($env:SYSTEM_TEAMPROJECT) { # check to see if we're in an Azure pipelines build $ArcadeToolsDirectory = "$env:SYSTEMDRIVE\arcade-tools"
if (Test-Path $ArcadeToolsDirectory) { # if this directory exists, we should use native tools on machine
$NativeTools.PSObject.Properties | ForEach-Object { $NativeTools.PSObject.Properties | ForEach-Object {
$ToolName = $_.Name $ToolName = $_.Name
$ToolVersion = $_.Value $ToolVersion = $_.Value
@ -93,11 +94,6 @@ try {
if ($ToolVersion -eq "latest") { if ($ToolVersion -eq "latest") {
$ToolVersion = "" $ToolVersion = ""
} }
$ArcadeToolsDirectory = "C:\arcade-tools"
if (-not (Test-Path $ArcadeToolsDirectory)) {
Write-Error "Arcade tools directory '$ArcadeToolsDirectory' was not found; artifacts were not properly installed."
exit 1
}
$ToolDirectories = (Get-ChildItem -Path "$ArcadeToolsDirectory" -Filter "$ToolName-$ToolVersion*" | Sort-Object -Descending) $ToolDirectories = (Get-ChildItem -Path "$ArcadeToolsDirectory" -Filter "$ToolName-$ToolVersion*" | Sort-Object -Descending)
if ($ToolDirectories -eq $null) { if ($ToolDirectories -eq $null) {
Write-Error "Unable to find directory for $ToolName $ToolVersion; please make sure the tool is installed on this image." Write-Error "Unable to find directory for $ToolName $ToolVersion; please make sure the tool is installed on this image."
@ -125,6 +121,7 @@ try {
if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) {
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "$ToolName not found on path. Please install $ToolName $ToolVersion before proceeding." Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "$ToolName not found on path. Please install $ToolName $ToolVersion before proceeding."
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "If this is running on a build machine, the arcade-tools directory was not found, which means there's an error with the image."
} }
} }
exit 0 exit 0

29
eng/common/loc/P22DotNetHtmlLocalization.lss

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<LS_SETTINGS_FILE>
<LS_SETTINGS_DESCRIPTION>
<![CDATA[]]>
</LS_SETTINGS_DESCRIPTION>
<optionSet id="LSOptions">
<optionSet id="Defaults" displayName="Options Defaults">
<optionSet id="Espresso" displayName="Espresso"/>
<optionSet id="Parsers" displayName="Parsers"/>
</optionSet>
<optionSet id="User" displayName="User Overrides">
<optionSet id="Espresso" displayName="Espresso"/>
<optionSet id="Parsers" displayName="Parsers"/>
</optionSet>
<optionSet id="Project" displayName="Project Overrides">
<optionSet id="Espresso" displayName="Espresso"/>
<optionSet id="Parsers" displayName="Parsers">
<optionSet id="Parser 22" displayName="POMHTML Parser options" helpText="POMHTML Parser options for Localization Studio.">
<option id="SetCharsetInfo" displayName="Set or add Charset information when Generating" helpText="Add Charset information to the Generated file. This is in the format &lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=windows-1252&quot;&gt;. This is based on the Project Target Langauge. If the dir attribute value in the HTML tag i.e. &lt;HTML dir=&quot;ltr&quot;&gt; is not localizable or is missing, its value will be set automatically on Generate if the reading order of the target language is different from the source language.">
<boolean defaultValue="1" currentValue="0"/>
</option>
<option id="IncTermNoResId" displayName="Include Terms which have no Resource Identifier" helpText="Include Terms which have no Resource Identifier. Terms without Resource Identifiers cannot be Updated or Uploaded if they change.">
<boolean defaultValue="0" currentValue="1"/>
</option>
</optionSet>
</optionSet>
</optionSet>
</optionSet>
</LS_SETTINGS_FILE>

83
eng/common/native/init-compiler.sh

@ -1,30 +1,25 @@
#!/usr/bin/env bash #!/bin/sh
# #
# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables # This file detects the C/C++ compiler and exports it to the CC/CXX environment variables
# #
# NOTE: some scripts source this file and rely on stdout being empty, make sure to not output anything here! # NOTE: some scripts source this file and rely on stdout being empty, make sure to not output anything here!
if [[ "$#" -lt 3 ]]; then if [ -z "$build_arch" ] || [ -z "$compiler" ]; then
echo "Usage..." echo "Usage..."
echo "init-compiler.sh <script directory> <Architecture> <compiler>" echo "build_arch=<ARCH> compiler=<NAME> init-compiler.sh"
echo "Specify the script directory."
echo "Specify the target architecture." echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)." echo "Specify the name of compiler (clang or gcc)."
exit 1 exit 1
fi fi
nativescriptroot="$1"
build_arch="$2"
compiler="$3"
case "$compiler" in case "$compiler" in
clang*|-clang*|--clang*) clang*|-clang*|--clang*)
# clangx.y or clang-x.y # clangx.y or clang-x.y
version="$(echo "$compiler" | tr -d '[:alpha:]-=')" version="$(echo "$compiler" | tr -d '[:alpha:]-=')"
parts=(${version//./ }) majorVersion="${version%%.*}"
majorVersion="${parts[0]}" [ -z "${version##*.*}" ] && minorVersion="${version#*.}"
minorVersion="${parts[1]}"
if [[ -z "$minorVersion" && "$majorVersion" -le 6 ]]; then if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then
minorVersion=0; minorVersion=0;
fi fi
compiler=clang compiler=clang
@ -33,23 +28,20 @@ case "$compiler" in
gcc*|-gcc*|--gcc*) gcc*|-gcc*|--gcc*)
# gccx.y or gcc-x.y # gccx.y or gcc-x.y
version="$(echo "$compiler" | tr -d '[:alpha:]-=')" version="$(echo "$compiler" | tr -d '[:alpha:]-=')"
parts=(${version//./ }) majorVersion="${version%%.*}"
majorVersion="${parts[0]}" [ -z "${version##*.*}" ] && minorVersion="${version#*.}"
minorVersion="${parts[1]}"
compiler=gcc compiler=gcc
;; ;;
esac esac
cxxCompiler="$compiler++" cxxCompiler="$compiler++"
. "$nativescriptroot"/../pipeline-logging-functions.sh
# clear the existing CC and CXX from environment # clear the existing CC and CXX from environment
CC= CC=
CXX= CXX=
LDFLAGS= LDFLAGS=
if [[ "$compiler" == "gcc" ]]; then cxxCompiler="g++"; fi if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi
check_version_exists() { check_version_exists() {
desired_version=-1 desired_version=-1
@ -66,40 +58,41 @@ check_version_exists() {
echo "$desired_version" echo "$desired_version"
} }
if [[ -z "$CLR_CC" ]]; then if [ -z "$CLR_CC" ]; then
# Set default versions # Set default versions
if [[ -z "$majorVersion" ]]; then if [ -z "$majorVersion" ]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [[ "$compiler" == "clang" ]]; then versions=( 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) if [ "$compiler" = "clang" ]; then versions="17 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5"
elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi elif [ "$compiler" = "gcc" ]; then versions="13 12 11 10 9 8 7 6 5 4.9"; fi
for version in "${versions[@]}"; do for version in $versions; do
parts=(${version//./ }) _major="${version%%.*}"
desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")" [ -z "${version##*.*}" ] && _minor="${version#*.}"
if [[ "$desired_version" != "-1" ]]; then majorVersion="${parts[0]}"; break; fi desired_version="$(check_version_exists "$_major" "$_minor")"
if [ "$desired_version" != "-1" ]; then majorVersion="$_major"; break; fi
done done
if [[ -z "$majorVersion" ]]; then if [ -z "$majorVersion" ]; then
if command -v "$compiler" > /dev/null; then if command -v "$compiler" > /dev/null; then
if [[ "$(uname)" != "Darwin" ]]; then if [ "$(uname)" != "Darwin" ]; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH." echo "Warning: Specific version of $compiler not found, falling back to use the one in PATH."
fi fi
CC="$(command -v "$compiler")" CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")" CXX="$(command -v "$cxxCompiler")"
else else
Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found." echo "No usable version of $compiler found."
exit 1 exit 1
fi fi
else else
if [[ "$compiler" == "clang" && "$majorVersion" -lt 5 ]]; then if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
if [[ "$build_arch" == "arm" || "$build_arch" == "armel" ]]; then if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
if command -v "$compiler" > /dev/null; then if command -v "$compiler" > /dev/null; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH." echo "Warning: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
CC="$(command -v "$compiler")" CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")" CXX="$(command -v "$cxxCompiler")"
else else
Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." echo "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
exit 1 exit 1
fi fi
fi fi
@ -107,33 +100,33 @@ if [[ -z "$CLR_CC" ]]; then
fi fi
else else
desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
if [[ "$desired_version" == "-1" ]]; then if [ "$desired_version" = "-1" ]; then
Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion." echo "Could not find specific version of $compiler: $majorVersion $minorVersion."
exit 1 exit 1
fi fi
fi fi
if [[ -z "$CC" ]]; then if [ -z "$CC" ]; then
CC="$(command -v "$compiler$desired_version")" CC="$(command -v "$compiler$desired_version")"
CXX="$(command -v "$cxxCompiler$desired_version")" CXX="$(command -v "$cxxCompiler$desired_version")"
if [[ -z "$CXX" ]]; then CXX="$(command -v "$cxxCompiler")"; fi if [ -z "$CXX" ]; then CXX="$(command -v "$cxxCompiler")"; fi
fi fi
else else
if [[ ! -f "$CLR_CC" ]]; then if [ ! -f "$CLR_CC" ]; then
Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist" echo "CLR_CC is set but path '$CLR_CC' does not exist"
exit 1 exit 1
fi fi
CC="$CLR_CC" CC="$CLR_CC"
CXX="$CLR_CXX" CXX="$CLR_CXX"
fi fi
if [[ -z "$CC" ]]; then if [ -z "$CC" ]; then
Write-PipelineTelemetryError -category "Build" "Unable to find $compiler." echo "Unable to find $compiler."
exit 1 exit 1
fi fi
# Only lld version >= 9 can be considered stable # Only lld version >= 9 can be considered stable. lld doesn't support s390x.
if [[ "$compiler" == "clang" && "$majorVersion" -ge 9 ]]; then if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && [ "$build_arch" != "s390x" ]; then
if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
LDFLAGS="-fuse-ld=lld" LDFLAGS="-fuse-ld=lld"
fi fi

130
eng/common/native/init-distro-rid.sh

@ -0,0 +1,130 @@
#!/usr/bin/env bash
# getNonPortableDistroRid
#
# Input:
# targetOs: (str)
# targetArch: (str)
# rootfsDir: (str)
#
# Return:
# non-portable rid
getNonPortableDistroRid()
{
local targetOs="$1"
local targetArch="$2"
local rootfsDir="$3"
local nonPortableRid=""
if [ "$targetOs" = "linux" ]; then
if [ -e "${rootfsDir}/etc/os-release" ]; then
source "${rootfsDir}/etc/os-release"
if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then
# remove the last version digit
VERSION_ID="${VERSION_ID%.*}"
fi
if [[ "${VERSION_ID:-}" =~ ^([[:digit:]]|\.)+$ ]]; then
nonPortableRid="${ID}.${VERSION_ID}-${targetArch}"
else
# Rolling release distros either do not set VERSION_ID, set it as blank or
# set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux);
# so omit it here to be consistent with everything else.
nonPortableRid="${ID}-${targetArch}"
fi
elif [ -e "${rootfsDir}/android_platform" ]; then
source "$rootfsDir"/android_platform
nonPortableRid="$RID"
fi
fi
if [ "$targetOs" = "freebsd" ]; then
# $rootfsDir can be empty. freebsd-version is shell script and it should always work.
__freebsd_major_version=$($rootfsDir/bin/freebsd-version | { read v; echo "${v%%.*}"; })
nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}"
elif command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then
__android_sdk_version=$(getprop ro.build.version.sdk)
nonPortableRid="android.$__android_sdk_version-${targetArch}"
elif [ "$targetOs" = "illumos" ]; then
__uname_version=$(uname -v)
case "$__uname_version" in
omnios-*)
__omnios_major_version=$(echo "${__uname_version:8:2}")
nonPortableRid=omnios."$__omnios_major_version"-"$targetArch"
;;
joyent_*)
__smartos_major_version=$(echo "${__uname_version:7:4}")
nonPortableRid=smartos."$__smartos_major_version"-"$targetArch"
;;
illumos_*)
nonPortableRid=openindiana-"$targetArch"
;;
esac
elif [ "$targetOs" = "solaris" ]; then
__uname_version=$(uname -v)
__solaris_major_version=$(echo "${__uname_version%.*}")
nonPortableRid=solaris."$__solaris_major_version"-"$targetArch"
elif [ "$targetOs" = "haiku" ]; then
__uname_release=$(uname -r)
nonPortableRid=haiku.r"$__uname_release"-"$targetArch"
fi
echo "$(echo $nonPortableRid | tr '[:upper:]' '[:lower:]')"
}
# initDistroRidGlobal
#
# Input:
# os: (str)
# arch: (str)
# rootfsDir?: (nullable:string)
#
# Return:
# None
#
# Notes:
#
# It is important to note that the function does not return anything, but it
# exports the following variables on success:
#
# __DistroRid : Non-portable rid of the target platform.
# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform.
#
initDistroRidGlobal()
{
local targetOs="$1"
local targetArch="$2"
local rootfsDir=""
if [ "$#" -ge 3 ]; then
rootfsDir="$3"
fi
if [ -n "${rootfsDir}" ]; then
# We may have a cross build. Check for the existence of the rootfsDir
if [ ! -e "${rootfsDir}" ]; then
echo "Error rootfsDir has been passed, but the location is not valid."
exit 1
fi
fi
__DistroRid=$(getNonPortableDistroRid "${targetOs}" "${targetArch}" "${rootfsDir}")
if [ -z "${__PortableTargetOS:-}" ]; then
__PortableTargetOS="$targetOs"
STRINGS="$(command -v strings || true)"
if [ -z "$STRINGS" ]; then
STRINGS="$(command -v llvm-strings || true)"
fi
# Check for musl-based distros (e.g Alpine Linux, Void Linux).
if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl ||
( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then
__PortableTargetOS="linux-musl"
fi
fi
export __DistroRid __PortableTargetOS
}

80
eng/common/native/init-os-and-arch.sh

@ -0,0 +1,80 @@
#!/usr/bin/env bash
# Use uname to determine what the OS is.
OSName=$(uname -s | tr '[:upper:]' '[:lower:]')
if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then
OSName="android"
fi
case "$OSName" in
freebsd|linux|netbsd|openbsd|sunos|android|haiku)
os="$OSName" ;;
darwin)
os=osx ;;
*)
echo "Unsupported OS $OSName detected!"
exit 1 ;;
esac
# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html
# and `uname -p` returns processor type (e.g. i386 on amd64).
# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html.
if [ "$os" = "sunos" ]; then
if uname -o 2>&1 | grep -q illumos; then
os="illumos"
else
os="solaris"
fi
CPUName=$(isainfo -n)
else
# For the rest of the operating systems, use uname(1) to determine what the CPU is.
CPUName=$(uname -m)
fi
case "$CPUName" in
arm64|aarch64)
arch=arm64
;;
loongarch64)
arch=loongarch64
;;
riscv64)
arch=riscv64
;;
amd64|x86_64)
arch=x64
;;
armv7l|armv8l)
if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
arch=armel
else
arch=arm
fi
;;
armv6l)
arch=armv6
;;
i[3-6]86)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
arch=x86
;;
s390x)
arch=s390x
;;
ppc64le)
arch=ppc64le
;;
*)
echo "Unknown CPU $CPUName detected!"
exit 1
;;
esac

2
eng/common/sdk-task.ps1

@ -64,7 +64,7 @@ try {
$GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty
} }
if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) {
$GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.3.1" -MemberType NoteProperty $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.8.1-2" -MemberType NoteProperty
} }
if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") {
$xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true

5
eng/common/sdl/NuGet.config

@ -7,6 +7,11 @@
<clear /> <clear />
<add key="guardian" value="https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json" /> <add key="guardian" value="https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json" />
</packageSources> </packageSources>
<packageSourceMapping>
<packageSource key="guardian">
<package pattern="microsoft.guardian.cli" />
</packageSource>
</packageSourceMapping>
<disabledPackageSources> <disabledPackageSources>
<clear /> <clear />
</disabledPackageSources> </disabledPackageSources>

42
eng/common/sdl/configure-sdl-tool.ps1

@ -17,7 +17,9 @@ Param(
# Optional: Additional params to add to any tool using PoliCheck. # Optional: Additional params to add to any tool using PoliCheck.
[string[]] $PoliCheckAdditionalRunConfigParams, [string[]] $PoliCheckAdditionalRunConfigParams,
# Optional: Additional params to add to any tool using CodeQL/Semmle. # Optional: Additional params to add to any tool using CodeQL/Semmle.
[string[]] $CodeQLAdditionalRunConfigParams [string[]] $CodeQLAdditionalRunConfigParams,
# Optional: Additional params to add to any tool using Binskim.
[string[]] $BinskimAdditionalRunConfigParams
) )
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
@ -69,22 +71,34 @@ try {
$gdnConfigFile = Join-Path $gdnConfigPath "$toolConfigName-configure.gdnconfig" $gdnConfigFile = Join-Path $gdnConfigPath "$toolConfigName-configure.gdnconfig"
# For some tools, add default and automatic args. # For some tools, add default and automatic args.
if ($tool.Name -eq 'credscan') { switch -Exact ($tool.Name) {
if ($targetDirectory) { 'credscan' {
$tool.Args += "`"TargetDirectory < $TargetDirectory`"" if ($targetDirectory) {
$tool.Args += "`"TargetDirectory < $TargetDirectory`""
}
$tool.Args += "`"OutputType < pre`""
$tool.Args += $CrScanAdditionalRunConfigParams
} }
$tool.Args += "`"OutputType < pre`"" 'policheck' {
$tool.Args += $CrScanAdditionalRunConfigParams if ($targetDirectory) {
} elseif ($tool.Name -eq 'policheck') { $tool.Args += "`"Target < $TargetDirectory`""
if ($targetDirectory) { }
$tool.Args += "`"Target < $TargetDirectory`"" $tool.Args += $PoliCheckAdditionalRunConfigParams
} }
$tool.Args += $PoliCheckAdditionalRunConfigParams {$_ -in 'semmle', 'codeql'} {
} elseif ($tool.Name -eq 'semmle' -or $tool.Name -eq 'codeql') { if ($targetDirectory) {
if ($targetDirectory) { $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`""
$tool.Args += "`"SourceCodeDirectory < $TargetDirectory`"" }
$tool.Args += $CodeQLAdditionalRunConfigParams
}
'binskim' {
if ($targetDirectory) {
# Binskim crashes due to specific PDBs. GitHub issue: https://github.com/microsoft/binskim/issues/924.
# We are excluding all `_.pdb` files from the scan.
$tool.Args += "`"Target < $TargetDirectory\**;-:file|$TargetDirectory\**\_.pdb`""
}
$tool.Args += $BinskimAdditionalRunConfigParams
} }
$tool.Args += $CodeQLAdditionalRunConfigParams
} }
# Create variable pointing to the args array directly so we can use splat syntax later. # Create variable pointing to the args array directly so we can use splat syntax later.

4
eng/common/sdl/execute-all-sdl-tools.ps1

@ -35,6 +35,7 @@ Param(
[string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") [string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
[string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1") [string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1")
[string[]] $BinskimAdditionalRunConfigParams, # Optional: Additional Params to custom build a Binskim run config in the format @("xyz < abc","sdf < 1")
[bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run [bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run
) )
@ -107,7 +108,8 @@ try {
-GuardianLoggerLevel $GuardianLoggerLevel ` -GuardianLoggerLevel $GuardianLoggerLevel `
-CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams ` -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams `
-PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams ` -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams `
-CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams -CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams `
-BinskimAdditionalRunConfigParams $BinskimAdditionalRunConfigParams
if ($BreakOnFailure) { if ($BreakOnFailure) {
Exit-IfNZEC "Sdl" Exit-IfNZEC "Sdl"
} }

20
eng/common/sdl/extract-artifact-packages.ps1

@ -35,31 +35,33 @@ try {
param( param(
[string] $PackagePath # Full path to a NuGet package [string] $PackagePath # Full path to a NuGet package
) )
if (!(Test-Path $PackagePath)) { if (!(Test-Path $PackagePath)) {
Write-PipelineTelemetryError -Category 'Build' -Message "Input file does not exist: $PackagePath" Write-PipelineTelemetryError -Category 'Build' -Message "Input file does not exist: $PackagePath"
ExitWithExitCode 1 ExitWithExitCode 1
} }
$RelevantExtensions = @('.dll', '.exe', '.pdb') $RelevantExtensions = @('.dll', '.exe', '.pdb')
Write-Host -NoNewLine 'Extracting ' ([System.IO.Path]::GetFileName($PackagePath)) '...' Write-Host -NoNewLine 'Extracting ' ([System.IO.Path]::GetFileName($PackagePath)) '...'
$PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath)
$ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId
Add-Type -AssemblyName System.IO.Compression.FileSystem Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Directory]::CreateDirectory($ExtractPath); [System.IO.Directory]::CreateDirectory($ExtractPath);
try { try {
$zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath)
$zip.Entries | $zip.Entries |
Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} |
ForEach-Object { ForEach-Object {
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.Name $TargetPath = Join-Path -Path $ExtractPath -ChildPath (Split-Path -Path $_.FullName)
[System.IO.Directory]::CreateDirectory($TargetPath);
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true)
$TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.FullName
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile)
} }
} }
catch { catch {

1
eng/common/sdl/sdl.ps1

@ -1,6 +1,7 @@
function Install-Gdn { function Install-Gdn {
param( param(
[Parameter(Mandatory=$true)]
[string]$Path, [string]$Path,
# If omitted, install the latest version of Guardian, otherwise install that specific version. # If omitted, install the latest version of Guardian, otherwise install that specific version.

75
eng/common/sdl/trim-assets-version.ps1

@ -0,0 +1,75 @@
<#
.SYNOPSIS
Install and run the 'Microsoft.DotNet.VersionTools.Cli' tool with the 'trim-artifacts-version' command to trim the version from the NuGet assets file name.
.PARAMETER InputPath
Full path to directory where artifact packages are stored
.PARAMETER Recursive
Search for NuGet packages recursively
#>
Param(
[string] $InputPath,
[bool] $Recursive = $true
)
$CliToolName = "Microsoft.DotNet.VersionTools.Cli"
function Install-VersionTools-Cli {
param(
[Parameter(Mandatory=$true)][string]$Version
)
Write-Host "Installing the package '$CliToolName' with a version of '$version' ..."
$feed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"
$argumentList = @("tool", "install", "--local", "$CliToolName", "--add-source $feed", "--no-cache", "--version $Version", "--create-manifest-if-needed")
Start-Process "$dotnet" -Verbose -ArgumentList $argumentList -NoNewWindow -Wait
}
# -------------------------------------------------------------------
if (!(Test-Path $InputPath)) {
Write-Host "Input Path '$InputPath' does not exist"
ExitWithExitCode 1
}
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2.0
$disableConfigureToolsetImport = $true
$global:LASTEXITCODE = 0
# `tools.ps1` checks $ci to perform some actions. Since the SDL
# scripts don't necessarily execute in the same agent that run the
# build.ps1/sh script this variable isn't automatically set.
$ci = $true
. $PSScriptRoot\..\tools.ps1
try {
$dotnetRoot = InitializeDotNetCli -install:$true
$dotnet = "$dotnetRoot\dotnet.exe"
$toolsetVersion = Read-ArcadeSdkVersion
Install-VersionTools-Cli -Version $toolsetVersion
$cliToolFound = (& "$dotnet" tool list --local | Where-Object {$_.Split(' ')[0] -eq $CliToolName})
if ($null -eq $cliToolFound) {
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "The '$CliToolName' tool is not installed."
ExitWithExitCode 1
}
Exec-BlockVerbosely {
& "$dotnet" $CliToolName trim-assets-version `
--assets-path $InputPath `
--recursive $Recursive
Exit-IfNZEC "Sdl"
}
}
catch {
Write-Host $_
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_
ExitWithExitCode 1
}

14
eng/common/templates/job/execute-sdl.yml

@ -34,7 +34,7 @@ jobs:
- job: Run_SDL - job: Run_SDL
dependsOn: ${{ parameters.dependsOn }} dependsOn: ${{ parameters.dependsOn }}
displayName: Run SDL tool displayName: Run SDL tool
condition: eq( ${{ parameters.enable }}, 'true') condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true'))
variables: variables:
- group: DotNet-VSTS-Bot - group: DotNet-VSTS-Bot
- name: AzDOProjectName - name: AzDOProjectName
@ -46,6 +46,7 @@ jobs:
- template: /eng/common/templates/variables/sdl-variables.yml - template: /eng/common/templates/variables/sdl-variables.yml
- name: GuardianVersion - name: GuardianVersion
value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
- template: /eng/common/templates/variables/pool-providers.yml
pool: pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
@ -53,13 +54,15 @@ jobs:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
- checkout: self - checkout: self
clean: true clean: true
- template: /eng/common/templates/post-build/setup-maestro-vars.yml # If the template caller didn't provide an AzDO parameter, set them all up as Maestro vars.
- ${{ if not(and(parameters.AzDOProjectName, parameters.AzDOPipelineId, parameters.AzDOBuildId)) }}:
- template: /eng/common/templates/post-build/setup-maestro-vars.yml
- ${{ if ne(parameters.downloadArtifacts, 'false')}}: - ${{ if ne(parameters.downloadArtifacts, 'false')}}:
- ${{ if ne(parameters.artifactNames, '') }}: - ${{ if ne(parameters.artifactNames, '') }}:
@ -102,6 +105,11 @@ jobs:
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
checkDownloadedFiles: true checkDownloadedFiles: true
- powershell: eng/common/sdl/trim-assets-version.ps1
-InputPath $(Build.ArtifactStagingDirectory)\artifacts
displayName: Trim the version from the NuGet packages
continueOnError: ${{ parameters.sdlContinueOnError }}
- powershell: eng/common/sdl/extract-artifact-packages.ps1 - powershell: eng/common/sdl/extract-artifact-packages.ps1
-InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts
-ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts

90
eng/common/templates/job/job.yml

@ -24,7 +24,9 @@ parameters:
enablePublishBuildAssets: false enablePublishBuildAssets: false
enablePublishTestResults: false enablePublishTestResults: false
enablePublishUsingPipelines: false enablePublishUsingPipelines: false
disableComponentGovernance: false enableBuildRetry: false
disableComponentGovernance: ''
componentGovernanceIgnoreDirectories: ''
mergeTestResults: false mergeTestResults: false
testRunTitle: '' testRunTitle: ''
testResultsFormat: '' testResultsFormat: ''
@ -73,6 +75,10 @@ jobs:
- ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}:
- name: EnableRichCodeNavigation - name: EnableRichCodeNavigation
value: 'true' value: 'true'
# Retry signature validation up to three times, waiting 2 seconds between attempts.
# See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures
- name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY
value: 3,2000
- ${{ each variable in parameters.variables }}: - ${{ each variable in parameters.variables }}:
# handle name-value variable syntax # handle name-value variable syntax
# example: # example:
@ -81,15 +87,25 @@ jobs:
- ${{ if ne(variable.name, '') }}: - ${{ if ne(variable.name, '') }}:
- name: ${{ variable.name }} - name: ${{ variable.name }}
value: ${{ variable.value }} value: ${{ variable.value }}
# handle variable groups # handle variable groups
- ${{ if ne(variable.group, '') }}: - ${{ if ne(variable.group, '') }}:
- group: ${{ variable.group }} - group: ${{ variable.group }}
# handle template variable syntax
# example:
# - template: path/to/template.yml
# parameters:
# [key]: [value]
- ${{ if ne(variable.template, '') }}:
- template: ${{ variable.template }}
${{ if ne(variable.parameters, '') }}:
parameters: ${{ variable.parameters }}
# handle key-value variable syntax. # handle key-value variable syntax.
# example: # example:
# - [key]: [value] # - [key]: [value]
- ${{ if and(eq(variable.name, ''), eq(variable.group, '')) }}: - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}:
- ${{ each pair in variable }}: - ${{ each pair in variable }}:
- name: ${{ pair.key }} - name: ${{ pair.key }}
value: ${{ pair.value }} value: ${{ pair.value }}
@ -122,7 +138,7 @@ jobs:
- ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}:
- task: NuGetAuthenticate@0 - task: NuGetAuthenticate@0
- ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}:
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
buildType: current buildType: current
@ -140,23 +156,31 @@ jobs:
languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }}
environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }}
richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin
uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }}
continueOnError: true continueOnError: true
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), ne(parameters.disableComponentGovernance, 'true')) }}: - template: /eng/common/templates/steps/component-governance.yml
- task: ComponentGovernanceComponentDetection@0 parameters:
continueOnError: true ${{ if eq(parameters.disableComponentGovernance, '') }}:
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}:
disableComponentGovernance: false
${{ else }}:
disableComponentGovernance: true
${{ else }}:
disableComponentGovernance: ${{ parameters.disableComponentGovernance }}
componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }}
- ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if eq(parameters.enableMicrobuild, 'true') }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: MicroBuildCleanup@1 - task: MicroBuildCleanup@1
displayName: Execute Microbuild cleanup tasks displayName: Execute Microbuild cleanup tasks
condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))
continueOnError: ${{ parameters.continueOnError }} continueOnError: ${{ parameters.continueOnError }}
env: env:
TeamName: $(_TeamName) TeamName: $(_TeamName)
- ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if ne(parameters.artifacts.publish, '') }}:
- ${{ if or(eq(parameters.artifacts.publish.artifacts, 'true'), ne(parameters.artifacts.publish.artifacts, '')) }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}:
- task: CopyFiles@2 - task: CopyFiles@2
displayName: Gather binaries for publish to artifacts displayName: Gather binaries for publish to artifacts
inputs: inputs:
@ -177,30 +201,12 @@ jobs:
ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }}
continueOnError: true continueOnError: true
condition: always() condition: always()
- ${{ if or(eq(parameters.artifacts.publish.logs, 'true'), ne(parameters.artifacts.publish.logs, '')) }}: - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}:
- publish: artifacts/log - publish: artifacts/log
artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }}
displayName: Publish logs displayName: Publish logs
continueOnError: true continueOnError: true
condition: always() condition: always()
- ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}:
- ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: CopyFiles@2
displayName: Gather Asset Manifests
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest'
TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests'
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
- task: PublishBuildArtifacts@1
displayName: Push Asset Manifests
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests'
PublishLocation: Container
ArtifactName: AssetManifests
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
- ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}:
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
@ -217,7 +223,7 @@ jobs:
displayName: Publish XUnit Test Results displayName: Publish XUnit Test Results
inputs: inputs:
testResultsFormat: 'xUnit' testResultsFormat: 'xUnit'
testResultsFiles: '*.xml' testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit
mergeTestResults: ${{ parameters.mergeTestResults }} mergeTestResults: ${{ parameters.mergeTestResults }}
@ -228,34 +234,22 @@ jobs:
displayName: Publish TRX Test Results displayName: Publish TRX Test Results
inputs: inputs:
testResultsFormat: 'VSTest' testResultsFormat: 'VSTest'
testResultsFiles: '*.trx' testResultsFiles: '*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx
mergeTestResults: ${{ parameters.mergeTestResults }} mergeTestResults: ${{ parameters.mergeTestResults }}
continueOnError: true continueOnError: true
condition: always() condition: always()
- ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: CopyFiles@2
displayName: Gather Asset Manifests
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest'
TargetFolder: '$(Build.StagingDirectory)/AssetManifests'
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
- task: PublishBuildArtifacts@1
displayName: Push Asset Manifests
inputs:
PathtoPublish: '$(Build.StagingDirectory)/AssetManifests'
PublishLocation: Container
ArtifactName: AssetManifests
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}:
- template: /eng/common/templates/steps/generate-sbom.yml - template: /eng/common/templates/steps/generate-sbom.yml
parameters: parameters:
PackageVersion: ${{ parameters.packageVersion}} PackageVersion: ${{ parameters.packageVersion}}
BuildDropPath: ${{ parameters.buildDropPath }} BuildDropPath: ${{ parameters.buildDropPath }}
IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }}
- ${{ if eq(parameters.enableBuildRetry, 'true') }}:
- publish: $(Build.SourcesDirectory)\eng\common\BuildConfiguration
artifact: BuildConfiguration
displayName: Publish build retry configuration
continueOnError: true

43
eng/common/templates/job/onelocbuild.yml

@ -14,6 +14,7 @@ parameters:
ReusePr: true ReusePr: true
UseLfLineEndings: true UseLfLineEndings: true
UseCheckedInLocProjectJson: false UseCheckedInLocProjectJson: false
SkipLocProjectJsonGeneration: false
LanguageSet: VS_Main_Languages LanguageSet: VS_Main_Languages
LclSource: lclFilesInRepo LclSource: lclFilesInRepo
LclPackageId: '' LclPackageId: ''
@ -22,13 +23,25 @@ parameters:
MirrorRepo: '' MirrorRepo: ''
MirrorBranch: main MirrorBranch: main
condition: '' condition: ''
JobNameSuffix: ''
jobs: jobs:
- job: OneLocBuild - job: OneLocBuild${{ parameters.JobNameSuffix }}
dependsOn: ${{ parameters.dependsOn }} dependsOn: ${{ parameters.dependsOn }}
displayName: OneLocBuild displayName: OneLocBuild${{ parameters.JobNameSuffix }}
variables:
- group: OneLocBuildVariables # Contains the CeapexPat and GithubPat
- name: _GenerateLocProjectArguments
value: -SourcesDirectory ${{ parameters.SourcesDirectory }}
-LanguageSet "${{ parameters.LanguageSet }}"
-CreateNeutralXlfs
- ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}:
- name: _GenerateLocProjectArguments
value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson
- template: /eng/common/templates/variables/pool-providers.yml
${{ if ne(parameters.pool, '') }}: ${{ if ne(parameters.pool, '') }}:
pool: ${{ parameters.pool }} pool: ${{ parameters.pool }}
@ -40,27 +53,17 @@ jobs:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
variables:
- group: OneLocBuildVariables # Contains the CeapexPat and GithubPat
- name: _GenerateLocProjectArguments
value: -SourcesDirectory ${{ parameters.SourcesDirectory }}
-LanguageSet "${{ parameters.LanguageSet }}"
-CreateNeutralXlfs
- ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}:
- name: _GenerateLocProjectArguments
value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson
steps: steps:
- task: Powershell@2 - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}:
inputs: - task: Powershell@2
filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 inputs:
arguments: $(_GenerateLocProjectArguments) filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1
displayName: Generate LocProject.json arguments: $(_GenerateLocProjectArguments)
condition: ${{ parameters.condition }} displayName: Generate LocProject.json
condition: ${{ parameters.condition }}
- task: OneLocBuild@2 - task: OneLocBuild@2
displayName: OneLocBuild displayName: OneLocBuild

20
eng/common/templates/job/publish-build-assets.yml

@ -34,15 +34,15 @@ jobs:
- job: Asset_Registry_Publish - job: Asset_Registry_Publish
dependsOn: ${{ parameters.dependsOn }} dependsOn: ${{ parameters.dependsOn }}
timeoutInMinutes: 150
${{ if eq(parameters.publishAssetsImmediately, 'true') }}: ${{ if eq(parameters.publishAssetsImmediately, 'true') }}:
displayName: Publish Assets displayName: Publish Assets
${{ else }}: ${{ else }}:
displayName: Publish to Build Asset Registry displayName: Publish to Build Asset Registry
pool: ${{ parameters.pool }}
variables: variables:
- template: /eng/common/templates/variables/pool-providers.yml
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: Publish-Build-Assets - group: Publish-Build-Assets
- group: AzureDevOps-Artifact-Feeds-Pats - group: AzureDevOps-Artifact-Feeds-Pats
@ -51,6 +51,16 @@ jobs:
- ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}:
- template: /eng/common/templates/post-build/common-variables.yml - template: /eng/common/templates/post-build/common-variables.yml
pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
name: VSEngSS-MicroBuild2022-1ES
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- task: DownloadBuildArtifacts@0 - task: DownloadBuildArtifacts@0
@ -64,12 +74,6 @@ jobs:
- task: NuGetAuthenticate@0 - task: NuGetAuthenticate@0
- task: PowerShell@2
displayName: Enable cross-org NuGet feed authentication
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-all-orgs-artifact-feeds-rw)
- task: PowerShell@2 - task: PowerShell@2
displayName: Publish Build Assets displayName: Publish Build Assets
inputs: inputs:

7
eng/common/templates/job/source-build.yml

@ -44,13 +44,16 @@ jobs:
${{ if eq(parameters.platform.pool, '') }}: ${{ if eq(parameters.platform.pool, '') }}:
# The default VM host AzDO pool. This should be capable of running Docker containers: almost all # The default VM host AzDO pool. This should be capable of running Docker containers: almost all
# source-build builds run in Docker, including the default managed platform. # source-build builds run in Docker, including the default managed platform.
# /eng/common/templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic
pool: pool:
${{ if eq(variables['System.TeamProject'], 'public') }}: ${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCore-Svc-Public name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')]
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
${{ if eq(variables['System.TeamProject'], 'internal') }}: ${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Svc-Internal name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')]
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
${{ if ne(parameters.platform.pool, '') }}: ${{ if ne(parameters.platform.pool, '') }}:
pool: ${{ parameters.platform.pool }} pool: ${{ parameters.platform.pool }}

11
eng/common/templates/job/source-index-stage1.yml

@ -1,6 +1,6 @@
parameters: parameters:
runAsPublic: false runAsPublic: false
sourceIndexPackageVersion: 1.0.1-20220804.1 sourceIndexPackageVersion: 1.0.1-20230228.2
sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
preSteps: [] preSteps: []
@ -22,16 +22,17 @@ jobs:
value: ${{ parameters.binlogPath }} value: ${{ parameters.binlogPath }}
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: source-dot-net stage1 variables - group: source-dot-net stage1 variables
- template: /eng/common/templates/variables/pool-providers.yml
${{ if ne(parameters.pool, '') }}: ${{ if ne(parameters.pool, '') }}:
pool: ${{ parameters.pool }} pool: ${{ parameters.pool }}
${{ if eq(parameters.pool, '') }}: ${{ if eq(parameters.pool, '') }}:
pool: pool:
${{ if eq(variables['System.TeamProject'], 'public') }}: ${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCore-Svc-Public name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64.open demands: ImageOverride -equals windows.vs2019.amd64.open
${{ if eq(variables['System.TeamProject'], 'internal') }}: ${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
@ -39,10 +40,10 @@ jobs:
- ${{ preStep }} - ${{ preStep }}
- task: UseDotNet@2 - task: UseDotNet@2
displayName: Use .NET Core sdk 3.1 displayName: Use .NET Core SDK 6
inputs: inputs:
packageType: sdk packageType: sdk
version: 3.1.x version: 6.0.x
installationPath: $(Agent.TempDirectory)/dotnet installationPath: $(Agent.TempDirectory)/dotnet
workingDirectory: $(Agent.TempDirectory) workingDirectory: $(Agent.TempDirectory)

9
eng/common/templates/jobs/jobs.yml

@ -88,15 +88,6 @@ jobs:
- ${{ job.job }} - ${{ job.job }}
- ${{ if eq(parameters.enableSourceBuild, true) }}: - ${{ if eq(parameters.enableSourceBuild, true) }}:
- Source_Build_Complete - Source_Build_Complete
pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
name: VSEngSS-MicroBuild2022-1ES
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
runAsPublic: ${{ parameters.runAsPublic }} runAsPublic: ${{ parameters.runAsPublic }}
publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }}

2
eng/common/templates/jobs/source-build.yml

@ -14,7 +14,7 @@ parameters:
# This is the default platform provided by Arcade, intended for use by a managed-only repo. # This is the default platform provided by Arcade, intended for use by a managed-only repo.
defaultManagedPlatform: defaultManagedPlatform:
name: 'Managed' name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-20220809204800-17a4aab' container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8'
# Defines the platforms on which to run build jobs. One job is created for each platform, and the # Defines the platforms on which to run build jobs. One job is created for each platform, and the
# object in this array is sent to the job template as 'platform'. If no platforms are specified, # object in this array is sent to the job template as 'platform'. If no platforms are specified,

4
eng/common/templates/post-build/common-variables.yml

@ -1,8 +1,4 @@
variables: variables:
- group: AzureDevOps-Artifact-Feeds-Pats
- group: DotNet-Blob-Feed
- group: DotNet-DotNetCli-Storage
- group: DotNet-MSRC-Storage
- group: Publish-Build-Assets - group: Publish-Build-Assets
# Whether the build is internal or not # Whether the build is internal or not

20
eng/common/templates/post-build/post-build.yml

@ -95,10 +95,11 @@ stages:
displayName: Validate Build Assets displayName: Validate Build Assets
variables: variables:
- template: common-variables.yml - template: common-variables.yml
- template: /eng/common/templates/variables/pool-providers.yml
jobs: jobs:
- job: - job:
displayName: NuGet Validation displayName: NuGet Validation
condition: eq( ${{ parameters.enableNugetValidation }}, 'true') condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true'))
pool: pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
@ -106,7 +107,7 @@ stages:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ else }}: ${{ else }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
@ -143,7 +144,7 @@ stages:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ else }}: ${{ else }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
- template: setup-maestro-vars.yml - template: setup-maestro-vars.yml
@ -171,12 +172,6 @@ stages:
- task: NuGetAuthenticate@0 - task: NuGetAuthenticate@0
displayName: 'Authenticate to AzDO Feeds' displayName: 'Authenticate to AzDO Feeds'
- task: PowerShell@2
displayName: Enable cross-org publishing
inputs:
filePath: eng\common\enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
# Signing validation will optionally work with the buildmanifest file which is downloaded from # Signing validation will optionally work with the buildmanifest file which is downloaded from
# Azure DevOps above. # Azure DevOps above.
- task: PowerShell@2 - task: PowerShell@2
@ -203,7 +198,7 @@ stages:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ else }}: ${{ else }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
- template: setup-maestro-vars.yml - template: setup-maestro-vars.yml
@ -251,6 +246,7 @@ stages:
displayName: Publish using Darc displayName: Publish using Darc
variables: variables:
- template: common-variables.yml - template: common-variables.yml
- template: /eng/common/templates/variables/pool-providers.yml
jobs: jobs:
- job: - job:
displayName: Publish Using Darc displayName: Publish Using Darc
@ -262,7 +258,7 @@ stages:
demands: Cmd demands: Cmd
# If it's not devdiv, it's dnceng # If it's not devdiv, it's dnceng
${{ else }}: ${{ else }}:
name: NetCore1ESPool-Svc-Internal name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2019.amd64 demands: ImageOverride -equals windows.vs2019.amd64
steps: steps:
- template: setup-maestro-vars.yml - template: setup-maestro-vars.yml
@ -282,4 +278,4 @@ stages:
-MaestroToken '$(MaestroApiAccessToken)' -MaestroToken '$(MaestroApiAccessToken)'
-WaitPublishingFinish true -WaitPublishingFinish true
-ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}'
-SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}'

13
eng/common/templates/steps/component-governance.yml

@ -0,0 +1,13 @@
parameters:
disableComponentGovernance: false
componentGovernanceIgnoreDirectories: ''
steps:
- ${{ if eq(parameters.disableComponentGovernance, 'true') }}:
- script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true"
displayName: Set skipComponentGovernanceDetection variable
- ${{ if ne(parameters.disableComponentGovernance, 'true') }}:
- task: ComponentGovernanceComponentDetection@0
continueOnError: true
inputs:
ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }}

8
eng/common/templates/steps/execute-sdl.yml

@ -17,21 +17,23 @@ steps:
- ${{ if ne(parameters.overrideGuardianVersion, '') }}: - ${{ if ne(parameters.overrideGuardianVersion, '') }}:
- pwsh: | - pwsh: |
. $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1 Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl
. .\sdl.ps1
$guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }}
Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
displayName: Install Guardian (Overridden) displayName: Install Guardian (Overridden)
- ${{ if eq(parameters.overrideGuardianVersion, '') }}: - ${{ if eq(parameters.overrideGuardianVersion, '') }}:
- pwsh: | - pwsh: |
. $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1 Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl
. .\sdl.ps1
$guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts
Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
displayName: Install Guardian displayName: Install Guardian
- ${{ if ne(parameters.overrideParameters, '') }}: - ${{ if ne(parameters.overrideParameters, '') }}:
- powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }}
displayName: Execute SDL displayName: Execute SDL (Overridden)
continueOnError: ${{ parameters.sdlContinueOnError }} continueOnError: ${{ parameters.sdlContinueOnError }}
condition: ${{ parameters.condition }} condition: ${{ parameters.condition }}

4
eng/common/templates/steps/generate-sbom.yml

@ -2,12 +2,14 @@
# PackageName - The name of the package this SBOM represents. # PackageName - The name of the package this SBOM represents.
# PackageVersion - The version of the package this SBOM represents. # PackageVersion - The version of the package this SBOM represents.
# ManifestDirPath - The path of the directory where the generated manifest files will be placed # ManifestDirPath - The path of the directory where the generated manifest files will be placed
# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector.
parameters: parameters:
PackageVersion: 7.0.0 PackageVersion: 7.0.0
BuildDropPath: '$(Build.SourcesDirectory)/artifacts' BuildDropPath: '$(Build.SourcesDirectory)/artifacts'
PackageName: '.NET' PackageName: '.NET'
ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom
IgnoreDirectories: ''
sbomContinueOnError: true sbomContinueOnError: true
steps: steps:
@ -34,6 +36,8 @@ steps:
BuildDropPath: ${{ parameters.buildDropPath }} BuildDropPath: ${{ parameters.buildDropPath }}
PackageVersion: ${{ parameters.packageVersion }} PackageVersion: ${{ parameters.packageVersion }}
ManifestDirPath: ${{ parameters.manifestDirPath }} ManifestDirPath: ${{ parameters.manifestDirPath }}
${{ if ne(parameters.IgnoreDirectories, '') }}:
AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}'
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: Publish SBOM manifest displayName: Publish SBOM manifest

29
eng/common/templates/steps/source-build.yml

@ -63,11 +63,26 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi fi
runtimeOsArgs=
if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
fi
baseOsArgs=
if [ '${{ parameters.platform.baseOS }}' != '' ]; then
baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}'
fi
publishArgs= publishArgs=
if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
publishArgs='--publish' publishArgs='--publish'
fi fi
assetManifestFileName=SourceBuild_RidSpecific.xml
if [ '${{ parameters.platform.name }}' != '' ]; then
assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml
fi
${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \
--configuration $buildConfig \ --configuration $buildConfig \
--restore --build --pack $publishArgs -bl \ --restore --build --pack $publishArgs -bl \
@ -75,8 +90,11 @@ steps:
$internalRuntimeDownloadArgs \ $internalRuntimeDownloadArgs \
$internalRestoreArgs \ $internalRestoreArgs \
$targetRidArgs \ $targetRidArgs \
$runtimeOsArgs \
$baseOsArgs \
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
/p:ArcadeBuildFromSource=true /p:ArcadeBuildFromSource=true \
/p:AssetManifestFileName=$assetManifestFileName
displayName: Build displayName: Build
# Upload build logs for diagnosis. # Upload build logs for diagnosis.
@ -100,3 +118,12 @@ steps:
artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt)
continueOnError: true continueOnError: true
condition: succeededOrFailed() condition: succeededOrFailed()
# Manually inject component detection so that we can ignore the source build upstream cache, which contains
# a nupkg cache of input packages (a local feed).
# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir'
# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection (Exclude upstream cache)
inputs:
ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/source-build/self/src/artifacts/obj/source-built-upstream-cache'

57
eng/common/templates/variables/pool-providers.yml

@ -0,0 +1,57 @@
# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool,
# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches.
# Motivation:
# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS
# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing
# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS.
# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services
# team needs to move resources around and create new and potentially differently-named pools. Using this template
# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming.
# How to use:
# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do).
# If we find alternate naming conventions in broad usage it can be added to the condition below.
#
# First, import the template in an arcade-ified repo to pick up the variables, e.g.:
#
# variables:
# - template: /eng/common/templates/variables/pool-providers.yml
#
# ... then anywhere specifying the pool provider use the runtime variables,
# $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.:
#
# pool:
# name: $(DncEngInternalBuildPool)
# demands: ImageOverride -equals windows.vs2019.amd64
variables:
# Coalesce the target and source branches so we know when a PR targets a release branch
# If these variables are somehow missing, fall back to main (tends to have more capacity)
# Any new -Svc alternative pools should have variables added here to allow for splitting work
- name: DncEngPublicBuildPool
value: $[
replace(
replace(
eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'),
True,
'NetCore-Svc-Public'
),
False,
'NetCore-Public'
)
]
- name: DncEngInternalBuildPool
value: $[
replace(
replace(
eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'),
True,
'NetCore1ESPool-Svc-Internal'
),
False,
'NetCore1ESPool-Internal'
)
]

61
eng/common/tools.ps1

@ -287,6 +287,25 @@ function InstallDotNet([string] $dotnetRoot,
[string] $runtimeSourceFeedKey = '', [string] $runtimeSourceFeedKey = '',
[switch] $noPath) { [switch] $noPath) {
$dotnetVersionLabel = "'sdk v$version'"
if ($runtime -ne '' -and $runtime -ne 'sdk') {
$runtimePath = $dotnetRoot
$runtimePath = $runtimePath + "\shared"
if ($runtime -eq "dotnet") { $runtimePath = $runtimePath + "\Microsoft.NETCore.App" }
if ($runtime -eq "aspnetcore") { $runtimePath = $runtimePath + "\Microsoft.AspNetCore.App" }
if ($runtime -eq "windowsdesktop") { $runtimePath = $runtimePath + "\Microsoft.WindowsDesktop.App" }
$runtimePath = $runtimePath + "\" + $version
$dotnetVersionLabel = "runtime toolset '$runtime/$architecture v$version'"
if (Test-Path $runtimePath) {
Write-Host " Runtime toolset '$runtime/$architecture v$version' already installed."
$installSuccess = $true
Exit
}
}
$installScript = GetDotNetInstallScript $dotnetRoot $installScript = GetDotNetInstallScript $dotnetRoot
$installParameters = @{ $installParameters = @{
Version = $version Version = $version
@ -323,18 +342,18 @@ function InstallDotNet([string] $dotnetRoot,
} else { } else {
$location = "public location"; $location = "public location";
} }
Write-Host "Attempting to install dotnet from $location." Write-Host " Attempting to install $dotnetVersionLabel from $location."
try { try {
& $installScript @variation & $installScript @variation
$installSuccess = $true $installSuccess = $true
break break
} }
catch { catch {
Write-Host "Failed to install dotnet from $location." Write-Host " Failed to install $dotnetVersionLabel from $location."
} }
} }
if (-not $installSuccess) { if (-not $installSuccess) {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from any of the specified locations." Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install $dotnetVersionLabel from any of the specified locations."
ExitWithExitCode 1 ExitWithExitCode 1
} }
} }
@ -360,13 +379,13 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
} }
# Minimum VS version to require. # Minimum VS version to require.
$vsMinVersionReqdStr = '16.8' $vsMinVersionReqdStr = '17.7'
$vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr)
# If the version of msbuild is going to be xcopied, # If the version of msbuild is going to be xcopied,
# use this version. Version matches a package here: # use this version. Version matches a package here:
# https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.3.1view=overview # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/RoslynTools.MSBuild/versions/17.8.1-2
$defaultXCopyMSBuildVersion = '17.3.1' $defaultXCopyMSBuildVersion = '17.8.1-2'
if (!$vsRequirements) { if (!$vsRequirements) {
if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
@ -399,7 +418,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
# Locate Visual Studio installation or download x-copy msbuild. # Locate Visual Studio installation or download x-copy msbuild.
$vsInfo = LocateVisualStudio $vsRequirements $vsInfo = LocateVisualStudio $vsRequirements
if ($vsInfo -ne $null) { if ($vsInfo -ne $null) {
$vsInstallDir = $vsInfo.installationPath # Ensure vsInstallDir has a trailing slash
$vsInstallDir = Join-Path $vsInfo.installationPath "\"
$vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0]
InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion
@ -413,6 +433,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
if($vsMinVersion -lt $vsMinVersionReqd){ if($vsMinVersion -lt $vsMinVersionReqd){
Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible"
$xcopyMSBuildVersion = $defaultXCopyMSBuildVersion $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion
$vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0]
} }
else{ else{
# If the VS version IS compatible, look for an xcopy msbuild package # If the VS version IS compatible, look for an xcopy msbuild package
@ -580,7 +601,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1 ExitWithExitCode 1
} }
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net7.0' } $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' }
} elseif ($msbuildEngine -eq "vs") { } elseif ($msbuildEngine -eq "vs") {
try { try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore $msbuildPath = InitializeVisualStudioMSBuild -install:$restore
@ -650,6 +671,10 @@ function InitializeNativeTools() {
} }
} }
function Read-ArcadeSdkVersion() {
return $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk'
}
function InitializeToolset() { function InitializeToolset() {
if (Test-Path variable:global:_ToolsetBuildProj) { if (Test-Path variable:global:_ToolsetBuildProj) {
return $global:_ToolsetBuildProj return $global:_ToolsetBuildProj
@ -657,7 +682,7 @@ function InitializeToolset() {
$nugetCache = GetNuGetPackageCachePath $nugetCache = GetNuGetPackageCachePath
$toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' $toolsetVersion = Read-ArcadeSdkVersion
$toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"
if (Test-Path $toolsetLocationFile) { if (Test-Path $toolsetLocationFile) {
@ -742,6 +767,8 @@ function MSBuild() {
(Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')), (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll')) (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll'))
) )
$selectedPath = $null $selectedPath = $null
foreach ($path in $possiblePaths) { foreach ($path in $possiblePaths) {
@ -815,7 +842,7 @@ function MSBuild-Core() {
} }
# When running on Azure Pipelines, override the returned exit code to avoid double logging. # When running on Azure Pipelines, override the returned exit code to avoid double logging.
if ($ci -and $env:BUILD_BUILDNUMBER -ne $null) { if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null) {
Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
@ -910,11 +937,13 @@ if (!$disableConfigureToolsetImport) {
function Enable-Nuget-EnhancedRetry() { function Enable-Nuget-EnhancedRetry() {
if ($ci) { if ($ci) {
Write-Host "Setting NUGET enhanced retry environment variables" Write-Host "Setting NUGET enhanced retry environment variables"
$env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' $env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true'
$env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 $env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6
$env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 $env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' $env:NUGET_RETRY_HTTP_429 = 'true'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true'
Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6'
Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true'
} }
} }

61
eng/common/tools.sh

@ -184,6 +184,35 @@ function InstallDotNetSdk {
function InstallDotNet { function InstallDotNet {
local root=$1 local root=$1
local version=$2 local version=$2
local runtime=$4
local dotnetVersionLabel="'$runtime v$version'"
if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then
runtimePath="$root"
runtimePath="$runtimePath/shared"
case "$runtime" in
dotnet)
runtimePath="$runtimePath/Microsoft.NETCore.App"
;;
aspnetcore)
runtimePath="$runtimePath/Microsoft.AspNetCore.App"
;;
windowsdesktop)
runtimePath="$runtimePath/Microsoft.WindowsDesktop.App"
;;
*)
;;
esac
runtimePath="$runtimePath/$version"
dotnetVersionLabel="runtime toolset '$runtime/$architecture v$version'"
if [ -d "$runtimePath" ]; then
echo " Runtime toolset '$runtime/$architecture v$version' already installed."
local installSuccess=1
return
fi
fi
GetDotNetInstallScript "$root" GetDotNetInstallScript "$root"
local install_script=$_GetDotNetInstallScript local install_script=$_GetDotNetInstallScript
@ -228,17 +257,17 @@ function InstallDotNet {
for variationName in "${variations[@]}"; do for variationName in "${variations[@]}"; do
local name="$variationName[@]" local name="$variationName[@]"
local variation=("${!name}") local variation=("${!name}")
echo "Attempting to install dotnet from $variationName." echo " Attempting to install $dotnetVersionLabel from $variationName."
bash "$install_script" "${variation[@]}" && installSuccess=1 bash "$install_script" "${variation[@]}" && installSuccess=1
if [[ "$installSuccess" -eq 1 ]]; then if [[ "$installSuccess" -eq 1 ]]; then
break break
fi fi
echo "Failed to install dotnet from $variationName." echo " Failed to install $dotnetVersionLabel from $variationName."
done done
if [[ "$installSuccess" -eq 0 ]]; then if [[ "$installSuccess" -eq 0 ]]; then
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from any of the specified locations." Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install $dotnetVersionLabel from any of the specified locations."
ExitWithExitCode 1 ExitWithExitCode 1
fi fi
} }
@ -312,7 +341,7 @@ function InitializeBuildTool {
# return values # return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild" _InitializeBuildToolCommand="msbuild"
_InitializeBuildToolFramework="net7.0" _InitializeBuildToolFramework="net8.0"
} }
# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 # Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
@ -416,13 +445,6 @@ function MSBuild {
export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20
Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20"
Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20"
export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true
export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6
export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000
Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true"
Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6"
Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000"
fi fi
local toolset_dir="${_InitializeToolset%/*}" local toolset_dir="${_InitializeToolset%/*}"
@ -435,6 +457,8 @@ function MSBuild {
possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" )
for path in "${possiblePaths[@]}"; do for path in "${possiblePaths[@]}"; do
if [[ -f $path ]]; then if [[ -f $path ]]; then
selectedPath=$path selectedPath=$path
@ -481,7 +505,7 @@ function MSBuild-Core {
echo "Build failed with exit code $exit_code. Check errors above." echo "Build failed with exit code $exit_code. Check errors above."
# When running on Azure Pipelines, override the returned exit code to avoid double logging. # When running on Azure Pipelines, override the returned exit code to avoid double logging.
if [[ "$ci" == "true" && -n ${BUILD_BUILDNUMBER:-} ]]; then if [[ "$ci" == "true" && -n ${SYSTEM_TEAMPROJECT:-} ]]; then
Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." Write-PipelineSetResult -result "Failed" -message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
@ -495,6 +519,17 @@ function MSBuild-Core {
RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@"
} }
function GetDarc {
darc_path="$temp_dir/darc"
version="$1"
if [[ -n "$version" ]]; then
version="--darcversion $version"
fi
"$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version
}
ResolvePath "${BASH_SOURCE[0]}" ResolvePath "${BASH_SOURCE[0]}"
_script_dir=`dirname "$_ResolvePath"` _script_dir=`dirname "$_ResolvePath"`
@ -513,7 +548,7 @@ global_json_file="${repo_root}global.json"
# determine if global.json contains a "runtimes" entry # determine if global.json contains a "runtimes" entry
global_json_has_runtimes=false global_json_has_runtimes=false
if command -v jq &> /dev/null; then if command -v jq &> /dev/null; then
if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then
global_json_has_runtimes=true global_json_has_runtimes=true
fi fi
elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then

4
global.json

@ -17,7 +17,7 @@
}, },
"msbuild-sdks": { "msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22513.4", "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23516.4",
"Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22513.4" "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23516.4"
} }
} }

Loading…
Cancel
Save