Address some PR feedback.
- Make the MSI scripts to use parameters instead of environment variables.
This commit is contained in:
parent
0f679e68bf
commit
ae041c8f61
8 changed files with 58 additions and 44 deletions
|
@ -4,7 +4,11 @@
|
|||
param(
|
||||
[Parameter(Mandatory=$true)][string]$DotnetMSIFile,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
|
||||
[Parameter(Mandatory=$true)][string]$WixRoot
|
||||
[Parameter(Mandatory=$true)][string]$WixRoot,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
|
||||
[Parameter(Mandatory=$true)][string]$Architecture,
|
||||
[Parameter(Mandatory=$true)][string]$ReleaseSuffix
|
||||
)
|
||||
|
||||
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
|
||||
|
@ -21,11 +25,11 @@ function RunCandleForBundle
|
|||
.\candle.exe -nologo `
|
||||
-dDotnetSrc="$inputDir" `
|
||||
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
|
||||
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
|
||||
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
|
||||
-dReleaseSuffix="$env:ReleaseSuffix" `
|
||||
-dBuildVersion="$DotnetMSIVersion" `
|
||||
-dDisplayVersion="$DotnetCLIVersion" `
|
||||
-dReleaseSuffix="$ReleaseSuffix" `
|
||||
-dMsiSourcePath="$DotnetMSIFile" `
|
||||
-arch "$env:ARCHITECTURE" `
|
||||
-arch "$Architecture" `
|
||||
-ext WixBalExtension.dll `
|
||||
-ext WixUtilExtension.dll `
|
||||
-ext WixTagExtension.dll `
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
param(
|
||||
[Parameter(Mandatory=$true)][string]$inputDir,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetMSIOutput,
|
||||
[Parameter(Mandatory=$true)][string]$WixRoot
|
||||
[Parameter(Mandatory=$true)][string]$WixRoot,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
|
||||
[Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
|
||||
[Parameter(Mandatory=$true)][string]$Architecture,
|
||||
[Parameter(Mandatory=$true)][string]$ReleaseSuffix
|
||||
)
|
||||
|
||||
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
|
||||
|
@ -43,10 +47,10 @@ function RunCandle
|
|||
.\candle.exe -nologo `
|
||||
-dDotnetSrc="$inputDir" `
|
||||
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
|
||||
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
|
||||
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
|
||||
-dReleaseSuffix="$env:ReleaseSuffix" `
|
||||
-arch "$env:ARCHITECTURE" `
|
||||
-dBuildVersion="$DotnetMSIVersion" `
|
||||
-dDisplayVersion="$DotnetCLIVersion" `
|
||||
-dReleaseSuffix="$ReleaseSuffix" `
|
||||
-arch "$Architecture" `
|
||||
-ext WixDependencyExtension.dll `
|
||||
"$AuthWsxRoot\dotnet.wxs" `
|
||||
"$AuthWsxRoot\provider.wxs" `
|
||||
|
@ -101,11 +105,6 @@ if(!(Test-Path $inputDir))
|
|||
throw "$inputDir not found"
|
||||
}
|
||||
|
||||
if(!(Test-Path $PackageDir))
|
||||
{
|
||||
mkdir $PackageDir | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"
|
||||
|
||||
if([string]::IsNullOrEmpty($WixRoot))
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
|||
public class EnvironmentAttribute : TargetConditionAttribute
|
||||
{
|
||||
private string _envVar;
|
||||
private string _expectedVal;
|
||||
private string[] _expectedVals;
|
||||
|
||||
public EnvironmentAttribute(string envVar, string expectedVal)
|
||||
public EnvironmentAttribute(string envVar, params string[] expectedVals)
|
||||
{
|
||||
if (string.IsNullOrEmpty(envVar))
|
||||
{
|
||||
|
@ -17,21 +17,22 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
|||
}
|
||||
|
||||
_envVar = envVar;
|
||||
_expectedVal = expectedVal;
|
||||
_expectedVals = expectedVals;
|
||||
}
|
||||
|
||||
public override bool EvaluateCondition()
|
||||
{
|
||||
var actualVal = Environment.GetEnvironmentVariable(_envVar);
|
||||
|
||||
if (string.IsNullOrEmpty(_expectedVal))
|
||||
foreach (var expectedVal in _expectedVals)
|
||||
{
|
||||
return string.IsNullOrEmpty(actualVal) ||
|
||||
actualVal.Equals("0") ||
|
||||
actualVal.ToLower().Equals("false");
|
||||
if (string.Equals(actualVal, expectedVal, StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return _expectedVal.Equals(actualVal, StringComparison.Ordinal);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -82,7 +82,8 @@ done < "$DIR/../branchinfo.txt"
|
|||
[ -d $DOTNET_INSTALL_DIR ] || mkdir -p $DOTNET_INSTALL_DIR
|
||||
|
||||
# Ensure the latest stage0 is installed
|
||||
$DIR/obtain/install.sh --channel $RELEASE_SUFFIX
|
||||
export CHANNEL=$RELEASE_SUFFIX
|
||||
$DIR/obtain/install.sh --channel $CHANNEL
|
||||
|
||||
# Put stage 0 on the PATH (for this shell only)
|
||||
PATH="$DOTNET_INSTALL_DIR/bin:$PATH"
|
||||
|
|
Loading…
Add table
Reference in a new issue