Skip to content

Commit

Permalink
Move workload management out of eng\common
Browse files Browse the repository at this point in the history
  • Loading branch information
sandyarmstrong committed Mar 3, 2022
1 parent d63fe28 commit 2f93672
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions eng/build-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ function Ensure-DotnetSdk() {
throw "Could not find dotnet executable in $dotnetInstallDir"
}

function InitializeDotNetWorkloads()
{
# Install any dotnet workloads specified in global.json
$globalJsonPath = Join-Path $RepoRoot 'global.json'
& $PSScriptRoot\Install-DotNetWorkloads.ps1 -globalJsonPath $globalJsonPath | Out-Null
}

# Walks up the source tree, starting at the given file's directory, and returns a FileInfo object for the first .csproj file it finds, if any.
function Get-ProjectFile([object]$fileInfo) {
Push-Location
Expand Down
6 changes: 6 additions & 0 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ if [[ "$restore" == true && "$source_build" != true ]]; then
dotnet tool restore
fi

if [[ "$restore" == true ]]; then
# Install any dotnet workloads specified in global.json
# TODO: Call Install-DotNetWorkloads.ps1 instead
dotnet workload install macos
fi

bootstrap_dir=""
if [[ "$bootstrap" == true ]]; then
MakeBootstrapBuild
Expand Down
9 changes: 0 additions & 9 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
return $global:_DotNetInstallDir = $dotnetRoot
}

function InitializeDotNetWorkloads()
{
# Install any dotnet workloads specified in global.json
$globalJsonPath = Join-Path $RepoRoot 'global.json'
& $PSScriptRoot\Install-DotNetWorkloads.ps1 -globalJsonPath $globalJsonPath | Out-Null
}

function Retry($downloadBlock, $maxRetries = 5) {
$retries = 1

Expand Down Expand Up @@ -335,8 +328,6 @@ function InstallDotNet([string] $dotnetRoot,
& $installScript @variation
$installSuccess = $true

InitializeDotNetWorkloads

break
}
catch {
Expand Down
4 changes: 0 additions & 4 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,6 @@ function InstallDotNet {
echo "Attempting to install dotnet from $variationName."
bash "$install_script" "${variation[@]}" && installSuccess=1
if [[ "$installSuccess" -eq 1 ]]; then
# Install any dotnet workloads specified in global.json
# TODO: Call Install-DotNetWorkloads.ps1 instead
# TODO: Also do this during repeat restore
dotnet workload install macos
break
fi

Expand Down
2 changes: 2 additions & 0 deletions eng/test-determinism.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ try {
$script:bootstrapConfiguration = "Release"
$bootstrapDir = Make-BootstrapBuild

InitializeDotNetWorkloads

Run-Test
exit 0
}
Expand Down

0 comments on commit 2f93672

Please sign in to comment.