merge rel/1.0.0-preview2 into rel/1.0.0

This commit is contained in:
Bryan Thornbury 2016-06-15 10:20:50 -07:00
commit d717b84ec8
397 changed files with 12555 additions and 2190 deletions

View file

@ -7,10 +7,12 @@ namespace Microsoft.DotNet.Cli.Build
{
public class CliDependencyVersions
{
public static readonly string SharedFrameworkVersion = "1.0.0-rc3-004391";
public static readonly string SharedHostVersion = "1.0.1-rc3-004391-00";
public static readonly string SharedFrameworkVersion = "1.0.0";
public static readonly string SharedHostVersion = "1.0.1";
public static readonly string HostFxrVersion = "1.0.1";
public static readonly string SharedFrameworkChannel = "preview";
public static readonly string SharedHostChannel = "preview";
public static readonly string HostFxrChannel = "preview";
}
}
}

View file

@ -56,7 +56,7 @@ namespace Microsoft.DotNet.Cli.Build
public const string SharedFrameworkName = "Microsoft.NETCore.App";
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion);
public static Crossgen CrossgenUtil = new Crossgen(DependencyVersions.CoreCLRVersion, DependencyVersions.JitVersion);
// Updates the stage 2 with recent changes.
[Target(nameof(PrepareTargets.Init), nameof(CompileStage2))]
@ -109,7 +109,8 @@ namespace Microsoft.DotNet.Cli.Build
var result = CompileCliSdk(c,
dotnet: DotNetCli.Stage1,
rootOutputDirectory: Dirs.Stage2);
rootOutputDirectory: Dirs.Stage2,
generateNugetPackagesArchive: true);
if (!result.Success)
{
@ -157,7 +158,11 @@ namespace Microsoft.DotNet.Cli.Build
FS.RmFilesInDirRecursive(directory, "*.pdb");
}
private static BuildTargetResult CompileCliSdk(BuildTargetContext c, DotNetCli dotnet, string rootOutputDirectory)
private static BuildTargetResult CompileCliSdk(
BuildTargetContext c,
DotNetCli dotnet,
string rootOutputDirectory,
bool generateNugetPackagesArchive = false)
{
var configuration = c.BuildContext.Get<string>("Configuration");
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
@ -236,7 +241,7 @@ namespace Microsoft.DotNet.Cli.Build
var sharedFrameworkNameVersionPath = SharedFrameworkPublisher.GetSharedFrameworkPublishPath(
rootOutputDirectory,
sharedFrameworkNugetVersion);
// Copy Host to SDK Directory
File.Copy(
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.DotnetHostBaseName),
@ -250,7 +255,7 @@ namespace Microsoft.DotNet.Cli.Build
Path.Combine(sharedFrameworkNameVersionPath, HostArtifactNames.HostPolicyBaseName),
Path.Combine(sdkOutputDirectory, HostArtifactNames.HostPolicyBaseName),
overwrite: true);
CrossgenUtil.CrossgenDirectory(
sharedFrameworkNameVersionPath,
sdkOutputDirectory);
@ -260,9 +265,77 @@ namespace Microsoft.DotNet.Cli.Build
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
File.WriteAllText(Path.Combine(sdkOutputDirectory, ".version"), content);
if(generateNugetPackagesArchive)
{
GenerateNuGetPackagesArchive(c, dotnet, sdkOutputDirectory);
}
return c.Success();
}
private static void GenerateNuGetPackagesArchive(
BuildTargetContext c,
DotNetCli dotnet,
string sdkOutputDirectory)
{
var nuGetPackagesArchiveProject = Path.Combine(Dirs.Intermediate, "NuGetPackagesArchiveProject");
var nuGetPackagesArchiveFolder = Path.Combine(Dirs.Intermediate, "nuGetPackagesArchiveFolder");
RestoreNuGetPackagesArchive(dotnet, nuGetPackagesArchiveProject, nuGetPackagesArchiveFolder);
CompressNuGetPackagesArchive(c, dotnet, nuGetPackagesArchiveFolder, sdkOutputDirectory);
}
private static void RestoreNuGetPackagesArchive(
DotNetCli dotnet,
string nuGetPackagesArchiveProject,
string nuGetPackagesArchiveFolder)
{
Rmdir(nuGetPackagesArchiveProject);
Mkdirp(nuGetPackagesArchiveProject);
Rmdir(nuGetPackagesArchiveFolder);
Mkdirp(nuGetPackagesArchiveFolder);
dotnet.New()
.WorkingDirectory(nuGetPackagesArchiveProject)
.Execute()
.EnsureSuccessful();
dotnet.Restore("--packages", nuGetPackagesArchiveFolder)
.WorkingDirectory(nuGetPackagesArchiveProject)
.Execute()
.EnsureSuccessful();
}
private static void CompressNuGetPackagesArchive(
BuildTargetContext c,
DotNetCli dotnet,
string nuGetPackagesArchiveFolder,
string sdkOutputDirectory)
{
var configuration = c.BuildContext.Get<string>("Configuration");
var archiverExe = Path.Combine(Dirs.Output, "tools", $"Archiver{Constants.ExeSuffix}");
var intermediateArchive = Path.Combine(Dirs.Intermediate, "nuGetPackagesArchive.lzma");
var finalArchive = Path.Combine(sdkOutputDirectory, "nuGetPackagesArchive.lzma");
Rm(intermediateArchive);
Rm($"{intermediateArchive}.zip");
c.Info("Publishing Archiver");
dotnet.Publish("--output", Path.Combine(Dirs.Output, "tools"), "--configuration", configuration)
.WorkingDirectory(Path.Combine(Dirs.RepoRoot, "tools", "Archiver"))
.Execute()
.EnsureSuccessful();
Cmd(archiverExe,
"-a", intermediateArchive,
nuGetPackagesArchiveFolder)
.Execute();
File.Copy(intermediateArchive, finalArchive);
}
private static void RemoveAssetFromDepsPackages(string depsFile, string sectionName, string assetPath)
{
JToken deps;

View file

@ -13,16 +13,25 @@ namespace Microsoft.DotNet.Cli.Build
public class DebTargets
{
[Target(nameof(GenerateSdkDeb))]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult GenerateDebs(BuildTargetContext c)
{
return c.Success();
}
[Target(nameof(InstallSharedFramework))]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult GenerateSdkDeb(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
var channel = c.BuildContext.Get<string>("Channel").ToLower();
var packageName = CliMonikers.GetSdkDebianPackageName(c);
var version = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
@ -61,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(InstallSDK),
nameof(RunE2ETest),
nameof(RemovePackages))]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult TestDebInstaller(BuildTargetContext c)
{
return c.Success();
@ -70,14 +79,49 @@ namespace Microsoft.DotNet.Cli.Build
[Target]
public static BuildTargetResult InstallSharedHost(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
InstallPackage(c.BuildContext.Get<string>("SharedHostInstallerFile"));
return c.Success();
}
[Target(nameof(InstallSharedHost))]
public static BuildTargetResult InstallHostFxr(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
InstallPackage(c.BuildContext.Get<string>("HostFxrInstallerFile"));
return c.Success();
}
[Target(nameof(InstallHostFxr))]
public static BuildTargetResult InstallSharedFramework(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
InstallPackage(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"));
return c.Success();
@ -86,15 +130,33 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(InstallSharedFramework))]
public static BuildTargetResult InstallSDK(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
InstallPackage(c.BuildContext.Get<string>("SdkInstallerFile"));
return c.Success();
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult RunE2ETest(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
Directory.SetCurrentDirectory(Path.Combine(Dirs.RepoRoot, "test", "EndToEnd"));
Cmd("dotnet", "build")
@ -111,13 +173,23 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult RemovePackages(BuildTargetContext c)
{
// Ubuntu 16.04 Jenkins Machines don't have docker or debian package build tools
// So we need to skip this target if the tools aren't present.
// https://github.com/dotnet/core-setup/issues/167
if (DebuildNotPresent())
{
c.Info("Debuild not present, skipping target: {nameof(RemovePackages)}");
return c.Success();
}
IEnumerable<string> orderedPackageNames = new List<string>()
{
CliMonikers.GetSdkDebianPackageName(c),
Monikers.GetDebianSharedFrameworkPackageName(CliDependencyVersions.SharedFrameworkVersion),
Monikers.GetDebianHostFxrPackageName(CliDependencyVersions.HostFxrVersion),
Monikers.GetDebianSharedHostPackageName(c)
};
@ -142,5 +214,10 @@ namespace Microsoft.DotNet.Cli.Build
.Execute()
.EnsureSuccessful();
}
private static bool DebuildNotPresent()
{
return Cmd("/usr/bin/env", "debuild", "-h").Execute().ExitCode != 0;
}
}
}

View file

@ -29,6 +29,8 @@ namespace Microsoft.DotNet.Cli.Build
private static string SdkBundle { get; set; }
private static string HostFxrMsi { get; set; }
private static string SharedHostMsi { get; set; }
private static string SharedFrameworkMsi { get; set; }
@ -82,6 +84,7 @@ namespace Microsoft.DotNet.Cli.Build
SdkEngine = GetEngineName(SdkBundle);
SharedFrameworkMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"), "msi");
HostFxrMsi = Path.ChangeExtension(c.BuildContext.Get<string>("HostFxrInstallerFile"), "msi");
SharedHostMsi = Path.ChangeExtension(c.BuildContext.Get<string>("SharedHostInstallerFile"), "msi");
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
@ -134,7 +137,7 @@ namespace Microsoft.DotNet.Cli.Build
Cmd("powershell", "-NoProfile", "-NoLogo",
Path.Combine(Dirs.RepoRoot, "packaging", "windows", "clisdk", "generatebundle.ps1"),
SdkMsi, SharedFrameworkMsi, SharedHostMsi, SdkBundle, WixRoot, cliSdkBrandName, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
SdkMsi, SharedFrameworkMsi, HostFxrMsi, SharedHostMsi, SdkBundle, WixRoot, cliSdkBrandName, MsiVersion, CliDisplayVersion, CliNugetVersion, upgradeCode, Arch)
.EnvironmentVariable("Stage2Dir", Dirs.Stage2)
.Execute()
.EnsureSuccessful();

View file

@ -13,7 +13,8 @@ namespace Microsoft.DotNet.Cli.Build
{
public static readonly string[] ProjectsToPack = new string[]
{
"dotnet-compile-fsc",
// TODO: https://github.com/dotnet/cli/issues/3558
// "dotnet-compile-fsc",
"Microsoft.DotNet.Cli.Utils",
"Microsoft.DotNet.Compiler.Common",
"Microsoft.DotNet.Files",
@ -27,6 +28,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target(nameof(PackageTargets.CopyCLISDKLayout),
nameof(PackageTargets.CopySharedHostLayout),
nameof(PackageTargets.CopyHostFxrLayout),
nameof(PackageTargets.CopySharedFxLayout),
nameof(PackageTargets.CopyCombinedFrameworkSDKHostLayout),
nameof(PackageTargets.CopyCombinedFrameworkSDKLayout))]
@ -102,6 +104,23 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
public static BuildTargetResult CopyHostFxrLayout(BuildTargetContext c)
{
var hostFxrRoot = Path.Combine(Dirs.Output, "obj", "hostFxr");
if (Directory.Exists(hostFxrRoot))
{
Utils.DeleteDirectory(hostFxrRoot);
}
Directory.CreateDirectory(hostFxrRoot);
Utils.CopyDirectoryRecursively(Path.Combine(Dirs.Stage2, "host"), hostFxrRoot, true);
FixPermissions(hostFxrRoot);
c.BuildContext["HostFxrPublishRoot"] = hostFxrRoot;
return c.Success();
}
[Target]
public static BuildTargetResult CopySharedFxLayout(BuildTargetContext c)
{
@ -137,6 +156,9 @@ namespace Microsoft.DotNet.Cli.Build
string sharedHostPublishRoot = c.BuildContext.Get<string>("SharedHostPublishRoot");
Utils.CopyDirectoryRecursively(sharedHostPublishRoot, combinedRoot);
string hostFxrPublishRoot = c.BuildContext.Get<string>("HostFxrPublishRoot");
Utils.CopyDirectoryRecursively(hostFxrPublishRoot, combinedRoot);
c.BuildContext["CombinedFrameworkSDKHostRoot"] = combinedRoot;
return c.Success();
}
@ -199,7 +221,6 @@ namespace Microsoft.DotNet.Cli.Build
var packagingBuildBasePath = Path.Combine(Dirs.Stage2Compilation, "forPackaging");
FS.Mkdirp(Dirs.PackagesIntermediate);
FS.Mkdirp(Dirs.Packages);
foreach (var projectName in ProjectsToPack)
@ -210,24 +231,13 @@ namespace Microsoft.DotNet.Cli.Build
projectFile,
"--no-build",
"--build-base-path", packagingBuildBasePath,
"--output", Dirs.PackagesIntermediate,
"--output", Dirs.Packages,
"--configuration", configuration,
"--version-suffix", versionSuffix)
.Execute()
.EnsureSuccessful();
}
var packageFiles = Directory.EnumerateFiles(Dirs.PackagesIntermediate, "*.nupkg");
foreach (var packageFile in packageFiles)
{
if (!packageFile.EndsWith(".symbols.nupkg"))
{
var destinationPath = Path.Combine(Dirs.Packages, Path.GetFileName(packageFile));
File.Copy(packageFile, destinationPath, overwrite: true);
}
}
return c.Success();
}

View file

@ -20,6 +20,7 @@ namespace Microsoft.DotNet.Cli.Build
public static string CLISdkComponentId { get; set; }
public static string CLISdkPkgId { get; set; }
public static string CLISdkNugetVersion { get; set; }
public static string HostFxrComponentId { get; set; }
[Target]
[BuildPlatforms(BuildPlatform.OSX)]
@ -29,6 +30,7 @@ namespace Microsoft.DotNet.Cli.Build
Directory.CreateDirectory(PkgsIntermediateDir);
SharedHostComponentId = $"com.microsoft.dotnet.sharedhost.component.osx.x64";
HostFxrComponentId = $"com.microsoft.dotnet.hostfxr.component.osx.x64";
string sharedFrameworkNugetName = Monikers.SharedFrameworkName;
SharedFrameworkNugetVersion = CliDependencyVersions.SharedFrameworkVersion;
@ -59,10 +61,12 @@ namespace Microsoft.DotNet.Cli.Build
// Copy SharedFX and host installers in the correct place
var sharedFrameworkPkgIntermediatePath = Path.Combine(PkgsIntermediateDir, $"{SharedFxComponentId}.pkg");
var sharedHostPkgIntermediatePath = Path.Combine(PkgsIntermediateDir, $"{SharedHostComponentId}.pkg");
var hostFxrPkgIntermediatePath = Path.Combine(PkgsIntermediateDir, $"{HostFxrComponentId}.pkg");
File.Copy(c.BuildContext.Get<string>("SharedFrameworkInstallerFile"), sharedFrameworkPkgIntermediatePath, true);
File.Copy(c.BuildContext.Get<string>("SharedHostInstallerFile"), sharedHostPkgIntermediatePath, true);
File.Copy(c.BuildContext.Get<string>("HostFxrInstallerFile"), hostFxrPkgIntermediatePath, true);
string inputDistTemplatePath = Path.Combine(
Dirs.RepoRoot,
@ -75,11 +79,13 @@ namespace Microsoft.DotNet.Cli.Build
string formattedDistContents =
distTemplate.Replace("{SharedFxComponentId}", SharedFxComponentId)
.Replace("{SharedHostComponentId}", SharedHostComponentId)
.Replace("{HostFxrComponentId}", HostFxrComponentId)
.Replace("{CLISdkComponentId}", CLISdkComponentId)
.Replace("{CLISdkNugetVersion}", CLISdkNugetVersion)
.Replace("{CLISdkBrandName}", Monikers.CLISdkBrandName)
.Replace("{SharedFxBrandName}", Monikers.SharedFxBrandName)
.Replace("{SharedHostBrandName}", Monikers.SharedHostBrandName);
.Replace("{SharedHostBrandName}", Monikers.SharedHostBrandName)
.Replace("{HostFxrBrandName}", Monikers.HostFxrBrandName);
File.WriteAllText(distributionPath, formattedDistContents);
Cmd("productbuild",

View file

@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Cli.Build
{
public class PrepareTargets
{
[Target(nameof(Init), nameof(DownloadHostAndSharedFxArtifacts), nameof(RestorePackages))]
[Target(nameof(Init), nameof(DownloadHostAndSharedFxArtifacts), nameof(RestorePackages), nameof(ZipTemplates))]
public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success();
[Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))]
@ -35,9 +35,9 @@ namespace Microsoft.DotNet.Cli.Build
// All major targets will depend on this in order to ensure variables are set up right if they are run independently
[Target(
nameof(GenerateVersions),
nameof(CheckPrereqs),
nameof(LocateStage0),
nameof(GenerateVersions),
nameof(CheckPrereqs),
nameof(LocateStage0),
nameof(ExpectedBuildArtifacts),
nameof(SetTelemetryProfile))]
public static BuildTargetResult Init(BuildTargetContext c)
@ -75,9 +75,9 @@ namespace Microsoft.DotNet.Cli.Build
ReleaseSuffix = branchInfo["RELEASE_SUFFIX"],
CommitCount = commitCount
};
c.BuildContext["BuildVersion"] = buildVersion;
c.BuildContext["BranchName"] = branchInfo["BRANCH_NAME"];
c.BuildContext["CommitHash"] = commitHash;
c.Info($"Building Version: {buildVersion.SimpleVersion} (NuGet Packages: {buildVersion.NuGetVersion})");
@ -86,6 +86,26 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target]
public static BuildTargetResult ZipTemplates(BuildTargetContext c)
{
var templateDirectories = Directory.GetDirectories(
Path.Combine(Dirs.RepoRoot, "src", "dotnet", "commands", "dotnet-new"));
foreach (var directory in templateDirectories)
{
var zipFile = Path.Combine(Path.GetDirectoryName(directory), Path.GetFileName(directory) + ".zip");
if (File.Exists(zipFile))
{
File.Delete(zipFile);
}
ZipFile.CreateFromDirectory(directory, zipFile);
}
return c.Success();
}
[Target]
public static BuildTargetResult LocateStage0(BuildTargetContext c)
{
@ -121,6 +141,7 @@ namespace Microsoft.DotNet.Cli.Build
var cliVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
var sharedFrameworkVersion = CliDependencyVersions.SharedFrameworkVersion;
var hostVersion = CliDependencyVersions.SharedHostVersion;
var hostFxrVersion = CliDependencyVersions.HostFxrVersion;
// Generated Installers + Archives
AddInstallerArtifactToContext(c, "dotnet-sdk", "Sdk", cliVersion);
@ -130,6 +151,7 @@ namespace Microsoft.DotNet.Cli.Build
//Downloaded Installers + Archives
AddInstallerArtifactToContext(c, "dotnet-host", "SharedHost", hostVersion);
AddInstallerArtifactToContext(c, "dotnet-hostfxr", "HostFxr", hostFxrVersion);
AddInstallerArtifactToContext(c, "dotnet-sharedframework", "SharedFramework", sharedFrameworkVersion);
AddInstallerArtifactToContext(c, "dotnet", "CombinedFrameworkHost", sharedFrameworkVersion);
@ -137,8 +159,8 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target(
nameof(ExpectedBuildArtifacts),
nameof(DownloadHostAndSharedFxArchives),
nameof(ExpectedBuildArtifacts),
nameof(DownloadHostAndSharedFxArchives),
nameof(DownloadHostAndSharedFxInstallers))]
public static BuildTargetResult DownloadHostAndSharedFxArtifacts(BuildTargetContext c) => c.Success();
@ -187,22 +209,21 @@ namespace Microsoft.DotNet.Cli.Build
[BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX, BuildPlatform.Ubuntu)]
public static BuildTargetResult DownloadHostAndSharedFxInstallers(BuildTargetContext c)
{
if (CurrentPlatform.IsUbuntu && !CurrentPlatform.IsVersion("14.04"))
{
return c.Success();
}
var sharedFrameworkVersion = CliDependencyVersions.SharedFrameworkVersion;
var hostVersion = CliDependencyVersions.SharedHostVersion;
var hostFxrVersion = CliDependencyVersions.HostFxrVersion;
var sharedFrameworkChannel = CliDependencyVersions.SharedFrameworkChannel;
var sharedHostChannel = CliDependencyVersions.SharedHostChannel;
var hostFxrChannel = CliDependencyVersions.HostFxrChannel;
var sharedFrameworkInstallerDownloadFile = Path.Combine(CliDirs.CoreSetupDownload, "sharedFrameworkInstaller");
var sharedHostInstallerDownloadFile = Path.Combine(CliDirs.CoreSetupDownload, "sharedHostInstaller");
var hostFxrInstallerDownloadFile = Path.Combine(CliDirs.CoreSetupDownload, "hostFxrInstaller");
Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerDownloadFile));
Mkdirp(Path.GetDirectoryName(sharedHostInstallerDownloadFile));
Mkdirp(Path.GetDirectoryName(hostFxrInstallerDownloadFile));
if ( ! File.Exists(sharedFrameworkInstallerDownloadFile))
{
@ -234,6 +255,21 @@ namespace Microsoft.DotNet.Cli.Build
File.Copy(sharedHostInstallerDownloadFile, sharedHostInstallerDestinationFile, true);
}
if ( ! File.Exists(hostFxrInstallerDownloadFile))
{
var hostFxrInstallerDestinationFile = c.BuildContext.Get<string>("HostFxrInstallerFile");
Mkdirp(Path.GetDirectoryName(hostFxrInstallerDestinationFile));
AzurePublisher.DownloadFile(
AzurePublisher.CalculateInstallerBlob(
hostFxrInstallerDestinationFile,
hostFxrChannel,
hostFxrVersion),
hostFxrInstallerDownloadFile).Wait();
File.Copy(hostFxrInstallerDownloadFile, hostFxrInstallerDestinationFile, true);
}
return c.Success();
}
@ -241,21 +277,9 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult CheckPackageCache(BuildTargetContext c)
{
var ciBuild = string.Equals(Environment.GetEnvironmentVariable("CI_BUILD"), "1", StringComparison.Ordinal);
if (ciBuild)
{
// On CI, HOME is redirected under the repo, which gets deleted after every build.
// So make NUGET_PACKAGES outside of the repo.
var nugetPackages = Path.GetFullPath(Path.Combine(c.BuildContext.BuildDirectory, "..", ".nuget", "packages"));
Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetPackages);
Dirs.NuGetPackages = nugetPackages;
}
// Set the package cache location in NUGET_PACKAGES just to be safe
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_PACKAGES")))
{
Environment.SetEnvironmentVariable("NUGET_PACKAGES", Dirs.NuGetPackages);
}
// Always set the package cache location local to the build
Environment.SetEnvironmentVariable("NUGET_PACKAGES", Dirs.NuGetPackages);
CleanNuGetTempCache();
@ -487,8 +511,8 @@ cmake is required to build the native host 'corehost'";
}
private static void AddInstallerArtifactToContext(
BuildTargetContext c,
string artifactPrefix,
BuildTargetContext c,
string artifactPrefix,
string contextPrefix,
string version)
{

View file

@ -15,8 +15,6 @@ namespace Microsoft.DotNet.Cli.Build
private static string Channel { get; set; }
private static string CliVersion { get; set; }
private static string CliNuGetVersion { get; set; }
private static string SharedFrameworkNugetVersion { get; set; }
@ -27,7 +25,6 @@ namespace Microsoft.DotNet.Cli.Build
AzurePublisherTool = new AzurePublisher();
DebRepoPublisherTool = new DebRepoPublisher(Dirs.Packages);
CliVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
CliNuGetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
SharedFrameworkNugetVersion = CliDependencyVersions.SharedFrameworkVersion;
Channel = c.BuildContext.Get<string>("Channel");
@ -107,6 +104,8 @@ namespace Microsoft.DotNet.Cli.Build
{
AzurePublisherTool.PublishStringToBlob($"{Channel}/dnvm/latest.{version}", cliVersion);
}
UpdateVersionsRepo(c);
}
finally
{
@ -180,7 +179,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target(
nameof(PublishTargets.PublishInstallerFilesToAzure),
nameof(PublishTargets.PublishArchivesToAzure),
/*nameof(PublishTargets.PublishDebFilesToDebianRepo),*/ //https://github.com/dotnet/cli/issues/2973
nameof(PublishTargets.PublishDebFilesToDebianRepo),
nameof(PublishTargets.PublishCliVersionBadge))]
public static BuildTargetResult PublishArtifacts(BuildTargetContext c) => c.Success();
@ -197,7 +196,7 @@ namespace Microsoft.DotNet.Cli.Build
[Target(
nameof(PublishSdkDebToDebianRepo))]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishDebFilesToDebianRepo(BuildTargetContext c)
{
return c.Success();
@ -213,7 +212,7 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSdkInstallerFileToAzure(BuildTargetContext c)
{
var version = CliNuGetVersion;
@ -271,7 +270,7 @@ namespace Microsoft.DotNet.Cli.Build
}
[Target]
[BuildPlatforms(BuildPlatform.Ubuntu, "14.04")]
[BuildPlatforms(BuildPlatform.Ubuntu)]
public static BuildTargetResult PublishSdkDebToDebianRepo(BuildTargetContext c)
{
var version = CliNuGetVersion;
@ -288,17 +287,15 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success();
}
[Target(nameof(PrepareTargets.Init))]
public static BuildTargetResult UpdateVersionsRepo(BuildTargetContext c)
private static void UpdateVersionsRepo(BuildTargetContext c)
{
string githubAuthToken = EnvVars.EnsureVariable("GITHUB_PASSWORD");
string nupkgFilePath = EnvVars.EnsureVariable("NUPKG_FILE_PATH");
string versionsRepoPath = EnvVars.EnsureVariable("VERSIONS_REPO_PATH");
string nupkgFilePath = Dirs.Packages;
string branchName = c.BuildContext.Get<string>("BranchName");
string versionsRepoPath = $"build-info/dotnet/cli/{branchName}/Latest";
VersionRepoUpdater repoUpdater = new VersionRepoUpdater(githubAuthToken);
repoUpdater.UpdatePublishedVersions(nupkgFilePath, versionsRepoPath).Wait();
return c.Success();
}
}
}

View file

@ -24,7 +24,8 @@ namespace Microsoft.DotNet.Cli.Build
"dotnet-build.Tests",
"dotnet-compile.Tests",
"dotnet-compile.UnitTests",
"dotnet-compile-fsc.Tests",
// TODO: https://github.com/dotnet/cli/issues/3558
// "dotnet-compile-fsc.Tests",
"dotnet-new.Tests",
"dotnet-pack.Tests",
"dotnet-projectmodel-server.Tests",
@ -39,7 +40,9 @@ namespace Microsoft.DotNet.Cli.Build
"Microsoft.DotNet.Cli.Utils.Tests",
"Microsoft.DotNet.Compiler.Common.Tests",
"Microsoft.DotNet.ProjectModel.Tests",
"Microsoft.DotNet.ProjectModel.Loader.Tests",
"Microsoft.Extensions.DependencyModel.Tests",
"Microsoft.DotNet.Configurer.UnitTests",
"Performance"
};

View file

@ -10,6 +10,21 @@ param(
[switch]$NoPackage,
[switch]$Help)
function RemoveDirectory([string] $path)
{
if (Test-Path $path)
{
Remove-Item $path -Recurse -Force
}
}
function CleanNuGet()
{
RemoveDirectory($env:LocalAppData + "\NuGet\Cache")
RemoveDirectory($env:LocalAppData + "\NuGet\v3-cache")
RemoveDirectory($env:NUGET_PACKAGES)
}
if($Help)
{
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Targets <TARGETS...>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]"
@ -25,6 +40,7 @@ if($Help)
$env:CONFIGURATION = $Configuration;
$RepoRoot = "$PSScriptRoot\..\.."
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
if($NoPackage)
{
@ -64,6 +80,12 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
# Ensure clean package folder and caches
CleanNuGet
# Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts
Write-Host "Restoring Build Script projects..."
pushd "$PSScriptRoot\.."

View file

@ -56,6 +56,9 @@ while [[ $# > 0 ]]; do
shift
done
# Set nuget package cache under the repo
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
# Set up the environment to be used for building with clang.
if which "clang-3.5" > /dev/null 2>&1; then
export CC="$(which clang-3.5)"
@ -98,6 +101,14 @@ then
ulimit -n 1024
fi
# Clean old NuGet packages
rm -rf "$HOME/.local/share/NuGet/Cache"
rm -rf "$HOME/.local/share/NuGet/v3-cache"
rm -rf "$NUGET_PACKAGES"
# Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts
echo "Restoring Build Script projects..."
(

View file

@ -5,15 +5,15 @@
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.6.0-rc3-24201-00",
"Microsoft.NETCore.Runtime": "1.0.2-rc3-24201-00",
"Microsoft.CSharp": "4.0.1-rc3-24201-00",
"System.Dynamic.Runtime": "4.0.11-rc3-24201-00",
"System.Reflection.Metadata": "1.3.0-rc3-24201-00",
"System.Runtime.Serialization.Primitives": "4.1.1-rc3-24201-00",
"System.Xml.XmlSerializer": "4.0.11-rc3-24201-00",
"NETStandard.Library": "1.6.0",
"Microsoft.NETCore.Runtime.CoreCLR": "1.0.2",
"Microsoft.CSharp": "4.0.1",
"System.Dynamic.Runtime": "4.0.11",
"System.Reflection.Metadata": "1.3.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Xml.XmlSerializer": "4.0.11",
"WindowsAzure.Storage": "6.2.2-preview",
"NuGet.CommandLine.XPlat": "3.5.0-rc-1285",
"NuGet.CommandLine.XPlat": "3.5.0-beta2-1484",
"Microsoft.DotNet.Cli.Build.Framework": {
"target": "project"
},