Address some PR feedback.

- Make the MSI scripts to use parameters instead of environment variables.
This commit is contained in:
Sridhar Periyasamy 2016-03-07 14:52:41 -08:00
parent 0f679e68bf
commit ae041c8f61
8 changed files with 58 additions and 44 deletions

View file

@ -28,6 +28,14 @@ namespace Microsoft.DotNet.Cli.Build
private static string Engine { get; set; }
private static string MsiVersion { get; set; }
private static string CliVersion { get; set; }
private static string Arch { get; } = CurrentArchitecture.Current.ToString();
private static string Channel { get; set; }
private static void AcquireWix(BuildTargetContext c)
{
if (File.Exists(Path.Combine(WixRoot, "candle.exe")))
@ -55,6 +63,12 @@ namespace Microsoft.DotNet.Cli.Build
Bundle = c.BuildContext.Get<string>("InstallerFile");
Msi = Path.ChangeExtension(Bundle, "msi");
Engine = Path.Combine(Path.GetDirectoryName(Bundle), ENGINE);
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
MsiVersion = buildVersion.GenerateMsiVersion();
CliVersion = buildVersion.SimpleVersion;
Channel = c.BuildContext.Get<string>("Channel");
AcquireWix(c);
return c.Success();
}
@ -66,12 +80,6 @@ namespace Microsoft.DotNet.Cli.Build
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateMsis(BuildTargetContext c)
{
var env = PackageTargets.GetCommonEnvVars(c);
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatemsi.ps1"), Dirs.Stage2, Msi, WixRoot)
.Environment(env)
.Execute()
.EnsureSuccessful();
return c.Success();
}
@ -79,10 +87,9 @@ namespace Microsoft.DotNet.Cli.Build
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateCLISDKMsi(BuildTargetContext c)
{
var env = PackageTargets.GetCommonEnvVars(c);
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatemsi.ps1"), Dirs.Stage2, Msi, WixRoot)
.Environment(env)
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatemsi.ps1"),
Dirs.Stage2, Msi, WixRoot, MsiVersion, CliVersion, Arch, Channel)
.Execute()
.EnsureSuccessful();
return c.Success();
@ -107,10 +114,10 @@ namespace Microsoft.DotNet.Cli.Build
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateBundle(BuildTargetContext c)
{
var env = PackageTargets.GetCommonEnvVars(c);
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatebundle.ps1"), Msi, Bundle, WixRoot)
.Environment(env)
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "generatebundle.ps1"),
Msi, Bundle, WixRoot, MsiVersion, CliVersion, Arch, Channel)
.EnvironmentVariable("Stage2Dir", Dirs.Stage2)
.Execute()
.EnsureSuccessful();
return c.Success();

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Build
nameof(PackageTargets.GenerateCompressedFile),
nameof(InstallerTargets.GenerateInstaller),
nameof(PackageTargets.GenerateNugetPackages))]
[Environment("DOTNET_BUILD_SKIP_PACKAGING", null)]
[Environment("DOTNET_BUILD_SKIP_PACKAGING", null, "0", "false")]
public static BuildTargetResult Package(BuildTargetContext c)
{
return c.Success();

View file

@ -21,10 +21,10 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))]
public static BuildTargetResult CheckPrereqs(BuildTargetContext c) => c.Success();
[Target(nameof(CheckCoreclrPlatformDependencies), nameof(CheckInstallerBuildPlatformDependencies))]
[Target(nameof(CheckCoreclrPlatformDependencies), nameof(CheckInstallerBuildPlatformDependencies))]
public static BuildTargetResult CheckPlatformDependencies(BuildTargetContext c) => c.Success();
[Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))]
[Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))]
public static BuildTargetResult CheckCoreclrPlatformDependencies(BuildTargetContext c) => c.Success();
[Target(nameof(CheckUbuntuDebianPackageBuildDependencies))]
@ -44,6 +44,7 @@ namespace Microsoft.DotNet.Cli.Build
}
c.BuildContext["Configuration"] = configEnv;
c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL");
c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
c.Info("Build Environment:");
@ -116,7 +117,7 @@ namespace Microsoft.DotNet.Cli.Build
c.BuildContext["CompressedFile"] = Path.Combine(Dirs.Packages, productName + extension);
string installer = "";
switch(CurrentPlatform.Current)
switch (CurrentPlatform.Current)
{
case BuildPlatform.Windows:
installer = productName + ".exe";
@ -131,7 +132,7 @@ namespace Microsoft.DotNet.Cli.Build
break;
}
if(!string.IsNullOrEmpty(installer))
if (!string.IsNullOrEmpty(installer))
{
c.BuildContext["InstallerFile"] = Path.Combine(Dirs.Packages, installer);
}
@ -279,7 +280,7 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult CheckCentOSCoreclrAndCoreFxDependencies(BuildTargetContext c)
{
var errorMessageBuilder = new StringBuilder();
foreach (var package in PackageDependencies.CentosCoreclrAndCoreFxDependencies)
{
if (!YumDependencyUtility.PackageIsInstalled(package))

View file

@ -17,7 +17,7 @@ namespace Microsoft.DotNet.Cli.Build
{
private static CloudBlobContainer BlobContainer { get; set; }
private static string Channel { get; } = "Test";// Environment.GetEnvironmentVariable("RELEASE_SUFFIX");
private static string Channel { get; set; }
private static string Version { get; set; }
@ -30,13 +30,14 @@ namespace Microsoft.DotNet.Cli.Build
BlobContainer = blobClient.GetContainerReference("dotnet");
Version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
Channel = c.BuildContext.Get<string>("Channel");
return c.Success();
}
[Target(nameof(PrepareTargets.Init),
nameof(PublishTargets.InitPublish),
nameof(PublishTargets.PublishArtifacts))]
[Environment("PUBLISH_TO_AZURE_BLOB", "true")] // This is set by CI systems
[Environment("PUBLISH_TO_AZURE_BLOB", "1", "true")] // This is set by CI systems
public static BuildTargetResult Publish(BuildTargetContext c)
{
return c.Success();