Generate zips for SharedHost and SharedFramework
This commit is contained in:
parent
e6bcfee4a4
commit
92edb36e5b
2 changed files with 17 additions and 9 deletions
|
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(SharedFrameworkTargets.PublishSharedHost))]
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(SharedFrameworkTargets.PublishSharedFramework))]
|
||||
[Target]
|
||||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Target(nameof(PrepareTargets.Init),
|
||||
nameof(PackageTargets.InitPackage),
|
||||
nameof(PackageTargets.GenerateVersionBadge),
|
||||
nameof(SharedFrameworkTargets.PublishSharedHost),
|
||||
nameof(SharedFrameworkTargets.PublishSharedFramework),
|
||||
nameof(PackageTargets.GenerateCompressedFile),
|
||||
nameof(InstallerTargets.GenerateInstaller),
|
||||
nameof(PackageTargets.GenerateNugetPackages))]
|
||||
|
@ -55,14 +57,10 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[BuildPlatforms(BuildPlatform.Windows)]
|
||||
public static BuildTargetResult GenerateZip(BuildTargetContext c)
|
||||
{
|
||||
var zipFile = c.BuildContext.Get<string>("SdkCompressedFile");
|
||||
CreateZipFromDirectory(c.BuildContext.Get<string>("SharedHostPublishRoot"), c.BuildContext.Get<string>("SharedHostCompressedFile"));
|
||||
CreateZipFromDirectory(c.BuildContext.Get<string>("SharedFrameworkPublishRoot"), c.BuildContext.Get<string>("SharedFrameworkCompressedFile"));
|
||||
CreateZipFromDirectory(Dirs.Stage2, c.BuildContext.Get<string>("SdkCompressedFile"));
|
||||
|
||||
if (File.Exists(zipFile))
|
||||
{
|
||||
File.Delete(zipFile);
|
||||
}
|
||||
|
||||
ZipFile.CreateFromDirectory(Dirs.Stage2, zipFile, CompressionLevel.Optimal, false);
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
|
@ -134,5 +132,15 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
return env;
|
||||
}
|
||||
|
||||
private static void CreateZipFromDirectory(string directory, string artifactPath)
|
||||
{
|
||||
if (File.Exists(artifactPath))
|
||||
{
|
||||
File.Delete(artifactPath);
|
||||
}
|
||||
|
||||
ZipFile.CreateFromDirectory(directory, artifactPath, CompressionLevel.Optimal, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue