Lock down muxer

This commit is contained in:
Senthil 2016-04-21 19:18:05 -07:00 committed by schellap
parent 2e963a6aef
commit 62eda6c2d7
9 changed files with 172 additions and 103 deletions

View file

@ -13,7 +13,6 @@ $Stage1Dir = $env:Stage1Dir
$Stage1CompilationDir = $env:Stage1CompilationDir $Stage1CompilationDir = $env:Stage1CompilationDir
$Stage2Dir = $env:Stage2Dir $Stage2Dir = $env:Stage2Dir
$Stage2CompilationDir = $env:Stage2CompilationDir $Stage2CompilationDir = $env:Stage2CompilationDir
$HostDir = $env:HostDir
$PackageDir = $env:PackageDir $PackageDir = $env:PackageDir
$TestBinRoot = $env:TestBinRoot $TestBinRoot = $env:TestBinRoot
$TestPackageDir = $env:TestPackageDir $TestPackageDir = $env:TestPackageDir

View file

@ -36,31 +36,30 @@ namespace Microsoft.DotNet.Cli.Build
"vbc.exe" "vbc.exe"
}; };
public static readonly string[] HostPackageSupportedRids = new[] public static string HostPackagePlatformRid => HostPackageSupportedRids[
{ (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
"win7-x64", ? $"win7-{PlatformServices.Default.Runtime.RuntimeArchitecture}"
"win7-x86", : PlatformServices.Default.Runtime.GetRuntimeIdentifier()];
"osx.10.10-x64",
"osx.10.11-x64",
"ubuntu.14.04-x64",
"centos.7-x64",
"rhel.7-x64",
"rhel.7.2-x64",
"debian.8-x64"
};
public static readonly string[] HostPackages = new[] public static readonly Dictionary<string, string> HostPackageSupportedRids = new Dictionary<string, string>()
{ {
"Microsoft.NETCore.DotNetHost", // Key: Current platform RID. Value: The actual publishable (non-dummy) package name produced by the build system for this RID.
"Microsoft.NETCore.DotNetHostPolicy", { "win7-x64", "win7-x64" },
"Microsoft.NETCore.DotNetHostResolver" { "win7-x86", "win7-x86" },
{ "osx.10.10-x64", "osx.10.10-x64" },
{ "osx.10.11-x64", "osx.10.10-x64" },
{ "ubuntu.14.04-x64", "ubuntu.14.04-x64" },
{ "centos.7-x64", "rhel.7-x64" },
{ "rhel.7-x64", "rhel.7-x64" },
{ "rhel.7.2-x64", "rhel.7-x64" },
{ "debian.8-x64", "debian.8-x64" }
}; };
public const string SharedFrameworkName = "Microsoft.NETCore.App"; public const string SharedFrameworkName = "Microsoft.NETCore.App";
public static Crossgen CrossgenUtil = new Crossgen(CoreCLRVersion); public static Crossgen CrossgenUtil = new Crossgen(CoreCLRVersion);
private static string CoreHostBaseName => $"corehost{Constants.ExeSuffix}"; private static string DotnetHostBaseName => $"dotnet{Constants.ExeSuffix}";
private static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"; private static string DotnetHostFxrBaseName => $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}";
private static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"; private static string HostPolicyBaseName => $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}";
@ -73,7 +72,7 @@ namespace Microsoft.DotNet.Cli.Build
// Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the // Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the
// Microsoft.NETCore.App package that is created during PackagePkgProjects. // Microsoft.NETCore.App package that is created during PackagePkgProjects.
[Target(nameof(PrepareTargets.Init), nameof(CompileCoreHost), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))] [Target(nameof(PrepareTargets.Init), nameof(CompileCoreHost), nameof(PackagePkgProjects), nameof(RestoreLockedCoreHost), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))]
public static BuildTargetResult Compile(BuildTargetContext c) public static BuildTargetResult Compile(BuildTargetContext c)
{ {
return c.Success(); return c.Success();
@ -85,23 +84,20 @@ namespace Microsoft.DotNet.Cli.Build
[Target] [Target]
public static BuildTargetResult GenerateStubHostPackages(BuildTargetContext c) public static BuildTargetResult GenerateStubHostPackages(BuildTargetContext c)
{ {
string currentRid = GetRuntimeId();
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion"); var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
PrepareDummyRuntimeNuGetPackage( var currentRid = HostPackagePlatformRid;
DotNetCli.Stage0, PrepareDummyRuntimeNuGetPackage(DotNetCli.Stage0);
buildVersion.HostNuGetPackageVersion, foreach (var hostPackage in buildVersion.LatestHostPackages)
Dirs.CorehostDummyPackages);
foreach (var hostPackageId in HostPackages)
{ {
foreach (var rid in HostPackageSupportedRids) foreach (var rid in HostPackageSupportedRids.Values.Distinct())
{ {
if (!rid.Equals(currentRid)) if (!rid.Equals(currentRid))
{ {
CreateDummyRuntimeNuGetPackage( CreateDummyRuntimeNuGetPackage(
DotNetCli.Stage0, DotNetCli.Stage0,
hostPackageId, hostPackage.Key,
rid, rid,
buildVersion.HostNuGetPackageVersion, hostPackage.Value,
Dirs.CorehostDummyPackages); Dirs.CorehostDummyPackages);
} }
} }
@ -109,21 +105,57 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
private static string HostVer = "1.0.1"; [Target(nameof(PrepareTargets.Init))]
private static string HostPolicyVer = "1.0.1"; public static BuildTargetResult RestoreLockedCoreHost(BuildTargetContext c)
private static string HostFxrVer = "1.0.1"; {
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
var lockedHostFxrVersion = buildVersion.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", "--infer-runtimes",
"--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))] [Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult CompileCoreHost(BuildTargetContext c) public static BuildTargetResult CompileCoreHost(BuildTargetContext c)
{ {
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion"); var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
var versionTag = buildVersion.ReleaseSuffix;
var buildMajor = buildVersion.CommitCountString;
var hostPolicyFullVer = $"{HostPolicyVer}-{versionTag}-{buildMajor}";
// Generate build files // Generate build files
var cmakeOut = Path.Combine(Dirs.Corehost, "cmake"); var cmakeOut = Path.Combine(Dirs.CorehostLatest, "cmake");
Rmdir(cmakeOut); Rmdir(cmakeOut);
Mkdirp(cmakeOut); Mkdirp(cmakeOut);
@ -133,6 +165,7 @@ namespace Microsoft.DotNet.Cli.Build
// Run the build // Run the build
string rid = GetRuntimeId(); string rid = GetRuntimeId();
string corehostSrcDir = Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost"); string corehostSrcDir = Path.Combine(c.BuildContext.BuildDirectory, "src", "corehost");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
// Why does Windows directly call cmake but Linux/Mac calls "build.sh" in the corehost dir? // Why does Windows directly call cmake but Linux/Mac calls "build.sh" in the corehost dir?
@ -142,7 +175,7 @@ namespace Microsoft.DotNet.Cli.Build
var ridMacro = $"-DCLI_CMAKE_RUNTIME_ID:STRING={rid}"; var ridMacro = $"-DCLI_CMAKE_RUNTIME_ID:STRING={rid}";
var arch = IsWinx86 ? "x86" : "x64"; var arch = IsWinx86 ? "x86" : "x64";
var baseSupportedRid = $"win7-{arch}"; var baseSupportedRid = $"win7-{arch}";
var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={hostPolicyFullVer}"; var cmakeHostPolicyVer = $"-DCLI_CMAKE_HOST_POLICY_VER:STRING={buildVersion.LatestHostPolicyVersion}";
var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}"; var cmakeBaseRid = $"-DCLI_CMAKE_PKG_RID:STRING={baseSupportedRid}";
ExecIn(cmakeOut, "cmake", ExecIn(cmakeOut, "cmake",
@ -169,14 +202,12 @@ namespace Microsoft.DotNet.Cli.Build
$"/p:Configuration={configuration}"); $"/p:Configuration={configuration}");
// Copy the output out // Copy the output out
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.exe"), Path.Combine(Dirs.Corehost, "corehost.exe"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.exe"), Path.Combine(Dirs.CorehostLatest, "dotnet.exe"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.pdb"), Path.Combine(Dirs.Corehost, "corehost.pdb"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.pdb"), Path.Combine(Dirs.CorehostLatest, "dotnet.pdb"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.exe"), Path.Combine(Dirs.Corehost, "dotnet.exe"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.dll"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.dll"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", configuration, "dotnet.pdb"), Path.Combine(Dirs.Corehost, "dotnet.pdb"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.pdb"), Path.Combine(Dirs.CorehostLatest, "hostpolicy.pdb"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.dll"), Path.Combine(Dirs.Corehost, "hostpolicy.dll"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.dll"), Path.Combine(Dirs.CorehostLatest, "hostfxr.dll"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "dll", configuration, "hostpolicy.pdb"), Path.Combine(Dirs.Corehost, "hostpolicy.pdb"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.pdb"), Path.Combine(Dirs.CorehostLatest, "hostfxr.pdb"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.dll"), Path.Combine(Dirs.Corehost, "hostfxr.dll"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", configuration, "hostfxr.pdb"), Path.Combine(Dirs.Corehost, "hostfxr.pdb"), overwrite: true);
} }
else else
{ {
@ -184,15 +215,14 @@ namespace Microsoft.DotNet.Cli.Build
"--arch", "--arch",
"x64", "x64",
"--policyver", "--policyver",
hostPolicyFullVer, buildVersion.LatestHostPolicyVersion,
"--rid", "--rid",
rid); rid);
// Copy the output out // Copy the output out
File.Copy(Path.Combine(cmakeOut, "cli", "dotnet"), Path.Combine(Dirs.Corehost, "dotnet"), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "dotnet"), Path.Combine(Dirs.CorehostLatest, "dotnet"), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "dotnet"), Path.Combine(Dirs.Corehost, CoreHostBaseName), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "dll", HostPolicyBaseName), Path.Combine(Dirs.CorehostLatest, HostPolicyBaseName), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "dll", HostPolicyBaseName), Path.Combine(Dirs.Corehost, HostPolicyBaseName), overwrite: true); File.Copy(Path.Combine(cmakeOut, "cli", "fxr", DotnetHostFxrBaseName), Path.Combine(Dirs.CorehostLatest, DotnetHostFxrBaseName), overwrite: true);
File.Copy(Path.Combine(cmakeOut, "cli", "fxr", DotnetHostFxrBaseName), Path.Combine(Dirs.Corehost, DotnetHostFxrBaseName), overwrite: true);
} }
return c.Success(); return c.Success();
} }
@ -200,11 +230,9 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(CompileTargets.GenerateStubHostPackages))] [Target(nameof(CompileTargets.GenerateStubHostPackages))]
public static BuildTargetResult PackagePkgProjects(BuildTargetContext c) public static BuildTargetResult PackagePkgProjects(BuildTargetContext c)
{ {
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
var versionTag = buildVersion.ReleaseSuffix;
var buildMajor = buildVersion.CommitCountString;
var arch = IsWinx86 ? "x86" : "x64"; var arch = IsWinx86 ? "x86" : "x64";
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
var version = buildVersion.NuGetVersion; var version = buildVersion.NuGetVersion;
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}"; var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
var pkgDir = Path.Combine(c.BuildContext.BuildDirectory, "pkg"); var pkgDir = Path.Combine(c.BuildContext.BuildDirectory, "pkg");
@ -215,12 +243,12 @@ namespace Microsoft.DotNet.Cli.Build
Command.Create(Path.Combine(pkgDir, "pack.cmd")) Command.Create(Path.Combine(pkgDir, "pack.cmd"))
// Workaround to arg escaping adding backslashes for arguments to .cmd scripts. // Workaround to arg escaping adding backslashes for arguments to .cmd scripts.
.Environment("__WorkaroundCliCoreHostBuildArch", arch) .Environment("__WorkaroundCliCoreHostBuildArch", arch)
.Environment("__WorkaroundCliCoreHostBinDir", Dirs.Corehost) .Environment("__WorkaroundCliCoreHostBinDir", Dirs.CorehostLatest)
.Environment("__WorkaroundCliCoreHostPolicyVer", HostPolicyVer) .Environment("__WorkaroundCliCoreHostPolicyVer", buildVersion.LatestHostPolicyVersionNoSuffix)
.Environment("__WorkaroundCliCoreHostFxrVer", HostFxrVer) .Environment("__WorkaroundCliCoreHostFxrVer", buildVersion.LatestHostFxrVersionNoSuffix)
.Environment("__WorkaroundCliCoreHostVer", HostVer) .Environment("__WorkaroundCliCoreHostVer", buildVersion.LatestHostVersionNoSuffix)
.Environment("__WorkaroundCliCoreHostBuildMajor", buildMajor) .Environment("__WorkaroundCliCoreHostBuildMajor", buildVersion.LatestHostBuildMajor)
.Environment("__WorkaroundCliCoreHostVersionTag", versionTag) .Environment("__WorkaroundCliCoreHostVersionTag", buildVersion.LatestHostPrerelease)
.ForwardStdOut() .ForwardStdOut()
.ForwardStdErr() .ForwardStdErr()
.Execute() .Execute()
@ -232,30 +260,32 @@ namespace Microsoft.DotNet.Cli.Build
"--arch", "--arch",
"x64", "x64",
"--hostbindir", "--hostbindir",
Dirs.Corehost, Dirs.CorehostLatest,
"--policyver", "--policyver",
HostPolicyVer, buildVersion.LatestHostPolicyVersionNoSuffix,
"--fxrver", "--fxrver",
HostFxrVer, buildVersion.LatestHostFxrVersionNoSuffix,
"--hostver", "--hostver",
HostVer, buildVersion.LatestHostVersionNoSuffix,
"--build", "--build",
buildMajor, buildVersion.LatestHostBuildMajor,
"--vertag", "--vertag",
versionTag); buildVersion.LatestHostPrerelease);
} }
int runtimeCount = 0;
foreach (var file in Directory.GetFiles(Path.Combine(pkgDir, "bin", "packages"), "*.nupkg")) foreach (var file in Directory.GetFiles(Path.Combine(pkgDir, "bin", "packages"), "*.nupkg"))
{ {
var fileName = Path.GetFileName(file); var fileName = Path.GetFileName(file);
File.Copy(file, Path.Combine(Dirs.Corehost, fileName), true); File.Copy(file, Path.Combine(Dirs.CorehostLocalPackages, fileName), true);
runtimeCount += (fileName.StartsWith("runtime.") ? 1 : 0);
Console.WriteLine($"Copying package {fileName} to artifacts directory {Dirs.Corehost}."); Console.WriteLine($"Copying package {fileName} to artifacts directory {Dirs.CorehostLocalPackages}.");
} }
if (runtimeCount < 3) foreach (var item in buildVersion.LatestHostPackages)
{ {
throw new BuildFailureException("Not all corehost nupkgs were successfully created"); var fileFilter = $"runtime.{HostPackagePlatformRid}.{item.Key}.{item.Value}.nupkg";
if (Directory.GetFiles(Dirs.CorehostLocalPackages, fileFilter).Length == 0)
{
throw new BuildFailureException($"Nupkg for {fileFilter} was not created.");
}
} }
return c.Success(); return c.Success();
} }
@ -358,7 +388,7 @@ namespace Microsoft.DotNet.Cli.Build
} }
private static void PrepareDummyRuntimeNuGetPackage(DotNetCli dotnet, string version, string outputDir) private static void PrepareDummyRuntimeNuGetPackage(DotNetCli dotnet)
{ {
var projectJson = new StringBuilder(); var projectJson = new StringBuilder();
projectJson.Append("{"); projectJson.Append("{");
@ -430,12 +460,11 @@ namespace Microsoft.DotNet.Cli.Build
private static void CopySharedHost(string outputDir) private static void CopySharedHost(string outputDir)
{ {
// corehost will be renamed to dotnet at some point and then this can be removed.
File.Copy( File.Copy(
Path.Combine(Dirs.Corehost, CoreHostBaseName), Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName),
Path.Combine(outputDir, $"dotnet{Constants.ExeSuffix}"), true); Path.Combine(outputDir, DotnetHostBaseName), true);
File.Copy( File.Copy(
Path.Combine(Dirs.Corehost, DotnetHostFxrBaseName), Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName),
Path.Combine(outputDir, DotnetHostFxrBaseName), true); Path.Combine(outputDir, DotnetHostFxrBaseName), true);
} }
@ -460,7 +489,7 @@ namespace Microsoft.DotNet.Cli.Build
"--verbosity", "verbose", "--verbosity", "verbose",
"--disable-parallel", "--disable-parallel",
"--infer-runtimes", "--infer-runtimes",
"--fallbacksource", Dirs.Corehost) "--fallbacksource", Dirs.CorehostLocalPackages)
.WorkingDirectory(SharedFrameworkSourceRoot) .WorkingDirectory(SharedFrameworkSourceRoot)
.Execute() .Execute()
.EnsureSuccessful(); .EnsureSuccessful();
@ -522,20 +551,22 @@ namespace Microsoft.DotNet.Cli.Build
c.Error($"Could not determine rid graph generation runtime for platform {PlatformServices.Default.Runtime.OperatingSystemPlatform}"); c.Error($"Could not determine rid graph generation runtime for platform {PlatformServices.Default.Runtime.OperatingSystemPlatform}");
} }
// corehost will be renamed to dotnet at some point and then we will not need to rename it here.
File.Copy( File.Copy(
Path.Combine(Dirs.Corehost, CoreHostBaseName), Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, $"dotnet{Constants.ExeSuffix}"), true); Path.Combine(SharedFrameworkNameAndVersionRoot, DotnetHostBaseName), true);
File.Copy( File.Copy(
Path.Combine(Dirs.Corehost, CoreHostBaseName), Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, CoreHostBaseName), true); Path.Combine(SharedFrameworkNameAndVersionRoot, $"corehost{Constants.ExeSuffix}"), true);
File.Copy( File.Copy(
Path.Combine(Dirs.Corehost, HostPolicyBaseName), Path.Combine(Dirs.CorehostLocked, DotnetHostFxrBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, HostPolicyBaseName), true);
File.Copy(
Path.Combine(Dirs.Corehost, DotnetHostFxrBaseName),
Path.Combine(SharedFrameworkNameAndVersionRoot, DotnetHostFxrBaseName), true); 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"))) if (File.Exists(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll")))
{ {
// Publish already places the crossgen'd version of mscorlib into the output, so we can // Publish already places the crossgen'd version of mscorlib into the output, so we can
@ -614,10 +645,9 @@ namespace Microsoft.DotNet.Cli.Build
var compilersDeps = Path.Combine(outputDir, "compilers.deps.json"); var compilersDeps = Path.Combine(outputDir, "compilers.deps.json");
var compilersRuntimeConfig = Path.Combine(outputDir, "compilers.runtimeconfig.json"); var compilersRuntimeConfig = Path.Combine(outputDir, "compilers.runtimeconfig.json");
// Copy corehost File.Copy(Path.Combine(Dirs.CorehostLocked, DotnetHostBaseName), Path.Combine(outputDir, $"corehost{Constants.ExeSuffix}"), overwrite: true);
File.Copy(Path.Combine(Dirs.Corehost, $"corehost{Constants.ExeSuffix}"), 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.Corehost, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostpolicy{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);
File.Copy(Path.Combine(Dirs.Corehost, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), Path.Combine(outputDir, $"{Constants.DynamicLibPrefix}hostfxr{Constants.DynamicLibSuffix}"), overwrite: true);
var binaryToCorehostifyOutDir = Path.Combine(outputDir, "runtimes", "any", "native"); var binaryToCorehostifyOutDir = Path.Combine(outputDir, "runtimes", "any", "native");
// Corehostify binaries // Corehostify binaries

View file

@ -274,7 +274,6 @@ namespace Microsoft.DotNet.Cli.Build
{ "Stage2Dir", Dirs.Stage2 }, { "Stage2Dir", Dirs.Stage2 },
{ "STAGE2_DIR", Dirs.Stage2 }, { "STAGE2_DIR", Dirs.Stage2 },
{ "Stage2CompilationDir", Dirs.Stage2Compilation }, { "Stage2CompilationDir", Dirs.Stage2Compilation },
{ "HostDir", Dirs.Corehost },
{ "PackageDir", Path.Combine(Dirs.Packages) }, // Legacy name { "PackageDir", Path.Combine(Dirs.Packages) }, // Legacy name
{ "TestBinRoot", Dirs.TestOutput }, { "TestBinRoot", Dirs.TestOutput },
{ "TestPackageDir", Dirs.TestPackages }, { "TestPackageDir", Dirs.TestPackages },

View file

@ -229,7 +229,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var dotnet = DotNetCli.Stage0; var dotnet = DotNetCli.Stage0;
dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.Corehost) dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.CorehostLocalPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src"))
.Execute() .Execute()
.EnsureSuccessful(); .EnsureSuccessful();

View file

@ -98,7 +98,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target] [Target]
public static BuildTargetResult PublishCoreHostPackages(BuildTargetContext c) public static BuildTargetResult PublishCoreHostPackages(BuildTargetContext c)
{ {
foreach (var file in Directory.GetFiles(Dirs.Corehost, "*.nupkg")) foreach (var file in Directory.GetFiles(Dirs.CorehostLocalPackages, "*.nupkg"))
{ {
var hostBlob = $"{Channel}/Binaries/{CliNuGetVersion}/{Path.GetFileName(file)}"; var hostBlob = $"{Channel}/Binaries/{CliNuGetVersion}/{Path.GetFileName(file)}";
AzurePublisherTool.PublishFile(hostBlob, file); AzurePublisherTool.PublishFile(hostBlob, file);

View file

@ -81,7 +81,7 @@ namespace Microsoft.DotNet.Cli.Build
var dotnet = DotNetCli.Stage2; var dotnet = DotNetCli.Stage2;
dotnet.Restore("--verbosity", "verbose", dotnet.Restore("--verbosity", "verbose",
"--infer-runtimes", "--infer-runtimes",
"--fallbacksource", Dirs.Corehost, "--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages) "--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages"))
.Execute() .Execute()
@ -103,7 +103,7 @@ namespace Microsoft.DotNet.Cli.Build
"--verbosity", "verbose", "--verbosity", "verbose",
"--infer-runtimes", "--infer-runtimes",
"--fallbacksource", Dirs.TestPackages, "--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.Corehost, "--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages) "--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects"))
.Execute() .Execute()
@ -113,7 +113,7 @@ namespace Microsoft.DotNet.Cli.Build
dotnet.Restore( dotnet.Restore(
"--verbosity", "verbose", "--verbosity", "verbose",
"--infer-runtimes", "--infer-runtimes",
"--fallbacksource", Dirs.Corehost, "--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages) "--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects"))
.Execute(); .Execute();
@ -136,7 +136,7 @@ namespace Microsoft.DotNet.Cli.Build
dotnet.Restore("--verbosity", "verbose", dotnet.Restore("--verbosity", "verbose",
"--infer-runtimes", "--infer-runtimes",
"--fallbacksource", Dirs.TestPackages, "--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.Corehost, "--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages) "--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "DesktopTestProjects"))
.Execute().EnsureSuccessful(); .Execute().EnsureSuccessful();
@ -266,7 +266,7 @@ namespace Microsoft.DotNet.Cli.Build
CleanNuGetTempCache(); CleanNuGetTempCache();
DotNetCli.Stage2.Restore("--verbosity", "verbose", DotNetCli.Stage2.Restore("--verbosity", "verbose",
"--fallbacksource", Dirs.TestPackages, "--fallbacksource", Dirs.TestPackages,
"--fallbacksource", Dirs.Corehost, "--fallbacksource", Dirs.CorehostLocalPackages,
"--fallbacksource", Dirs.CorehostDummyPackages) "--fallbacksource", Dirs.CorehostDummyPackages)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test"))
.Execute() .Execute()

View file

@ -1,4 +1,6 @@
namespace Microsoft.DotNet.Cli.Build using System.Collections.Generic;
namespace Microsoft.DotNet.Cli.Build
{ {
public class BuildVersion public class BuildVersion
{ {
@ -13,9 +15,46 @@
public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}";
public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}";
public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc2-3{CommitCountString}"; public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc2-3{CommitCountString}";
public string HostNuGetPackageVersion => $"{Major}.{Minor}.1-rc2-{CommitCountString}-00";
public string ProductionVersion => $"{Major}.{Minor}.{Patch}"; public string ProductionVersion => $"{Major}.{Minor}.{Patch}";
// ------------------------------------------HOST-VERSIONING-------------------------------------------
//
// Host versions are independent of CLI versions. Moreover, these version numbers
// are baked into the binary and is used to look up a serviced binary replacement.
//
//
// Latest hosts for production of nupkgs.
//
// Version constants without suffix
public string LatestHostVersionNoSuffix => "1.0.1";
public string LatestHostFxrVersionNoSuffix => "1.0.1";
public string LatestHostPolicyVersionNoSuffix => "1.0.1";
public string LatestHostPrerelease => "rc2";
public string LatestHostBuildMajor => $"{CommitCountString}";
public string LatestHostSuffix => $"{LatestHostPrerelease}-{LatestHostBuildMajor}-00";
// Full versions and package information.
private string LatestHostVersion => $"{LatestHostVersionNoSuffix}-{LatestHostSuffix}";
private string LatestHostFxrVersion => $"{LatestHostFxrVersionNoSuffix}-{LatestHostSuffix}";
public string LatestHostPolicyVersion => $"{LatestHostPolicyVersionNoSuffix}-{LatestHostSuffix}";
public Dictionary<string, string> LatestHostPackages => new Dictionary<string, string>()
{
{ "Microsoft.NETCore.DotNetHost", LatestHostVersion },
{ "Microsoft.NETCore.DotNetHostResolver", LatestHostFxrVersion },
{ "Microsoft.NETCore.DotNetHostPolicy", LatestHostPolicyVersion }
};
//
// Locked muxer for consumption in CLI.
//
public bool IsLocked = false; // Set this variable to toggle muxer locking.
public string LockedHostFxrVersion => IsLocked ? "1.0.1-rc2-002468-00" : LatestHostFxrVersion;
//
// -----------------------------------------END-OF-HOST-VERSIONING-------------------------------------
public string GenerateMsiVersion() public string GenerateMsiVersion()
{ {
// MSI versioning // MSI versioning
@ -29,7 +68,6 @@
// CLI minor -> 6 bits // CLI minor -> 6 bits
// CLI patch -> 6 bits // CLI patch -> 6 bits
// CLI commitcount -> 14 bits // CLI commitcount -> 14 bits
var major = Major << 26; var major = Major << 26;
var minor = Minor << 20; var minor = Minor << 20;
var patch = Patch << 14; var patch = Patch << 14;

View file

@ -22,7 +22,9 @@ namespace Microsoft.DotNet.Cli.Build
public static readonly string Stage2 = Path.Combine(Output, "stage2"); public static readonly string Stage2 = Path.Combine(Output, "stage2");
public static readonly string Stage2Compilation = Path.Combine(Output, "stage2compilation"); public static readonly string Stage2Compilation = Path.Combine(Output, "stage2compilation");
public static readonly string Stage2Symbols = Path.Combine(Output, "stage2symbols"); public static readonly string Stage2Symbols = Path.Combine(Output, "stage2symbols");
public static readonly string Corehost = Path.Combine(Output, "corehost"); public static readonly string CorehostLatest = Path.Combine(Output, "corehost"); // Not using Path.Combine(Output, "corehost", "latest") to keep signing working.
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 CorehostDummyPackages = Path.Combine(Output, "corehostdummypackages");
public static readonly string TestOutput = Path.Combine(Output, "tests"); public static readonly string TestOutput = Path.Combine(Output, "tests");
public static readonly string TestArtifacts = Path.Combine(TestOutput, "artifacts"); public static readonly string TestArtifacts = Path.Combine(TestOutput, "artifacts");

View file

@ -103,6 +103,7 @@ esac
__cmake_defines="${__cmake_defines} ${__arch_define}" __cmake_defines="${__cmake_defines} ${__arch_define}"
# __rid_plat is the base RID that corehost is shipped for, effectively, the name of the folder in "runtimes/{__rid_plat}/native/" inside the nupkgs.
__rid_plat= __rid_plat=
if [ "$(uname -s)" == "Darwin" ]; then if [ "$(uname -s)" == "Darwin" ]; then
__rid_plat=osx.10.10 __rid_plat=osx.10.10