Remove The host build, consume the host build from core-setup

This commit is contained in:
Bryan 2016-05-16 15:30:53 -07:00 committed by Bryan Thornbury
parent 651e8c2524
commit aa01110c33
293 changed files with 650 additions and 25590 deletions

View file

@ -15,7 +15,6 @@ namespace Microsoft.DotNet.Cli.Build
{
public class CompileTargets
{
public static readonly string CoreCLRVersion = "1.0.2-rc3-24123-01";
public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86;
public static readonly string[] BinariesForCoreHost = new[]
@ -54,11 +53,7 @@ namespace Microsoft.DotNet.Cli.Build
public const string SharedFrameworkName = "Microsoft.NETCore.App";
public static Crossgen CrossgenUtil = new Crossgen(CoreCLRVersion);
private static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}";
private static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}";
private static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}";
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
// Updates the stage 2 with recent changes.
[Target(nameof(PrepareTargets.Init), nameof(CompileStage2))]
@ -67,58 +62,12 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target(nameof(PrepareTargets.Init), nameof(RestoreLockedCoreHost), nameof(CompileStage1), nameof(CompileStage2))]
[Target(nameof(PrepareTargets.Init), nameof(CompileStage1), nameof(CompileStage2))]
public static BuildTargetResult Compile(BuildTargetContext c)
{
return c.Success();
}
[Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult RestoreLockedCoreHost(BuildTargetContext c)
{
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
var lockedHostFxrVersion = hostVersion.LockedHostFxrVersion;
var currentRid = HostPackagePlatformRid;
string projectJson = $@"{{
""dependencies"": {{
""Microsoft.NETCore.DotNetHostResolver"" : ""{lockedHostFxrVersion}""
}},
""frameworks"": {{
""netcoreapp1.0"": {{}}
}},
""runtimes"": {{
""{currentRid}"": {{}}
}}
}}";
var tempPjDirectory = Path.Combine(Dirs.Intermediate, "lockedHostTemp");
FS.Rmdir(tempPjDirectory);
Directory.CreateDirectory(tempPjDirectory);
var tempPjFile = Path.Combine(tempPjDirectory, "project.json");
File.WriteAllText(tempPjFile, projectJson);
DotNetCli.Stage0.Restore("--verbosity", "verbose",
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(tempPjDirectory)
.Execute()
.EnsureSuccessful();
// Clean out before publishing locked binaries
FS.Rmdir(Dirs.CorehostLocked);
// Use specific RIDS for non-backward compatible platforms.
(CurrentPlatform.IsWindows
? DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build")
: DotNetCli.Stage0.Publish("--output", Dirs.CorehostLocked, "--no-build", "-r", currentRid))
.WorkingDirectory(tempPjDirectory)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult CompileStage1(BuildTargetContext c)
{
@ -130,11 +79,9 @@ namespace Microsoft.DotNet.Cli.Build
}
Directory.CreateDirectory(Dirs.Stage1);
CopySharedHost(Dirs.Stage1);
PublishSharedFramework(c, Dirs.Stage1, DotNetCli.Stage0);
var result = CompileCliSdk(c,
dotnet: DotNetCli.Stage0,
outputDir: Dirs.Stage1);
rootOutputDirectory: Dirs.Stage1);
CleanOutputDir(Path.Combine(Dirs.Stage1, "sdk"));
FS.CopyRecursive(Dirs.Stage1, Dirs.Stage1Symbols);
@ -157,11 +104,9 @@ namespace Microsoft.DotNet.Cli.Build
}
Directory.CreateDirectory(Dirs.Stage2);
PublishSharedFramework(c, Dirs.Stage2, DotNetCli.Stage1);
CopySharedHost(Dirs.Stage2);
var result = CompileCliSdk(c,
dotnet: DotNetCli.Stage1,
outputDir: Dirs.Stage2);
rootOutputDirectory: Dirs.Stage2);
if (!result.Success)
{
@ -209,168 +154,24 @@ namespace Microsoft.DotNet.Cli.Build
FS.RmFilesInDirRecursive(directory, "*.pdb");
}
private static void CopySharedHost(string outputDir)
{
File.Copy(
Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName),
Path.Combine(outputDir, DotnetHostBaseName), true);
File.Copy(
Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName),
Path.Combine(outputDir, DotnetHostFxrBaseName), true);
}
public static void PublishSharedFramework(BuildTargetContext c, string outputDir, DotNetCli dotnetCli)
{
string SharedFrameworkTemplateSourceRoot = Path.Combine(Dirs.RepoRoot, "src", "sharedframework", "framework");
string SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
string sharedFrameworkRid;
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
{
sharedFrameworkRid = $"win7-{RuntimeEnvironment.RuntimeArchitecture}";
}
else
{
sharedFrameworkRid = RuntimeEnvironment.GetRuntimeIdentifier();
}
string SharedFrameworkSourceRoot = GenerateSharedFrameworkProject(c, SharedFrameworkTemplateSourceRoot, sharedFrameworkRid);
dotnetCli.Restore(
"--verbosity", "verbose",
"--disable-parallel",
"--infer-runtimes",
"--fallbacksource", Dirs.CorehostLocalPackages)
.WorkingDirectory(SharedFrameworkSourceRoot)
.Execute()
.EnsureSuccessful();
// We publish to a sub folder of the PublishRoot so tools like heat and zip can generate folder structures easier.
string SharedFrameworkNameAndVersionRoot = Path.Combine(outputDir, "shared", SharedFrameworkName, SharedFrameworkNugetVersion);
c.BuildContext["SharedFrameworkPath"] = SharedFrameworkNameAndVersionRoot;
if (Directory.Exists(SharedFrameworkNameAndVersionRoot))
{
Utils.DeleteDirectory(SharedFrameworkNameAndVersionRoot);
}
dotnetCli.Publish(
"--output", SharedFrameworkNameAndVersionRoot,
"-r", sharedFrameworkRid,
SharedFrameworkSourceRoot).Execute().EnsureSuccessful();
// Clean up artifacts that dotnet-publish generates which we don't need
DeleteMainPublishOutput(SharedFrameworkNameAndVersionRoot, "framework");
File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.runtimeconfig.json"));
// Rename the .deps file
var destinationDeps = Path.Combine(SharedFrameworkNameAndVersionRoot, $"{SharedFrameworkName}.deps.json");
File.Move(Path.Combine(SharedFrameworkNameAndVersionRoot, "framework.deps.json"), destinationDeps);
ChangeEntryPointLibraryName(destinationDeps, null);
// Generate RID fallback graph
string runtimeGraphGeneratorRuntime = null;
switch (RuntimeEnvironment.OperatingSystemPlatform)
{
case Platform.Windows:
runtimeGraphGeneratorRuntime = "win";
break;
case Platform.Linux:
runtimeGraphGeneratorRuntime = "linux";
break;
case Platform.Darwin:
runtimeGraphGeneratorRuntime = "osx";
break;
}
if (!string.IsNullOrEmpty(runtimeGraphGeneratorRuntime))
{
var runtimeGraphGeneratorName = "RuntimeGraphGenerator";
var runtimeGraphGeneratorProject = Path.Combine(Dirs.RepoRoot, "tools", runtimeGraphGeneratorName);
var runtimeGraphGeneratorOutput = Path.Combine(Dirs.Output, "tools", runtimeGraphGeneratorName);
dotnetCli.Publish(
"--output", runtimeGraphGeneratorOutput,
runtimeGraphGeneratorProject).Execute().EnsureSuccessful();
var runtimeGraphGeneratorExe = Path.Combine(runtimeGraphGeneratorOutput, $"{runtimeGraphGeneratorName}{Constants.ExeSuffix}");
Cmd(runtimeGraphGeneratorExe, "--project", SharedFrameworkSourceRoot, "--deps", destinationDeps, runtimeGraphGeneratorRuntime)
.Execute()
.EnsureSuccessful();
}
else
{
c.Error($"Could not determine rid graph generation runtime for platform {RuntimeEnvironment.OperatingSystemPlatform}");
}
// TODO: Issue #2408: Remove corehost and hostfxr from the Shared FX.
File.Copy(
Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, $"corehost{Constants.ExeSuffix}"), true);
File.Copy(
Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, DotnetHostFxrBaseName), true);
// Hostpolicy should be the latest and not the locked version as it is supposed to evolve for
// the framework and has a tight coupling with coreclr's API in the framework.
File.Copy(
Path.Combine(Dirs.CorehostLatest, HostPolicyBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, HostPolicyBaseName), true);
if (File.Exists(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll")))
{
// Publish already places the crossgen'd version of mscorlib into the output, so we can
// remove the IL version
File.Delete(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.dll"));
}
CrossgenUtil.CrossgenDirectory(c, SharedFrameworkNameAndVersionRoot);
// Generate .version file for sharedfx
var version = SharedFrameworkNugetVersion;
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
File.WriteAllText(Path.Combine(SharedFrameworkNameAndVersionRoot, ".version"), content);
}
/// <summary>
/// Generates the real shared framework project that will get published.
/// </summary>
/// <param name="sharedFrameworkTemplatePath">The "sharedFramework" source template folder.</param>
private static string GenerateSharedFrameworkProject(BuildTargetContext c, string sharedFrameworkTemplatePath, string rid)
{
string sharedFrameworkProjectPath = Path.Combine(Dirs.Intermediate, "sharedFramework", "framework");
Utils.DeleteDirectory(sharedFrameworkProjectPath);
CopyRecursive(sharedFrameworkTemplatePath, sharedFrameworkProjectPath, true);
string templateFile = Path.Combine(sharedFrameworkProjectPath, "project.json.template");
JObject sharedFrameworkProject = JsonUtils.ReadProject(templateFile);
sharedFrameworkProject["dependencies"]["Microsoft.NETCore.App"] = c.BuildContext.Get<BuildVersion>("BuildVersion").NetCoreAppVersion;
((JObject)sharedFrameworkProject["runtimes"]).RemoveAll();
sharedFrameworkProject["runtimes"][rid] = new JObject();
string projectJsonPath = Path.Combine(sharedFrameworkProjectPath, "project.json");
JsonUtils.WriteProject(sharedFrameworkProject, projectJsonPath);
Rm(templateFile);
return sharedFrameworkProjectPath;
}
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string outputDir)
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string rootOutputDirectory)
{
var configuration = c.BuildContext.Get<string>("Configuration");
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
var srcDir = Path.Combine(c.BuildContext.BuildDirectory, "src");
outputDir = Path.Combine(outputDir, "sdk", buildVersion.NuGetVersion);
var sdkOutputDirectory = Path.Combine(rootOutputDirectory, "sdk", buildVersion.NuGetVersion);
CopySharedFramework(Dirs.SharedFrameworkPublish, rootOutputDirectory);
FS.CleanBinObj(c, srcDir);
Rmdir(outputDir);
Mkdirp(outputDir);
Rmdir(sdkOutputDirectory);
Mkdirp(sdkOutputDirectory);
foreach (var project in ProjectsToPublish)
{
dotnet.Publish(
"--native-subdirectory",
"--output", outputDir,
"--output", sdkOutputDirectory,
"--configuration", configuration,
"--version-suffix", buildVersion.CommitCountString,
Path.Combine(srcDir, project))
@ -378,38 +179,36 @@ namespace Microsoft.DotNet.Cli.Build
.EnsureSuccessful();
}
FixModeFlags(outputDir);
FixModeFlags(sdkOutputDirectory);
string compilersProject = Path.Combine(Dirs.RepoRoot, "src", "compilers");
dotnet.Publish(compilersProject,
"--output",
outputDir,
sdkOutputDirectory,
"--framework",
"netstandard1.5")
.Execute()
.EnsureSuccessful();
var compilersDeps = Path.Combine(outputDir, "compilers.deps.json");
var compilersRuntimeConfig = Path.Combine(outputDir, "compilers.runtimeconfig.json");
var compilersDeps = Path.Combine(sdkOutputDirectory, "compilers.deps.json");
var compilersRuntimeConfig = Path.Combine(sdkOutputDirectory, "compilers.runtimeconfig.json");
File.Copy(Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName), Path.Combine(outputDir, $"corehost{Constants.ExeSuffix}"), overwrite: true);
File.Copy(Path.Combine(Dirs.CorehostLocked, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), overwrite: true);
File.Copy(Path.Combine(Dirs.CorehostLatest, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), overwrite: true);
var binaryToCorehostifyRelDir = Path.Combine("runtimes", "any", "native");
var binaryToCorehostifyOutDir = Path.Combine(outputDir, binaryToCorehostifyRelDir);
var binaryToCorehostifyOutDir = Path.Combine(sdkOutputDirectory, binaryToCorehostifyRelDir);
// Corehostify binaries
foreach (var binaryToCorehostify in BinariesForCoreHost)
{
try
{
// Yes, it is .exe even on Linux. This is the managed exe we're working with
File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(outputDir, $"{binaryToCorehostify}.dll"));
File.Copy(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"), Path.Combine(sdkOutputDirectory, $"{binaryToCorehostify}.dll"));
File.Delete(Path.Combine(binaryToCorehostifyOutDir, $"{binaryToCorehostify}.exe"));
File.Copy(compilersDeps, Path.Combine(outputDir, binaryToCorehostify + ".deps.json"));
File.Copy(compilersRuntimeConfig, Path.Combine(outputDir, binaryToCorehostify + ".runtimeconfig.json"));
var binaryToCoreHostifyDeps = Path.Combine(outputDir, binaryToCorehostify + ".deps.json");
ChangeEntryPointLibraryName(binaryToCoreHostifyDeps, binaryToCorehostify);
var binaryToCoreHostifyDeps = Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json");
File.Copy(compilersDeps, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".deps.json"));
File.Copy(compilersRuntimeConfig, Path.Combine(sdkOutputDirectory, binaryToCorehostify + ".runtimeconfig.json"));
PublishMutationUtilties.ChangeEntryPointLibraryName(binaryToCoreHostifyDeps, binaryToCorehostify);
foreach (var binaryToRemove in new string[] { "csc", "vbc" })
{
var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/');
@ -423,16 +222,40 @@ namespace Microsoft.DotNet.Cli.Build
}
// cleanup compilers project output we don't need
DeleteMainPublishOutput(outputDir, "compilers");
File.Delete(compilersDeps);
File.Delete(compilersRuntimeConfig);
PublishMutationUtilties.CleanPublishOutput(
sdkOutputDirectory,
"compilers",
deleteRuntimeConfigJson: true,
deleteDepsJson: true);
CrossgenUtil.CrossgenDirectory(c, outputDir);
// Crossgen SDK directory
var sharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion;
var sharedFrameworkNameVersionPath = SharedFrameworkPublisher.GetSharedFrameworkPublishPath(
rootOutputDirectory,
sharedFrameworkNugetVersion);
// Copy Host to SDK Directory
File.Copy(
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostBaseName),
Path.Combine(sdkOutputDirectory, $"corehost{Constants.ExeSuffix}"),
overwrite: true);
File.Copy(
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostFxrBaseName),
Path.Combine(sdkOutputDirectory, HostArtifactNames.DotnetHostFxrBaseName),
overwrite: true);
File.Copy(
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.HostPolicyBaseName),
Path.Combine(sdkOutputDirectory, HostArtifactNames.HostPolicyBaseName),
overwrite: true);
CrossgenUtil.CrossgenDirectory(
sharedFrameworkNameVersionPath,
sdkOutputDirectory);
// Generate .version file
var version = buildVersion.NuGetVersion;
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
File.WriteAllText(Path.Combine(outputDir, ".version"), content);
File.WriteAllText(Path.Combine(sdkOutputDirectory, ".version"), content);
return c.Success();
}
@ -471,57 +294,9 @@ namespace Microsoft.DotNet.Cli.Build
}
}
private static void ChangeEntryPointLibraryName(string depsFile, string newName)
private static void CopySharedFramework(string sharedFrameworkPublish, string rootOutputDirectory)
{
JToken deps;
using (var file = File.OpenText(depsFile))
using (JsonTextReader reader = new JsonTextReader(file))
{
deps = JObject.ReadFrom(reader);
}
string version = null;
foreach (JProperty target in deps["targets"])
{
var targetLibrary = target.Value.Children<JProperty>().FirstOrDefault();
if (targetLibrary == null)
{
continue;
}
version = targetLibrary.Name.Substring(targetLibrary.Name.IndexOf('/') + 1);
if (newName == null)
{
targetLibrary.Remove();
}
else
{
targetLibrary.Replace(new JProperty(newName + '/' + version, targetLibrary.Value));
}
}
if (version != null)
{
var library = deps["libraries"].Children<JProperty>().First();
if (newName == null)
{
library.Remove();
}
else
{
library.Replace(new JProperty(newName + '/' + version, library.Value));
}
using (var file = File.CreateText(depsFile))
using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented })
{
deps.WriteTo(writer);
}
}
}
private static void DeleteMainPublishOutput(string path, string name)
{
File.Delete(Path.Combine(path, $"{name}{Constants.ExeSuffix}"));
File.Delete(Path.Combine(path, $"{name}.dll"));
File.Delete(Path.Combine(path, $"{name}.pdb"));
CopyRecursive(sharedFrameworkPublish, rootOutputDirectory);
}
}
}

View file

@ -12,9 +12,7 @@ namespace Microsoft.DotNet.Cli.Build
{
public class DebTargets
{
[Target(nameof(GenerateSharedHostDeb),
nameof(GenerateSharedFrameworkDeb),
nameof(GenerateSdkDeb))]
[Target(nameof(GenerateSdkDeb))]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult GenerateDebs(BuildTargetContext c)
{
@ -52,7 +50,7 @@ namespace Microsoft.DotNet.Cli.Build
"-m", manPagesDir,
"--framework-debian-package-name", sharedFxDebianPackageName,
"--framework-nuget-name", Monikers.SharedFrameworkName,
"--framework-nuget-version", c.BuildContext.Get<string>("SharedFrameworkNugetVersion"),
"--framework-nuget-version", DependencyVersions.SharedFrameworkVersion,
"--previous-version-url", previousVersionURL,
"--obj-root", objRoot)
.Execute()
@ -60,59 +58,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult GenerateSharedHostDeb(BuildTargetContext c)
{
var packageName = Monikers.GetDebianSharedHostPackageName(c);
var version = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
var inputRoot = c.BuildContext.Get<string>("SharedHostPublishRoot");
var debFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedhost");
var manPagesDir = Path.Combine(Dirs.RepoRoot, "Documentation", "manpages");
if (Directory.Exists(objRoot))
{
Directory.Delete(objRoot, true);
}
Directory.CreateDirectory(objRoot);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedhost-debian.sh"),
"--input", inputRoot, "--output", debFile, "-b", Monikers.SharedHostBrandName,
"--obj-root", objRoot, "--version", version, "-m", manPagesDir)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target(nameof(InstallSharedHost))]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult GenerateSharedFrameworkDeb(BuildTargetContext c)
{
var packageName = Monikers.GetDebianSharedFrameworkPackageName(c);
var version = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
var inputRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
var debFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
var objRoot = Path.Combine(Dirs.Output, "obj", "debian", "sharedframework");
if (Directory.Exists(objRoot))
{
Directory.Delete(objRoot, true);
}
Directory.CreateDirectory(objRoot);
Cmd(Path.Combine(Dirs.RepoRoot, "scripts", "package", "package-sharedframework-debian.sh"),
"--input", inputRoot, "--output", debFile, "--package-name", packageName, "-b", Monikers.SharedFxBrandName,
"--framework-nuget-name", Monikers.SharedFrameworkName,
"--framework-nuget-version", c.BuildContext.Get<string>("SharedFrameworkNugetVersion"),
"--obj-root", objRoot, "--version", version)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target(nameof(InstallSDK),
nameof(RunE2ETest),
nameof(RemovePackages))]

View file

@ -33,12 +33,8 @@ namespace Microsoft.DotNet.Cli.Build
private static string SharedFrameworkMsi { get; set; }
private static string SharedFrameworkBundle { get; set; }
private static string SdkEngine { get; set; }
private static string SharedFrameworkEngine { get; set; }
private static string MsiVersion { get; set; }
private static string CliDisplayVersion { get; set; }
@ -85,10 +81,8 @@ namespace Microsoft.DotNet.Cli.Build
SdkMsi = Path.ChangeExtension(SdkBundle, "msi");
SdkEngine = GetEngineName(SdkBundle);
SharedFrameworkBundle = c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile");
SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedHostInstallerFile"), "msi");
SharedFrameworkMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"), "msi");
SharedFrameworkEngine = GetEngineName(SharedFrameworkBundle);
SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedHostInstallerFile"), "msi");
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
MsiVersion = buildVersion.GenerateMsiVersion();
@ -100,8 +94,6 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target(nameof(MsiTargets.InitMsi),
nameof(GenerateDotnetSharedHostMsi),
nameof(GenerateDotnetSharedFrameworkMsi),
nameof(GenerateCliSdkMsi))]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateMsis(BuildTargetContext c)
@ -110,8 +102,7 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target(nameof(MsiTargets.InitMsi),
nameof(GenerateCliSdkBundle),
nameof(GenerateSharedFxBundle))]
nameof(GenerateCliSdkBundle))]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateBundles(BuildTargetContext c)
{
@ -134,58 +125,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateDotnetSharedHostMsi(BuildTargetContext c)
{
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion");
var hostMsiVersion = hostVersion.GenerateMsiVersion();
var hostNugetVersion = hostVersion.LockedHostVersion;
var inputDir = c.BuildContext.Get<string>("SharedHostPublishRoot");
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedhost");
var sharedHostBrandName = $"'{Monikers.SharedHostBrandName}'";
if (Directory.Exists(wixObjRoot))
{
Utils.DeleteDirectory(wixObjRoot);
}
Directory.CreateDirectory(wixObjRoot);
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "host", "generatemsi.ps1"),
inputDir, SharedHostMsi, WixRoot, sharedHostBrandName, hostMsiVersion, hostNugetVersion, Arch, wixObjRoot)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateDotnetSharedFrameworkMsi(BuildTargetContext c)
{
var inputDir = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
var msiVerison = sharedFrameworkNuGetVersion.Split('-')[0];
var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkMsi).ToString().ToUpper();
var wixObjRoot = Path.Combine(Dirs.Output, "obj", "wix", "sharedframework");
var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
if (Directory.Exists(wixObjRoot))
{
Utils.DeleteDirectory(wixObjRoot);
}
Directory.CreateDirectory(wixObjRoot);
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatemsi.ps1"),
inputDir, SharedFrameworkMsi, WixRoot, sharedFxBrandName, msiVerison, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch, wixObjRoot)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target(nameof(MsiTargets.InitMsi))]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateCliSdkBundle(BuildTargetContext c)
@ -202,29 +141,11 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target(nameof(MsiTargets.InitMsi))]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult GenerateSharedFxBundle(BuildTargetContext c)
{
var sharedFrameworkNuGetName = Monikers.SharedFrameworkName;
var sharedFrameworkNuGetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
var upgradeCode = Utils.GenerateGuidFromName(SharedFrameworkBundle).ToString().ToUpper();
var sharedFxBrandName = $"'{Monikers.SharedFxBrandName}'";
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "sharedframework", "generatebundle.ps1"),
SharedFrameworkMsi, SharedHostMsi, SharedFrameworkBundle, WixRoot, sharedFxBrandName, MsiVersion, CliDisplayVersion, sharedFrameworkNuGetName, sharedFrameworkNuGetVersion, upgradeCode, Arch)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target(nameof(MsiTargets.InitMsi))]
[BuildPlatforms(BuildPlatform.Windows)]
public static BuildTargetResult ExtractEngineFromBundle(BuildTargetContext c)
{
ExtractEngineFromBundleHelper(SdkBundle, SdkEngine);
ExtractEngineFromBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine);
return c.Success();
}
@ -233,16 +154,9 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult ReattachEngineToBundle(BuildTargetContext c)
{
ReattachEngineToBundleHelper(SdkBundle, SdkEngine);
ReattachEngineToBundleHelper(SharedFrameworkBundle, SharedFrameworkEngine);
return c.Success();
}
private static string GetEngineName(string bundle)
{
var engine = $"{Path.GetFileNameWithoutExtension(bundle)}-{ENGINE}";
return Path.Combine(Path.GetDirectoryName(bundle), engine);
}
private static void ExtractEngineFromBundleHelper(string bundle, string engine)
{
Cmd($"{WixRoot}\\insignia.exe", "-ib", bundle, "-o", engine)
@ -258,5 +172,11 @@ namespace Microsoft.DotNet.Cli.Build
File.Delete(engine);
}
private static string GetEngineName(string bundle)
{
var engine = $"{Path.GetFileNameWithoutExtension(bundle)}-{ENGINE}";
return Path.Combine(Path.GetDirectoryName(bundle), engine);
}
}
}

View file

@ -29,7 +29,6 @@ namespace Microsoft.DotNet.Cli.Build
nameof(PackageTargets.CopySharedHostLayout),
nameof(PackageTargets.CopySharedFxLayout),
nameof(PackageTargets.CopyCombinedFrameworkSDKHostLayout),
nameof(PackageTargets.CopyCombinedFrameworkHostLayout),
nameof(PackageTargets.CopyCombinedFrameworkSDKLayout))]
public static BuildTargetResult InitPackage(BuildTargetContext c)
{
@ -142,26 +141,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
public static BuildTargetResult CopyCombinedFrameworkHostLayout(BuildTargetContext c)
{
var combinedRoot = Path.Combine(Dirs.Output, "obj", "combined-framework-host");
if (Directory.Exists(combinedRoot))
{
Utils.DeleteDirectory(combinedRoot);
}
string sharedFrameworkPublishRoot = c.BuildContext.Get<string>("SharedFrameworkPublishRoot");
Utils.CopyDirectoryRecursively(sharedFrameworkPublishRoot, combinedRoot);
string sharedHostPublishRoot = c.BuildContext.Get<string>("SharedHostPublishRoot");
Utils.CopyDirectoryRecursively(sharedHostPublishRoot, combinedRoot);
c.BuildContext["CombinedFrameworkHostRoot"] = combinedRoot;
return c.Success();
}
[Target]
public static BuildTargetResult CopyCombinedFrameworkSDKLayout(BuildTargetContext c)
{
@ -192,7 +171,6 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult GenerateZip(BuildTargetContext c)
{
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
CreateZipFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKCompressedFile"));
CreateZipFromDirectory(Path.Combine(Dirs.Stage2Symbols, "sdk"), c.BuildContext.Get<string>("SdkSymbolsCompressedFile"));
@ -204,7 +182,6 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult GenerateTarBall(BuildTargetContext c)
{
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkSDKHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkSDKHostCompressedFile"));
CreateTarBallFromDirectory(c.BuildContext.Get<string>("CombinedFrameworkHostRoot"), c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile"));
CreateTarBallFromDirectory(Path.Combine(Dirs.Stage2Symbols, "sdk"), c.BuildContext.Get<string>("SdkSymbolsCompressedFile"));

View file

@ -31,7 +31,7 @@ namespace Microsoft.DotNet.Cli.Build
SharedHostComponentId = $"com.microsoft.dotnet.sharedhost.component.osx.x64";
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
SharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion;
SharedFxComponentId = $"com.microsoft.dotnet.sharedframework.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.component.osx.x64";
SharedFxPkgId = $"com.microsoft.dotnet.{sharedFrameworkNugetName}.{SharedFrameworkNugetVersion}.osx.x64";
@ -42,7 +42,7 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target(nameof(InitPkg), nameof(GenerateSharedFrameworkProductArchive), nameof(GenerateCLISdkProductArchive))]
[Target(nameof(InitPkg), nameof(GenerateCLISdkProductArchive))]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GeneratePkgs(BuildTargetContext c)
{
@ -107,85 +107,5 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target(nameof(GenerateSharedFrameworkPkg), nameof(GenerateSharedHostPkg))]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateSharedFrameworkProductArchive(BuildTargetContext c)
{
string resourcePath = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "resources");
string outFilePath = Path.Combine(PkgsIntermediateDir, c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile"));
string inputDistTemplatePath = Path.Combine(
Dirs.RepoRoot,
"packaging",
"osx",
"sharedframework",
"shared-framework-distribution-template.xml");
string distTemplate = File.ReadAllText(inputDistTemplatePath);
string distributionPath = Path.Combine(PkgsIntermediateDir, "shared-framework-formatted-distribution.xml");
string formattedDistContents =
distTemplate.Replace("{SharedFxComponentId}", SharedFxComponentId)
.Replace("{SharedHostComponentId}", SharedHostComponentId)
.Replace("{SharedFrameworkNugetName}", Monikers.SharedFrameworkName)
.Replace("{SharedFrameworkNugetVersion}", SharedFrameworkNugetVersion)
.Replace("{SharedFxBrandName}", Monikers.SharedFxBrandName)
.Replace("{SharedHostBrandName}", Monikers.SharedHostBrandName);
File.WriteAllText(distributionPath, formattedDistContents);
Cmd("productbuild",
"--version", SharedFrameworkNugetVersion,
"--identifier", SharedFxPkgId,
"--package-path", PkgsIntermediateDir,
"--resources", resourcePath,
"--distribution", distributionPath,
outFilePath)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateSharedFrameworkPkg(BuildTargetContext c)
{
string outFilePath = Path.Combine(PkgsIntermediateDir, SharedFxComponentId + ".pkg");
string installLocation = "/usr/local/share/dotnet";
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedframework", "scripts");
Cmd("pkgbuild",
"--root", c.BuildContext.Get<string>("SharedFrameworkPublishRoot"),
"--identifier", SharedFxComponentId,
"--version", SharedFrameworkNugetVersion,
"--install-location", installLocation,
"--scripts", scriptsLocation,
outFilePath)
.Execute()
.EnsureSuccessful();
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.OSX)]
public static BuildTargetResult GenerateSharedHostPkg(BuildTargetContext c)
{
string version = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
string outFilePath = Path.Combine(PkgsIntermediateDir, SharedHostComponentId + ".pkg");
string installLocation = "/usr/local/share/dotnet";
string scriptsLocation = Path.Combine(Dirs.RepoRoot, "packaging", "osx", "sharedhost", "scripts");
Cmd("pkgbuild",
"--root", c.BuildContext.Get<string>("SharedHostPublishRoot"),
"--identifier", SharedHostComponentId,
"--version", version,
"--install-location", installLocation,
"--scripts", scriptsLocation,
outFilePath)
.Execute()
.EnsureSuccessful();
return c.Success();
}
}
}

View file

@ -12,12 +12,13 @@ using Newtonsoft.Json.Linq;
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
using static Microsoft.DotNet.Cli.Build.FS;
using static Microsoft.DotNet.Cli.Build.Utils;
using System.IO.Compression;
namespace Microsoft.DotNet.Cli.Build
{
public class PrepareTargets
{
[Target(nameof(Init), nameof(RestorePackages))]
[Target(nameof(Init), nameof(DownloadHostAndSharedFxArtifacts), nameof(RestorePackages))]
public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success();
[Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))]
@ -75,16 +76,10 @@ namespace Microsoft.DotNet.Cli.Build
ReleaseSuffix = branchInfo["RELEASE_SUFFIX"],
CommitCount = commitCount
};
var hostVersion = new HostVersion()
{
CommitCount = commitCount
};
c.BuildContext["BuildVersion"] = buildVersion;
c.BuildContext["HostVersion"] = hostVersion;
c.BuildContext["CommitHash"] = commitHash;
c.BuildContext["SharedFrameworkNugetVersion"] = buildVersion.NetCoreAppVersion;
c.Info($"Building Version: {buildVersion.SimpleVersion} (NuGet Packages: {buildVersion.NuGetVersion})");
c.Info($"From Commit: {commitHash}");
@ -106,7 +101,7 @@ namespace Microsoft.DotNet.Cli.Build
foreach (string templateFile in templateFiles)
{
JObject projectRoot = JsonUtils.ReadProject(templateFile);
projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = c.BuildContext.Get<BuildVersion>("BuildVersion").NetCoreAppVersion;
projectRoot["dependencies"]["Microsoft.NETCore.App"]["version"] = DependencyVersions.SharedFrameworkVersion;
JsonUtils.WriteProject(projectRoot, Path.ChangeExtension(templateFile, "template"));
}
@ -146,17 +141,91 @@ namespace Microsoft.DotNet.Cli.Build
c.BuildContext["VersionBadge"] = Path.Combine(Dirs.Output, versionBadgeName);
var cliVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
var sharedFrameworkVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
var hostVersion = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion;
var hostVersion = DependencyVersions.SharedHostVersion;
// Generated Installers + Archives
AddInstallerArtifactToContext(c, "dotnet-sdk", "Sdk", cliVersion);
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
AddInstallerArtifactToContext(c, "dotnet-dev", "CombinedFrameworkSDKHost", cliVersion);
AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion);
AddInstallerArtifactToContext(c, "dotnet-sharedframework-sdk", "CombinedFrameworkSDK", cliVersion);
AddInstallerArtifactToContext(c, "dotnet-sdk-debug", "SdkSymbols", cliVersion);
//Downloaded Installers + Archives
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion);
return c.Success();
}
[Target(
nameof(ExpectedBuildArtifacts),
nameof(DownloadHostAndSharedFxArchives),
nameof(DownloadHostAndSharedFxInstallers))]
public static BuildTargetResult DownloadHostAndSharedFxArtifacts(BuildTargetContext c) => c.Success();
[Target]
public static BuildTargetResult DownloadHostAndSharedFxArchives(BuildTargetContext c)
{
var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion;
var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel;
var combinedSharedHostAndFrameworkArchiveFile = c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile");
Mkdirp(Path.GetDirectoryName(combinedSharedHostAndFrameworkArchiveFile));
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)
{
ZipFile.ExtractToDirectory(combinedSharedHostAndFrameworkArchiveFile, Dirs.SharedFrameworkPublish);
}
else
{
Exec("tar", "xf", combinedSharedHostAndFrameworkArchiveFile, "-C", Dirs.SharedFrameworkPublish);
}
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX, BuildPlatform.Ubuntu)]
public static BuildTargetResult DownloadHostAndSharedFxInstallers(BuildTargetContext c)
{
var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion;
var hostVersion = DependencyVersions.SharedHostVersion;
var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel;
var sharedHostChannel = DependencyVersions.SharedHostChannel;
var sharedFrameworkInstallerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
var sharedHostInstallerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerFile));
Mkdirp(Path.GetDirectoryName(sharedHostInstallerFile));
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedFrameworkInstallerFile,
sharedFrameworkChannel,
sharedFrameworkVersion),
sharedFrameworkInstallerFile).Wait();
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
sharedHostInstallerFile,
sharedHostChannel,
hostVersion),
sharedHostInstallerFile).Wait();
return c.Success();
}
@ -231,7 +300,7 @@ namespace Microsoft.DotNet.Cli.Build
{
var dotnet = DotNetCli.Stage0;
dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.CorehostLocalPackages)
dotnet.Restore("--verbosity", "verbose", "--disable-parallel")
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src"))
.Execute()
.EnsureSuccessful();
@ -424,7 +493,14 @@ cmake is required to build the native host 'corehost'";
switch (CurrentPlatform.Current)
{
case BuildPlatform.Windows:
installer = productName + ".exe";
if (contextPrefix.Contains("Combined"))
{
installer = productName + ".exe";
}
else
{
installer = productName + ".msi";
}
break;
case BuildPlatform.OSX:
installer = productName + ".pkg";

View file

@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Cli.Build
CliVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
CliNuGetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion");
SharedFrameworkNugetVersion = DependencyVersions.SharedFrameworkVersion;
SharedHostNugetVersion = c.BuildContext.Get<HostVersion>("HostVersion").LockedHostVersion;
Channel = c.BuildContext.Get<string>("Channel");
@ -91,28 +91,15 @@ namespace Microsoft.DotNet.Cli.Build
// Copy the latest CLI bits
CopyBlobs($"{Channel}/Binaries/{CliNuGetVersion}/", targetContainer);
// Copy the shared framework
CopyBlobs($"{Channel}/Binaries/{SharedFrameworkNugetVersion}/", targetContainer);
// Copy the latest installer files
CopyBlobs($"{Channel}/Installers/{CliNuGetVersion}/", $"{Channel}/Installers/Latest/");
// Copy the shared framework installers
CopyBlobs($"{Channel}/Installers/{SharedFrameworkNugetVersion}/", $"{Channel}/Installers/Latest/");
// Copy the shared host installers
CopyBlobs($"{Channel}/Installers/{SharedHostNugetVersion}/", $"{Channel}/Installers/Latest/");
PublishCoreHostPackagesToFeed();
// Generate the CLI and SDK Version text files
// Generate the SDK Version text files
List<string> versionFiles = new List<string>() { "win.x86.version", "win.x64.version", "ubuntu.x64.version", "rhel.x64.version", "osx.x64.version", "debian.x64.version", "centos.x64.version" };
string cliVersion = Utils.GetCliVersionFileContent(c);
string sfxVersion = Utils.GetSharedFrameworkVersionFileContent(c);
foreach (string version in versionFiles)
{
AzurePublisherTool.PublishStringToBlob($"{Channel}/dnvm/latest.{version}", cliVersion);
AzurePublisherTool.PublishStringToBlob($"{Channel}/dnvm/latest.sharedfx.{version}", sfxVersion);
}
}
finally
@ -130,26 +117,13 @@ namespace Microsoft.DotNet.Cli.Build
{
string source = blob.Replace("/dotnet/", "");
string targetName = Path.GetFileName(blob)
.Replace(CliNuGetVersion, "latest")
.Replace(SharedFrameworkNugetVersion, "latest")
.Replace(SharedHostNugetVersion, "latest");
.Replace(CliNuGetVersion, "latest");
string target = $"{destinationFolder}{targetName}";
AzurePublisherTool.CopyBlob(source, target);
}
}
private static void PublishCoreHostPackagesToFeed()
{
var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}";
Directory.CreateDirectory(Dirs.PackagesNoRID);
AzurePublisherTool.DownloadFiles(hostBlob, ".nupkg", Dirs.PackagesNoRID);
string nugetFeedUrl = EnvVars.EnsureVariable("NUGET_FEED_URL");
string apiKey = EnvVars.EnsureVariable("NUGET_API_KEY");
NuGetUtil.PushPackages(Dirs.PackagesNoRID, nugetFeedUrl, apiKey);
}
private static bool CheckIfAllBuildsHavePublished()
{
Dictionary<string, bool> badges = new Dictionary<string, bool>()
@ -198,29 +172,22 @@ namespace Microsoft.DotNet.Cli.Build
nameof(PublishTargets.PublishInstallerFilesToAzure),
nameof(PublishTargets.PublishArchivesToAzure),
/*nameof(PublishTargets.PublishDebFilesToDebianRepo),*/ //https://github.com/dotnet/cli/issues/2973
nameof(PublishTargets.PublishCoreHostPackages),
nameof(PublishTargets.PublishCliVersionBadge))]
public static BuildTargetResult PublishArtifacts(BuildTargetContext c) => c.Success();
[Target(
nameof(PublishTargets.PublishSharedHostInstallerFileToAzure),
nameof(PublishTargets.PublishSharedFrameworkInstallerFileToAzure),
nameof(PublishTargets.PublishSdkInstallerFileToAzure),
nameof(PublishTargets.PublishCombinedFrameworkSDKHostInstallerFileToAzure),
nameof(PublishTargets.PublishCombinedFrameworkHostInstallerFileToAzure))]
nameof(PublishTargets.PublishCombinedFrameworkSDKHostInstallerFileToAzure))]
public static BuildTargetResult PublishInstallerFilesToAzure(BuildTargetContext c) => c.Success();
[Target(
nameof(PublishTargets.PublishCombinedHostFrameworkArchiveToAzure),
nameof(PublishTargets.PublishCombinedHostFrameworkSdkArchiveToAzure),
nameof(PublishTargets.PublishCombinedFrameworkSDKArchiveToAzure),
nameof(PublishTargets.PublishSDKSymbolsArchiveToAzure))]
public static BuildTargetResult PublishArchivesToAzure(BuildTargetContext c) => c.Success();
[Target(
nameof(PublishSdkDebToDebianRepo),
nameof(PublishSharedFrameworkDebToDebianRepo),
nameof(PublishSharedHostDebToDebianRepo))]
nameof(PublishSdkDebToDebianRepo))]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishDebFilesToDebianRepo(BuildTargetContext c)
{
@ -235,49 +202,7 @@ namespace Microsoft.DotNet.Cli.Build
AzurePublisherTool.PublishFile(versionBadgeBlob, versionBadge);
return c.Success();
}
[Target]
public static BuildTargetResult PublishCoreHostPackages(BuildTargetContext c)
{
foreach (var file in Directory.GetFiles(Dirs.CorehostLocalPackages, "*.nupkg"))
{
var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}/{Path.GetFileName(file)}";
AzurePublisherTool.PublishFile(hostBlob, file);
Console.WriteLine($"Publishing package {hostBlob} to Azure.");
}
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu, BuildPlatform.Windows)]
public static BuildTargetResult PublishSharedHostInstallerFileToAzure(BuildTargetContext c)
{
var version = SharedHostNugetVersion;
var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
if (CurrentPlatform.Current == BuildPlatform.Windows)
{
installerFile = Path.ChangeExtension(installerFile, "msi");
}
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSharedFrameworkInstallerFileToAzure(BuildTargetContext c)
{
var version = SharedFrameworkNugetVersion;
var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSdkInstallerFileToAzure(BuildTargetContext c)
@ -290,18 +215,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]
public static BuildTargetResult PublishCombinedFrameworkHostInstallerFileToAzure(BuildTargetContext c)
{
var version = SharedFrameworkNugetVersion;
var installerFile = c.BuildContext.Get<string>("CombinedFrameworkHostInstallerFile");
AzurePublisherTool.PublishInstallerFile(installerFile, Channel, version);
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]
public static BuildTargetResult PublishCombinedFrameworkSDKHostInstallerFileToAzure(BuildTargetContext c)
@ -348,16 +261,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
public static BuildTargetResult PublishCombinedHostFrameworkArchiveToAzure(BuildTargetContext c)
{
var version = SharedFrameworkNugetVersion;
var archiveFile = c.BuildContext.Get<string>("CombinedFrameworkHostCompressedFile");
AzurePublisherTool.PublishArchive(archiveFile, Channel, version);
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSdkDebToDebianRepo(BuildTargetContext c)
@ -376,42 +279,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSharedFrameworkDebToDebianRepo(BuildTargetContext c)
{
var version = SharedFrameworkNugetVersion;
var packageName = Monikers.GetDebianSharedFrameworkPackageName(c);
var installerFile = c.BuildContext.Get<string>("SharedFrameworkInstallerFile");
var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version);
DebRepoPublisherTool.PublishDebFileToDebianRepo(
packageName,
version,
uploadUrl);
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSharedHostDebToDebianRepo(BuildTargetContext c)
{
var version = SharedHostNugetVersion;
var packageName = Monikers.GetDebianSharedHostPackageName(c);
var installerFile = c.BuildContext.Get<string>("SharedHostInstallerFile");
var uploadUrl = AzurePublisherTool.CalculateInstallerUploadUrl(installerFile, Channel, version);
DebRepoPublisherTool.PublishDebFileToDebianRepo(
packageName,
version,
uploadUrl);
return c.Success();
}
[Target]
[Environment("DOCKER_HUB_REPO")]
[Environment("DOCKER_HUB_TRIGGER_TOKEN")]

View file

@ -17,30 +17,14 @@ namespace Microsoft.DotNet.Cli.Build
public static readonly string[] TestProjects = new[]
{
"ArgumentForwardingTests",
"crossgen.Tests",
"EndToEnd",
"dotnet.Tests",
"dotnet-build.Tests",
"dotnet-compile.Tests",
"dotnet-compile.UnitTests",
"dotnet-compile-fsc.Tests",
"dotnet-new.Tests",
"dotnet-pack.Tests",
"dotnet-projectmodel-server.Tests",
"dotnet-publish.Tests",
"dotnet-resgen.Tests",
"dotnet-run.Tests",
"dotnet-run.UnitTests",
"dotnet-test.Tests",
"dotnet-test.UnitTests",
// TODO: https://github.com/dotnet/cli/issues/3216
//"Kestrel.Tests",
"Microsoft.DotNet.Cli.Utils.Tests",
"Microsoft.DotNet.Compiler.Common.Tests",
"Microsoft.DotNet.ProjectModel.Tests",
"Microsoft.Extensions.DependencyModel.Tests",
"Performance"
//"Microsoft.DotNet.Cli.Utils.Tests",
//"Microsoft.DotNet.Compiler.Common.Tests",
// "Microsoft.DotNet.ProjectModel.Tests",
// "Microsoft.Extensions.DependencyModel.Tests",
// "Performance"
};
public static readonly string[] WindowsTestProjects = new[]
@ -83,9 +67,7 @@ namespace Microsoft.DotNet.Cli.Build
CleanNuGetTempCache();
var dotnet = DotNetCli.Stage2;
dotnet.Restore("--verbosity", "verbose",
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
dotnet.Restore("--verbosity", "verbose")
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages"))
.Execute()
.EnsureSuccessful();
@ -104,9 +86,7 @@ namespace Microsoft.DotNet.Cli.Build
var dotnet = DotNetCli.Stage2;
dotnet.Restore(
"--verbosity", "verbose",
"--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
"--fallbacksource", Dirs.TestPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects"))
.Execute()
.EnsureSuccessful();
@ -114,9 +94,7 @@ namespace Microsoft.DotNet.Cli.Build
// The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output
dotnet.Restore(
"--verbosity", "verbose",
"--infer-runtimes",
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
"--infer-runtimes")
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects"))
.Execute();
@ -137,9 +115,7 @@ namespace Microsoft.DotNet.Cli.Build
dotnet.Restore("--verbosity", "verbose",
"--infer-runtimes",
"--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
"--fallbacksource", Dirs.TestPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects"))
.Execute().EnsureSuccessful();
@ -267,9 +243,7 @@ namespace Microsoft.DotNet.Cli.Build
CleanNuGetTempCache();
DotNetCli.Stage2.Restore("--verbosity", "verbose",
"--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages)
"--fallbacksource", Dirs.TestPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test"))
.Execute()
.EnsureSuccessful();