Merge pull request #3258 from dotnet/brthor/download-sharedfx

Stop downloading core setup dependencies in every build
This commit is contained in:
Bryan Thornbury 2016-05-26 18:16:28 -07:00
commit f73351cf6e
2 changed files with 62 additions and 34 deletions

View file

@ -148,27 +148,36 @@ namespace Microsoft.DotNet.Cli.Build
var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion;
var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel;
var combinedSharedHostAndFrameworkArchiveFile = c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile");
var combinedSharedHostAndFrameworkArchiveDownloadFile =
Path.Combine(Dirs.CoreSetupDownload, "combinedSharedHostAndFrameworkArchive");
Mkdirp(Path.GetDirectoryName(combinedSharedHostAndFrameworkArchiveFile));
Mkdirp(Path.GetDirectoryName(combinedSharedHostAndFrameworkArchiveDownloadFile));
AzurePublisher.DownloadFile(
AzurePublisher.CalculateArchiveBlob(
combinedSharedHostAndFrameworkArchiveFile,
sharedFrameworkChannel,
sharedFrameworkVersion),
combinedSharedHostAndFrameworkArchiveFile).Wait();
// Unpack the combined archive to shared framework publish directory
Rmdir(Dirs.SharedFrameworkPublish);
Mkdirp(Dirs.SharedFrameworkPublish);
if(CurrentPlatform.IsWindows)
if ( ! File.Exists(combinedSharedHostAndFrameworkArchiveDownloadFile))
{
ZipFile.ExtractToDirectory(combinedSharedHostAndFrameworkArchiveFile, Dirs.SharedFrameworkPublish);
}
else
{
Exec("tar", "xf", combinedSharedHostAndFrameworkArchiveFile, "-C", Dirs.SharedFrameworkPublish);
// Needed for computing the blob path
var combinedSharedHostAndFrameworkArchiveBuildContextFile =
c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile");
AzurePublisher.DownloadFile(
AzurePublisher.CalculateArchiveBlob(
combinedSharedHostAndFrameworkArchiveBuildContextFile,
sharedFrameworkChannel,
sharedFrameworkVersion),
combinedSharedHostAndFrameworkArchiveDownloadFile).Wait();
// Unpack the combined archive to shared framework publish directory
Rmdir(Dirs.SharedFrameworkPublish);
Mkdirp(Dirs.SharedFrameworkPublish);
if (CurrentPlatform.IsWindows)
{
ZipFile.ExtractToDirectory(combinedSharedHostAndFrameworkArchiveDownloadFile, Dirs.SharedFrameworkPublish);
}
else
{
Exec("tar", "xf", combinedSharedHostAndFrameworkArchiveDownloadFile, "-C", Dirs.SharedFrameworkPublish);
}
}
return c.Success();
@ -184,25 +193,42 @@ namespace Microsoft.DotNet.Cli.Build
var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel;
var sharedHostChannel = DependencyVersions.SharedHostChannel;
var sharedFrameworkInstallerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
var sharedHostInstallerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
var sharedFrameworkInstallerDownloadFile = Path.Combine(Dirs.CoreSetupDownload, "sharedFrameworkInstaller");
var sharedHostInstallerDownloadFile = Path.Combine(Dirs.CoreSetupDownload, "sharedHostInstaller");
Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerFile));
Mkdirp(Path.GetDirectoryName(sharedHostInstallerFile));
Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerDownloadFile));
Mkdirp(Path.GetDirectoryName(sharedHostInstallerDownloadFile));
if ( ! File.Exists(sharedFrameworkInstallerDownloadFile))
{
var sharedFrameworkInstallerDestinationFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerDestinationFile));
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedFrameworkInstallerDestinationFile,
sharedFrameworkChannel,
sharedFrameworkVersion),
sharedFrameworkInstallerDownloadFile).Wait();
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedFrameworkInstallerFile,
sharedFrameworkChannel,
sharedFrameworkVersion),
sharedFrameworkInstallerFile).Wait();
File.Copy(sharedFrameworkInstallerDownloadFile, sharedFrameworkInstallerDestinationFile, true);
}
if ( ! File.Exists(sharedHostInstallerDownloadFile))
{
var sharedHostInstallerDestinationFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
Mkdirp(Path.GetDirectoryName(sharedHostInstallerDestinationFile));
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedHostInstallerFile,
sharedHostChannel,
hostVersion),
sharedHostInstallerFile).Wait();
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedHostInstallerDestinationFile,
sharedHostChannel,
hostVersion),
sharedHostInstallerDownloadFile).Wait();
File.Copy(sharedHostInstallerDownloadFile, sharedHostInstallerDestinationFile, true);
}
return c.Success();
}

View file

@ -27,6 +27,8 @@ namespace Microsoft.DotNet.Cli.Build
public static readonly string CorehostLocked = Path.Combine(Output, "corehost", "locked");
public static readonly string CorehostLocalPackages = Path.Combine(Output, "corehost");
public static readonly string CorehostDummyPackages = Path.Combine(Output, "corehostdummypackages");
public static readonly string CoreSetupDownload = Path.Combine(Intermediate, "coreSetupDownload", DependencyVersions.SharedFrameworkVersion);
public static readonly string SharedFrameworkPublish = Path.Combine(Intermediate, "sharedFrameworkPublish");
public static readonly string TestOutput = Path.Combine(Output, "tests");
public static readonly string TestArtifacts = Path.Combine(TestOutput, "artifacts");