Augment DownloadFile task to make it able to download from public/private location (#5414)
* Patch to DownloadFile: retries + only use PrivateUri on 404 errors. * Refactor PrivateURL in GenerateLayout.targets * Address PR feedback. * Addressing PR feedback. * PR feedback * PR feedback. Bug fix. * Removing test related typo * Fixup blob replacement * Fixup blob replacement * Broaden usage of read sas token to include PRs
This commit is contained in:
parent
4004a7f199
commit
624ec5e7b3
3 changed files with 127 additions and 71 deletions
|
@ -43,7 +43,7 @@ phases:
|
|||
- _SignType: test
|
||||
- _DOTNETCLIMSRC_READ_SAS_TOKEN: ''
|
||||
|
||||
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), contains(variables['Build.SourceBranch'], 'internal')) }}:
|
||||
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
|
||||
- group: DotNet-MSRC-Storage
|
||||
- _DOTNETCLIMSRC_READ_SAS_TOKEN: $(dotnetclimsrc-read-sas-token)
|
||||
|
||||
|
|
|
@ -3,23 +3,39 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DownloadFile : Task
|
||||
public class DownloadFile : Microsoft.Build.Utilities.Task
|
||||
{
|
||||
[Required]
|
||||
public string Uri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this field is set and the task fail to download the file from `Uri`, with a NotFound
|
||||
/// status, it will try to download the file from `PrivateUri`.
|
||||
/// </summary>
|
||||
public string PrivateUri { get; set; }
|
||||
|
||||
public int MaxRetries { get; set; } = 5;
|
||||
|
||||
[Required]
|
||||
public string DestinationPath { get; set; }
|
||||
|
||||
public bool Overwrite { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
return ExecuteAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task<bool> ExecuteAsync()
|
||||
{
|
||||
string destinationDir = Path.GetDirectoryName(DestinationPath);
|
||||
if (!Directory.Exists(destinationDir))
|
||||
|
@ -39,31 +55,84 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
var filePath = Uri.Substring(FileUriProtocol.Length);
|
||||
Log.LogMessage($"Copying '{filePath}' to '{DestinationPath}'");
|
||||
File.Copy(filePath, DestinationPath);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
List<string> errorMessages = new List<string>();
|
||||
bool? downloadStatus = await DownloadWithRetriesAsync(Uri, DestinationPath, errorMessages);
|
||||
|
||||
if (downloadStatus == false && !string.IsNullOrEmpty(PrivateUri))
|
||||
{
|
||||
Log.LogMessage(MessageImportance.High, $"Downloading '{Uri}' to '{DestinationPath}'");
|
||||
downloadStatus = await DownloadWithRetriesAsync(PrivateUri, DestinationPath, errorMessages);
|
||||
}
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
if (downloadStatus != true)
|
||||
{
|
||||
foreach (var error in errorMessages)
|
||||
{
|
||||
var getTask = httpClient.GetStreamAsync(Uri);
|
||||
|
||||
try
|
||||
{
|
||||
using (var outStream = File.Create(DestinationPath))
|
||||
{
|
||||
getTask.Result.CopyTo(outStream);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
File.Delete(DestinationPath);
|
||||
throw;
|
||||
}
|
||||
Log.LogError(error);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return downloadStatus == true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to download file from `source` with retries when response error is different of FileNotFound and Success.
|
||||
/// </summary>
|
||||
/// <param name="source">URL to the file to be downloaded.</param>
|
||||
/// <param name="target">Local path where to put the downloaded file.</param>
|
||||
/// <returns>true: Download Succeeded. false: Download failed with 404. null: Download failed but is retriable.</returns>
|
||||
private async Task<bool?> DownloadWithRetriesAsync(string source, string target, List<string> errorMessages)
|
||||
{
|
||||
Random rng = new Random();
|
||||
|
||||
Log.LogMessage(MessageImportance.High, $"Attempting download '{source}' to '{target}'");
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
for (int retryNumber = 0; retryNumber < MaxRetries; retryNumber++)
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpResponse = await httpClient.GetAsync(source);
|
||||
|
||||
Log.LogMessage(MessageImportance.High, $"{source} -> {httpResponse.StatusCode}");
|
||||
|
||||
// The Azure Storage REST API returns '400 - Bad Request' in some cases
|
||||
// where the resource is not found on the storage.
|
||||
// https://docs.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
|
||||
if (httpResponse.StatusCode == HttpStatusCode.NotFound ||
|
||||
httpResponse.ReasonPhrase.IndexOf("The requested URI does not represent any resource on the server.", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
errorMessages.Add($"Problems downloading file from '{source}'. Does the resource exist on the storage? {httpResponse.StatusCode} : {httpResponse.ReasonPhrase}");
|
||||
return false;
|
||||
}
|
||||
|
||||
httpResponse.EnsureSuccessStatusCode();
|
||||
|
||||
using (var outStream = File.Create(target))
|
||||
{
|
||||
await httpResponse.Content.CopyToAsync(outStream);
|
||||
}
|
||||
|
||||
Log.LogMessage(MessageImportance.High, $"returning true {source} -> {httpResponse.StatusCode}");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.LogMessage(MessageImportance.High, $"returning error in {source} ");
|
||||
errorMessages.Add($"Problems downloading file from '{source}'. {e.Message} {e.StackTrace}");
|
||||
File.Delete(target);
|
||||
}
|
||||
|
||||
await System.Threading.Tasks.Task.Delay(rng.Next(1000, 10000));
|
||||
}
|
||||
}
|
||||
|
||||
Log.LogMessage(MessageImportance.High, $"giving up {source} ");
|
||||
errorMessages.Add($"Giving up downloading the file from '{source}' after {MaxRetries} retries.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,23 +19,18 @@
|
|||
<WindowsDesktopTargetingPackBlobVersion>3.0.0</WindowsDesktopTargetingPackBlobVersion>
|
||||
<NETStandardTargetingPackBlobVersion>3.0.0</NETStandardTargetingPackBlobVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<Target Name="SetupBundledComponents" DependsOnTargets="GetCurrentRuntimeInformation;SetupFileExtensions;SetSdkVersionInfo;SetBuildDefaults">
|
||||
<PropertyGroup>
|
||||
<SdkOutputDirectory>$(RedistLayoutPath)sdk\$(SdkVersion)\</SdkOutputDirectory>
|
||||
|
||||
<InternalBuild Condition="$(SYSTEM_TEAMPROJECT) == 'internal' and $(BUILD_SOURCEBRANCH.ToLower().contains('internal'))">true</InternalBuild>
|
||||
<CoreSetupBlobAccessTokenParam Condition="'$(InternalBuild)' == 'true'">$(DOTNETCLIMSRC_READ_SAS_TOKEN)</CoreSetupBlobAccessTokenParam>
|
||||
|
||||
<CoreSetupBlobRootUrl Condition="'$(CoreSetupBlobRootUrl)' == '' and '$(InternalBuild)' == 'true'">https://dotnetclimsrc.blob.core.windows.net/dotnet/</CoreSetupBlobRootUrl>
|
||||
<InternalBuild Condition="$(SYSTEM_TEAMPROJECT) == 'internal'">true</InternalBuild>
|
||||
<InternalBaseURL Condition="$(SYSTEM_TEAMPROJECT) == 'internal'">https://dotnetclimsrc.blob.core.windows.net/dotnet/</InternalBaseURL>
|
||||
|
||||
<CoreSetupBlobRootUrl Condition="'$(CoreSetupBlobRootUrl)' == ''">https://dotnetcli.blob.core.windows.net/dotnet/</CoreSetupBlobRootUrl>
|
||||
|
||||
<DotnetExtensionsBlobRootUrl Condition="'$(DotnetExtensionsBlobRootUrl)' == '' and '$(InternalBuild)' == 'true'">https://dotnetclimsrc.blob.core.windows.net/dotnet/</DotnetExtensionsBlobRootUrl>
|
||||
<DotnetExtensionsBlobRootUrl Condition="'$(DotnetExtensionsBlobRootUrl)' == ''">https://dotnetcli.blob.core.windows.net/dotnet/</DotnetExtensionsBlobRootUrl>
|
||||
|
||||
<DotnetToolsetBlobRootUrl Condition="'$(DotnetToolsetBlobRootUrl)' == '' and '$(InternalBuild)' == 'true'">https://dotnetclimsrc.blob.core.windows.net/dotnet/</DotnetToolsetBlobRootUrl>
|
||||
<DotnetToolsetBlobRootUrl Condition="'$(DotnetToolsetBlobRootUrl)' == ''">https://dotnetfeed.blob.core.windows.net/dotnet-toolset/</DotnetToolsetBlobRootUrl>
|
||||
|
||||
|
||||
<CoreSetupRid Condition="'$(CoreSetupRid)' == ''">$(HostRid)</CoreSetupRid>
|
||||
<CoreSetupRid Condition=" ('$(HostOSName)' == 'win' or '$(HostOSName)' == 'osx' or '$(HostOSName)' == 'freebsd') and '$(DotNetBuildFromSource)' != 'true' ">$(HostMonikerRid)</CoreSetupRid>
|
||||
|
||||
|
@ -104,7 +99,6 @@
|
|||
<BundledLayoutComponent Include="CombinedSharedHostAndFrameworkArchive">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(CombinedFrameworkHostCompressedFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
<RelativeLayoutPath></RelativeLayoutPath>
|
||||
</BundledLayoutComponent>
|
||||
|
||||
|
@ -121,7 +115,7 @@
|
|||
<TargetFramework>$(NetStandardTargetingPackTargetFramework)</TargetFramework>
|
||||
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
|
||||
</BundledLayoutPackage>
|
||||
|
||||
|
||||
<BundledLayoutPackage Include="MicrosoftAspNetCoreAppTargetingPackNupkg">
|
||||
<PackageName>Microsoft.AspNetCore.App.Ref</PackageName>
|
||||
<PackageVersion>$(MicrosoftAspNetCoreAppRefPackageVersion)</PackageVersion>
|
||||
|
@ -147,62 +141,53 @@
|
|||
Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedRuntimeDepsInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedSharedFrameworkInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedSharedFrameworkInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedSharedHostInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedSharedHostInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedHostFxrInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedHostFxrInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedNetCoreAppTargetingPackInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(NETCoreAppTargetingPackBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedNetCoreAppTargetingPackInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedNetStandardTargetingPackInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(NETStandardTargetingPackBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedNetStandardTargetingPackInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedNetCoreAppHostPackInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedNetCoreAppHostPackInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedWindowsDesktopTargetingPackInstallerFile"
|
||||
Condition="'$(InstallerExtension)' == '.msi' And '$(SkipBuildingInstallers)' != 'true' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(CoreSetupRootUrl)$(WindowsDesktopTargetingPackBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedWindowsDesktopTargetingPackInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
<BundledLayoutComponent Include="ToolsetArchive">
|
||||
<BaseUrl>$(DotnetToolsetBlobRootUrl)Toolset/$(MicrosoftDotnetToolsetInternalPackageVersion)</BaseUrl>
|
||||
<DownloadFileName>dotnet-toolset-internal-$(MicrosoftDotnetToolsetInternalPackageVersion).zip</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
<RelativeLayoutPath>sdk/$(SdkVersion)</RelativeLayoutPath>
|
||||
</BundledLayoutComponent>
|
||||
</ItemGroup>
|
||||
|
@ -211,7 +196,6 @@
|
|||
<BundledLayoutComponent Include="DownloadedAspNetCoreSharedFxArchiveFile">
|
||||
<BaseUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(AspNetCoreSharedFxArchiveFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
<RelativeLayoutPath></RelativeLayoutPath>
|
||||
</BundledLayoutComponent>
|
||||
|
||||
|
@ -221,38 +205,34 @@
|
|||
Condition="'$(InstallerExtension)' == '.pkg' And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreTargetingPackBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(AspNetTargetingPackArchiveFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
<RelativeLayoutPath></RelativeLayoutPath>
|
||||
</BundledLayoutComponent>
|
||||
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedAspNetTargetingPackInstallerFile"
|
||||
Condition="'$(InstallerExtension)' != '.pkg' And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreTargetingPackBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedAspNetTargetingPackInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedAspNetCoreSharedFxInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' AND '$(DownloadedAspNetCoreSharedFxInstallerFileName)' != '' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedAspNetCoreSharedFxInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
|
||||
<BundledInstallerComponent Include="AspNetCoreSharedFxBaseRuntimeVersionFile"
|
||||
Condition="!$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(AspNetCoreSharedFxRootUrl)$(AspNetCoreBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(AspNetCoreSharedFxBaseRuntimeVersionFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(Architecture)' == 'arm'">false</IncludeWpfAndWinForms>
|
||||
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(OS)' == 'Windows_NT' ">true</IncludeWpfAndWinForms>
|
||||
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' ">false</IncludeWpfAndWinForms>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition=" '$(IncludeWpfAndWinForms)' != 'false' ">
|
||||
<BundledLayoutPackage Include="MicrosoftWindowsDesktopAppTargetingPackNupkg">
|
||||
<PackageName>Microsoft.WindowsDesktop.App.Ref</PackageName>
|
||||
|
@ -264,14 +244,12 @@
|
|||
<BundledLayoutComponent Include="WinFormsAndWpfSharedFxArchiveFile">
|
||||
<BaseUrl>$(WinFormsAndWpfSharedFxRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(WinFormsAndWpfSharedFxArchiveFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledLayoutComponent>
|
||||
|
||||
<BundledInstallerComponent Include="DownloadedWinFormsAndWpfSharedFrameworkInstallerFile"
|
||||
Condition="'$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
|
||||
<BaseUrl>$(WinFormsAndWpfSharedFxRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
|
||||
<DownloadFileName>$(DownloadedWinFormsAndWpfSharedFrameworkInstallerFileName)</DownloadFileName>
|
||||
<AccessToken>$(CoreSetupBlobAccessTokenParam)</AccessToken>
|
||||
</BundledInstallerComponent>
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -287,11 +265,20 @@
|
|||
</BundledInstallerComponent>
|
||||
<ComponentToDownload Include="@(BundledLayoutComponent);@(BundledInstallerComponent)">
|
||||
<ShouldDownload Condition="!Exists('%(DownloadDestination)')">true</ShouldDownload>
|
||||
|
||||
<!--
|
||||
Replaces the public base url with the private one.
|
||||
-->
|
||||
<PrivateBaseUrl>%(BaseUrl)</PrivateBaseUrl>
|
||||
<PrivateBaseUrl Condition="'$(InternalBuild)' == 'true'">$([System.String]::new('%(ComponentToDownload.PrivateBaseUrl)').Replace('$(CoreSetupBlobRootUrl)', '$(InternalBaseURL)'))</PrivateBaseUrl>
|
||||
<PrivateBaseUrl Condition="'$(InternalBuild)' == 'true'">$([System.String]::new('%(ComponentToDownload.PrivateBaseUrl)').Replace('$(DotnetExtensionsBlobRootUrl)', '$(InternalBaseURL)'))</PrivateBaseUrl>
|
||||
<PrivateBaseUrl Condition="'$(InternalBuild)' == 'true'">$([System.String]::new('%(ComponentToDownload.PrivateBaseUrl)').Replace('$(DotnetToolsetBlobRootUrl)', '$(InternalBaseURL)'))</PrivateBaseUrl>
|
||||
</ComponentToDownload>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<DownloadFile Condition=" '@(ComponentToDownload)' != '' And '%(ComponentToDownload.ShouldDownload)' == 'true'"
|
||||
Uri="%(ComponentToDownload.BaseUrl)/%(ComponentToDownload.DownloadFileName)%(ComponentToDownload.AccessToken)"
|
||||
Uri="%(ComponentToDownload.BaseUrl)/%(ComponentToDownload.DownloadFileName)"
|
||||
PrivateUri="%(ComponentToDownload.PrivateBaseUrl)/%(ComponentToDownload.DownloadFileName)$(DOTNETCLIMSRC_READ_SAS_TOKEN)"
|
||||
DestinationPath="%(ComponentToDownload.DownloadDestination)" />
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -315,7 +302,7 @@
|
|||
<BundledLayoutPackage>
|
||||
<LoweredPackageName>$([MSBuild]::ValueOrDefault('%(BundledLayoutPackage.PackageName)', '').ToLower())</LoweredPackageName>
|
||||
</BundledLayoutPackage>
|
||||
|
||||
|
||||
<BundledLayoutPackageDownloadFiles Include="$(NuGetPackageRoot)\%(BundledLayoutPackage.LoweredPackageName)\%(BundledLayoutPackage.PackageVersion)\**\*.*">
|
||||
<RelativeLayoutPath>%(BundledLayoutPackage.RelativeLayoutPath)</RelativeLayoutPath>
|
||||
<LayoutPackageDescription>%(BundledLayoutPackage.Identity)</LayoutPackageDescription>
|
||||
|
@ -355,7 +342,7 @@
|
|||
DestinationFiles="@(BundledLayoutPackageDownloadFilesWithDestination->'%(DestinationPath)')"
|
||||
SkipUnchangedFiles="true"
|
||||
/>
|
||||
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="RetargetTools">
|
||||
|
@ -372,24 +359,24 @@
|
|||
ReplacementPatterns="$(ReplacementPattern)"
|
||||
ReplacementStrings="$(ReplacementString)" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="GenerateVersionFile" DependsOnTargets="SetupBundledComponents;GetCoreSdkGitCommitInfo">
|
||||
<WriteLinesToFile File="$(SdkOutputDirectory).version"
|
||||
Lines="$(GitCommitHash);$(SdkVersion);$(Rid)"
|
||||
Overwrite="true" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="LayoutAppHostTemplate" DependsOnTargets="RunResolvePackageDependencies">
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<NETCoreAppHostPackageName>Microsoft.NETCore.App.Host.$(SharedFrameworkRid)</NETCoreAppHostPackageName>
|
||||
<AppHostRestorePath>$(IntermediateOutputPath)AppHostRestore\</AppHostRestorePath>
|
||||
<AppHostTemplatePath>$(SdkOutputDirectory)AppHostTemplate</AppHostTemplatePath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<RemoveDir Directories="$(AppHostRestorePath)" />
|
||||
<MakeDir Directories="$(AppHostRestorePath)" />
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AppHostTemplateDownloadPackageProject Include="$(MSBuildThisFileDirectory)DownloadPackage.csproj">
|
||||
<Properties>
|
||||
|
@ -406,7 +393,7 @@
|
|||
BuildInParallel="False"
|
||||
Projects="@(AppHostTemplateDownloadPackageProject)">
|
||||
</MSBuild>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<AppHostExecutableName>AppHost$(ExeExtension)</AppHostExecutableName>
|
||||
</PropertyGroup>
|
||||
|
@ -427,9 +414,9 @@
|
|||
|
||||
<Message Text="Copy from @(NativeRestoredAppHostNETCore) to $(AppHostTemplatePath)."
|
||||
Importance="High" />
|
||||
|
||||
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="GenerateLayout"
|
||||
DependsOnTargets="DownloadBundledComponents;
|
||||
CleanLayoutPath;
|
||||
|
@ -444,16 +431,16 @@
|
|||
LayoutAppHostTemplate;
|
||||
SignLayout"
|
||||
BeforeTargets="AfterBuild">
|
||||
|
||||
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="GenerateInternalLayout"
|
||||
DependsOnTargets="GenerateLayout"
|
||||
BeforeTargets="AfterBuild">
|
||||
|
||||
<RemoveDir Directories="$(SdkInternalLayoutPath)" />
|
||||
<MakeDir Directories="$(SdkInternalLayoutPath)" />
|
||||
|
||||
|
||||
<!-- Create "SDK Internal" layout to create the MSI to bundle -->
|
||||
<ItemGroup>
|
||||
<SdkInternalFiles Include="$(RedistLayoutPath)sdk/$(SdkVersion)/**/*.*"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue