Skip to content

Commit 8029988

Browse files
author
Nate McMaster
committed
Add a flag to suppress downloading netfx as a tarball, add more retries around dotnet-install.sh, and increase the default timeout in PushNuGetPackages
1 parent 00aefcf commit 8029988

File tree

9 files changed

+49
-16
lines changed

9 files changed

+49
-16
lines changed

Directory.Build.props

+4
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
2727
</PropertyGroup>
2828

29+
<ItemGroup>
30+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesPackageVersion)" PrivateAssets="All" />
31+
</ItemGroup>
32+
2933
</Project>

build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ while [[ $# -gt 0 ]]; do
5959
shift
6060
done
6161

62+
KOREBUILD_SKIP_INSTALL_NETFX=1
63+
6264
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$DIR" "$config_file" "$ci"
6365

6466
invoke_korebuild_command "default-build" "$@"

build/dependencies.props

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<MicrosoftDotNetPlatformAbstractionsVersion>2.0.0</MicrosoftDotNetPlatformAbstractionsVersion>
66
<MicrosoftDotNetSignToolPackageVersion>1.0.0-beta.18603.2</MicrosoftDotNetSignToolPackageVersion>
77
<MicrosoftDotNetSignCheckPackageVersion>1.0.0-beta.18603.2</MicrosoftDotNetSignCheckPackageVersion>
8+
<MicrosoftNETFrameworkReferenceAssembliesPackageVersion>1.0.0-alpha-004</MicrosoftNETFrameworkReferenceAssembliesPackageVersion>
89
<MicrosoftNETTestSdkPackageVersion>15.9.0</MicrosoftNETTestSdkPackageVersion>
910
<MonoCecilPackageVersion>0.10.0-beta6</MonoCecilPackageVersion>
1011
<MoqPackageVersion>4.7.99</MoqPackageVersion>

build/sources.props

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
66
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
77
$(RestoreSources);
8+
https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json;
89
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
910
https://api.nuget.org/v3/index.json;
1011
</RestoreSources>

files/KoreBuild/KoreBuild.sh

+10-8
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,16 @@ __install_tools() {
111111
verbose_flag=''
112112
[ "$verbose" = true ] && verbose_flag='--verbose'
113113

114-
# Instructs MSBuild where to find .NET Framework reference assemblies
115-
export ReferenceAssemblyRoot="$tools_home/netfx/$netfx_version"
116-
117-
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
118-
chmod +x "$__korebuild_dir/scripts/get-netfx.sh"; sync
119-
# we don't include netfx in the BuildTools artifacts currently, it ends up on the blob store through other means, so we'll only look for it in the default_tools_source
120-
"$__korebuild_dir/scripts/get-netfx.sh" $verbose_flag $netfx_version "$default_tools_source" "$ReferenceAssemblyRoot" \
121-
|| return 1
114+
if [ "${KOREBUILD_SKIP_INSTALL_NETFX:-}" != "1" ]; then
115+
# Instructs MSBuild where to find .NET Framework reference assemblies
116+
export ReferenceAssemblyRoot="$tools_home/netfx/$netfx_version"
117+
118+
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
119+
chmod +x "$__korebuild_dir/scripts/get-netfx.sh"; sync
120+
# we don't include netfx in the BuildTools artifacts currently, it ends up on the blob store through other means, so we'll only look for it in the default_tools_source
121+
"$__korebuild_dir/scripts/get-netfx.sh" $verbose_flag $netfx_version "$default_tools_source" "$ReferenceAssemblyRoot" \
122+
|| return 1
123+
fi
122124

123125
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
124126
chmod +x "$__korebuild_dir/scripts/get-dotnet.sh"; sync

files/KoreBuild/scripts/KoreBuild.psm1

+13-1
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ function Invoke-MSBuild {
440440
}
441441

442442
function Get-MSBuildPath() {
443+
if ($env:VSINSTALLDIR) {
444+
# If running from the VS Developer Command Prompt, use the MSBuild it contains.
445+
return 'msbuild.exe'
446+
}
447+
443448
$vswherePath = "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe"
444449

445450
if (-not (Test-Path $vswherePath)) {
@@ -494,7 +499,14 @@ function Get-MSBuildPath() {
494499
}
495500
}
496501

497-
throw 'Could not find a version of MSBuild which satisfies the requirements specified in korebuild.json.'
502+
$vsInstallScript = "$($global:KoreBuildSettings.RepoPath)\eng\scripts\InstallVisualStudio.ps1"
503+
if (Test-Path $vsInstallScript) {
504+
Write-Host ''
505+
Write-Host -ForegroundColor Magenta "Run $vsInstallScript to install Visual Studio prerequisites."
506+
Write-Host ''
507+
}
508+
509+
throw 'Could not find an installation of MSBuild which satisfies the requirements specified in korebuild.json.'
498510
}
499511

500512
function __has_member($obj, $name) {

files/KoreBuild/scripts/get-dotnet.sh

+16-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,22 @@ version=$(__get_dotnet_sdk_version)
4545
__verbose "Installing .NET Core SDK $version"
4646

4747
if [ ! -f "$install_dir/sdk/$version/dotnet.dll" ]; then
48-
"$__script_dir/dotnet-install.sh" \
49-
--install-dir "$install_dir" \
50-
--architecture x64 \
51-
--version "$version" \
52-
$verbose_flag
48+
install_retries=3
49+
while [ $install_retries -gt 0 ]; do
50+
failed=false
51+
"$__script_dir/dotnet-install.sh" \
52+
--install-dir "$install_dir" \
53+
--architecture x64 \
54+
--version "$version" \
55+
$verbose_flag \
56+
|| failed=true
57+
if [ "$failed" = true ]; then
58+
let install_retries=install_retries-1
59+
echo -e "${YELLOW}Failed to install .NET Core $version. Retries left: $install_retries.${RESET}"
60+
else
61+
install_retries=0
62+
fi
63+
done
5364
else
5465
echo -e "${GRAY}.NET Core SDK $version is already installed. Skipping installation.${RESET}"
5566
fi

modules/KoreBuild.Tasks/InstallDotNet.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class InstallDotNet : Microsoft.Build.Utilities.Task, ICancelableTask
4747
/// <summary>
4848
/// Timeout per install request.
4949
/// </summary>
50-
public int TimeoutSeconds { get; set; } = 240;
50+
public int TimeoutSeconds { get; set; } = 600;
5151

5252
public void Cancel()
5353
{

modules/KoreBuild.Tasks/PushNuGetPackages.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class PushNuGetPackages : Microsoft.Build.Utilities.Task, ICancelableTask
3333
// not be required if pushing to the filesystem
3434
public string ApiKey { get; set; }
3535

36-
public int TimeoutSeconds { get; set; } = 90;
36+
public int TimeoutSeconds { get; set; } = 300;
3737

3838
public void Cancel()
3939
{

0 commit comments

Comments
 (0)