Merge branch 'rel/1.0.0' of https://github.com/dotnet/cli into test-fx
This commit is contained in:
commit
ab455e6bb9
58 changed files with 1123 additions and 456 deletions
|
@ -33,6 +33,8 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
|||
_maxTargetLen = targets.Values.Select(t => t.Name.Length).Max();
|
||||
}
|
||||
|
||||
public T Get<T>(string name) => (T)this[name];
|
||||
|
||||
public BuildTargetResult RunTarget(string name) => RunTarget(name, force: false);
|
||||
|
||||
public BuildTargetResult RunTarget(string name, bool force)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.FS;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
public class CompileTargets
|
||||
{
|
||||
public static readonly string CoreCLRVersion = "1.0.1-rc2-23811";
|
||||
public static readonly string AppDepSdkVersion = "1.0.5-prerelease-00001";
|
||||
public static readonly string AppDepSdkVersion = "1.0.6-prerelease-00001";
|
||||
|
||||
public static readonly List<string> AssembliesToCrossGen = GetAssembliesToCrossGen();
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
Rmdir(cmakeOut);
|
||||
Mkdirp(cmakeOut);
|
||||
|
||||
var configuration = (string)c.BuildContext["Configuration"];
|
||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||
|
||||
// Run the build
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
|
@ -120,13 +120,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Target]
|
||||
public static BuildTargetResult CompileStage2(BuildTargetContext c)
|
||||
{
|
||||
var configuration = (string)c.BuildContext["Configuration"];
|
||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||
|
||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
|
||||
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
|
||||
var result = CompileStage(c,
|
||||
dotnet: DotNetCli.Stage1,
|
||||
outputDir: Dirs.Stage2);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
|
@ -137,7 +138,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
var packagingOutputDir = Path.Combine(Dirs.Stage2Compilation, "forPackaging");
|
||||
Mkdirp(packagingOutputDir);
|
||||
foreach(var project in ProjectsToPack)
|
||||
foreach (var project in ProjectsToPack)
|
||||
{
|
||||
// Just build them, we'll pack later
|
||||
DotNetCli.Stage1.Build(
|
||||
|
@ -158,9 +159,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
Rmdir(outputDir);
|
||||
|
||||
dotnet.SetDotNetHome();
|
||||
|
||||
var configuration = (string)c.BuildContext["Configuration"];
|
||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||
var binDir = Path.Combine(outputDir, "bin");
|
||||
var runtimeOutputDir = Path.Combine(outputDir, "runtime", "coreclr");
|
||||
|
||||
|
@ -210,7 +209,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
File.Copy(Path.Combine(Dirs.Corehost, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), Path.Combine(binDir, $"{Constants.DynamicLibPrefix}hostpolicy{Constants.DynamicLibSuffix}"), overwrite: true);
|
||||
|
||||
// Corehostify binaries
|
||||
foreach(var binaryToCorehostify in BinariesForCoreHost)
|
||||
foreach (var binaryToCorehostify in BinariesForCoreHost)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -219,7 +218,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
File.Delete(Path.Combine(binDir, $"{binaryToCorehostify}.exe"));
|
||||
File.Copy(Path.Combine(binDir, $"corehost{Constants.ExeSuffix}"), Path.Combine(binDir, binaryToCorehostify + Constants.ExeSuffix));
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
return c.Failed($"Failed to corehostify '{binaryToCorehostify}': {ex.ToString()}");
|
||||
}
|
||||
|
@ -234,14 +233,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
// Copy AppDeps
|
||||
result = CopyAppDeps(c, binDir);
|
||||
if(!result.Success)
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
// Generate .version file
|
||||
var version = ((BuildVersion)c.BuildContext["BuildVersion"]).SimpleVersion;
|
||||
var content = $@"{version}{Environment.NewLine}{c.BuildContext["CommitHash"]}{Environment.NewLine}";
|
||||
var version = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion;
|
||||
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
|
||||
File.WriteAllText(Path.Combine(outputDir, ".version"), content);
|
||||
|
||||
return c.Success();
|
||||
|
@ -356,7 +355,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
foreach (var assemblyToCrossgen in AssembliesToCrossGen)
|
||||
{
|
||||
c.Info($"Crossgenning {assemblyToCrossgen}");
|
||||
ExecIn(outputDir, crossgen, "-nologo", "-platform_assemblies_paths", outputDir, assemblyToCrossgen);
|
||||
ExecInSilent(outputDir, crossgen, "-nologo", "-platform_assemblies_paths", outputDir, assemblyToCrossgen);
|
||||
}
|
||||
|
||||
c.Info("Crossgen complete");
|
||||
|
|
|
@ -25,10 +25,11 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
var configEnv = Environment.GetEnvironmentVariable("CONFIGURATION");
|
||||
|
||||
if(string.IsNullOrEmpty(configEnv))
|
||||
if (string.IsNullOrEmpty(configEnv))
|
||||
{
|
||||
configEnv = "Debug";
|
||||
}
|
||||
|
||||
c.BuildContext["Configuration"] = configEnv;
|
||||
|
||||
c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}");
|
||||
|
@ -160,22 +161,22 @@ cmake is required to build the native host 'corehost'";
|
|||
try
|
||||
{
|
||||
// Read the cache file
|
||||
if(File.Exists(cacheTimeFile))
|
||||
if (File.Exists(cacheTimeFile))
|
||||
{
|
||||
var content = File.ReadAllText(cacheTimeFile);
|
||||
if(!string.IsNullOrEmpty(content))
|
||||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
cacheTime = DateTime.ParseExact("O", content, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
c.Warn($"Error reading NuGet cache time file, leaving the cache alone");
|
||||
c.Warn($"Error Detail: {ex.ToString()}");
|
||||
}
|
||||
|
||||
if(cacheTime == null || (cacheTime.Value.AddHours(cacheExpiration) < DateTime.UtcNow))
|
||||
if (cacheTime == null || (cacheTime.Value.AddHours(cacheExpiration) < DateTime.UtcNow))
|
||||
{
|
||||
// Cache has expired or the status is unknown, clear it and write the file
|
||||
c.Info("Clearing NuGet cache");
|
||||
|
@ -204,9 +205,9 @@ cmake is required to build the native host 'corehost'";
|
|||
var lines = File.ReadAllLines(path);
|
||||
var dict = new Dictionary<string, string>();
|
||||
c.Verbose("Branch Info:");
|
||||
foreach(var line in lines)
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if(!line.Trim().StartsWith("#") && !string.IsNullOrWhiteSpace(line))
|
||||
if (!line.Trim().StartsWith("#") && !string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
var splat = line.Split(new[] { '=' }, 2);
|
||||
dict[splat[0]] = splat[1];
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
// Set up the environment variables previously defined by common.sh/ps1
|
||||
// This is overkill, but I want to cover all the variables used in all OSes (including where some have the same names)
|
||||
var buildVersion = (BuildVersion)c.BuildContext["BuildVersion"];
|
||||
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
|
||||
var env = new Dictionary<string, string>()
|
||||
{
|
||||
{ "RID", PlatformServices.Default.Runtime.GetRuntimeIdentifier() },
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.FS;
|
||||
using static Microsoft.DotNet.Cli.Build.Utils;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
using static Microsoft.DotNet.Cli.Build.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
foreach (var relativePath in TestPackageProjects)
|
||||
{
|
||||
var fullPath = Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestPackages", relativePath.Replace('/', Path.DirectorySeparatorChar));
|
||||
c.Info("Packing: {fullPath}");
|
||||
c.Info($"Packing: {fullPath}");
|
||||
dotnet.Pack("--output", Dirs.TestPackages)
|
||||
.WorkingDirectory(fullPath)
|
||||
.Execute()
|
||||
|
@ -95,7 +95,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
var dotnet = DotNetCli.Stage2;
|
||||
foreach (var testProject in TestProjects)
|
||||
{
|
||||
c.Info("Building tests: {project}");
|
||||
c.Info($"Building tests: {testProject}");
|
||||
dotnet.Build()
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "test", testProject))
|
||||
.Execute()
|
||||
|
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
{
|
||||
// Need to load up the VS Vars
|
||||
var dotnet = DotNetCli.Stage2;
|
||||
var vsvars = LoadVsVars();
|
||||
var vsvars = LoadVsVars(c);
|
||||
|
||||
// Copy the test projects
|
||||
var testProjectsDir = Path.Combine(Dirs.TestOutput, "TestProjects");
|
||||
|
@ -155,17 +155,17 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
var consumers = Path.Combine(c.BuildContext.BuildDirectory, "test", "PackagedCommands", "Consumers");
|
||||
|
||||
// Compile the consumer apps
|
||||
foreach(var dir in Directory.EnumerateDirectories(consumers))
|
||||
foreach (var dir in Directory.EnumerateDirectories(consumers))
|
||||
{
|
||||
dotnet.Build().WorkingDirectory(dir).Execute().EnsureSuccessful();
|
||||
}
|
||||
|
||||
// Test the apps
|
||||
foreach(var dir in Directory.EnumerateDirectories(consumers))
|
||||
foreach (var dir in Directory.EnumerateDirectories(consumers))
|
||||
{
|
||||
var result = dotnet.Exec("hello").WorkingDirectory(dir).CaptureStdOut().CaptureStdErr().Execute();
|
||||
result.EnsureSuccessful();
|
||||
if(!string.Equals("Hello", result.StdOut.Trim(), StringComparison.Ordinal))
|
||||
if (!string.Equals("Hello", result.StdOut.Trim(), StringComparison.Ordinal))
|
||||
{
|
||||
var testName = Path.GetFileName(dir);
|
||||
c.Error($"Packaged Commands Test '{testName}' failed");
|
||||
|
@ -180,7 +180,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Target]
|
||||
public static BuildTargetResult ValidateDependencies(BuildTargetContext c)
|
||||
{
|
||||
var configuration = (string)c.BuildContext["Configuration"];
|
||||
var configuration = c.BuildContext.Get<string>("Configuration");
|
||||
var dotnet = DotNetCli.Stage2;
|
||||
|
||||
c.Info("Publishing MultiProjectValidator");
|
||||
|
@ -197,12 +197,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
return c.Success();
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> LoadVsVars()
|
||||
private static Dictionary<string, string> LoadVsVars(BuildTargetContext c)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
c.Verbose("Start Collecting Visual Studio Environment Variables");
|
||||
|
||||
var vsvarsPath = Path.GetFullPath(Path.Combine(Environment.GetEnvironmentVariable("VS140COMNTOOLS"), "..", "..", "VC"));
|
||||
|
||||
|
@ -228,13 +230,27 @@ set");
|
|||
File.Delete(temp);
|
||||
}
|
||||
}
|
||||
|
||||
result.EnsureSuccessful();
|
||||
|
||||
var vars = new Dictionary<string, string>();
|
||||
foreach (var line in result.StdOut.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
var splat = line.Split(new[] { '=' }, 2);
|
||||
vars[splat[0]] = splat[1];
|
||||
|
||||
if (splat.Length == 2)
|
||||
{
|
||||
c.Verbose($"Adding variable '{line}'");
|
||||
vars[splat[0]] = splat[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
c.Info($"Skipping VS Env Variable. Unknown format: '{line}'");
|
||||
}
|
||||
}
|
||||
|
||||
c.Verbose("Finish Collecting Visual Studio Environment Variables");
|
||||
|
||||
return vars;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,6 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
BinPath = binPath;
|
||||
}
|
||||
|
||||
public void SetDotNetHome()
|
||||
{
|
||||
Environment.SetEnvironmentVariable("DOTNET_HOME", Path.GetDirectoryName(BinPath));
|
||||
}
|
||||
|
||||
public Command Exec(string command, params string[] args)
|
||||
{
|
||||
return Command.Create(Path.Combine(BinPath, $"dotnet{Constants.ExeSuffix}"), Enumerable.Concat(new[] { command }, args));
|
||||
|
|
|
@ -51,13 +51,18 @@ function CheckRequiredVariables
|
|||
|
||||
function UploadFile($Blob, $Uploadfile)
|
||||
{
|
||||
Write-Host "Uploading $Uploadfile to dotnet feed to.."
|
||||
Write-Host "Uploading $Uploadfile to dotnet feed."
|
||||
|
||||
if([string]::IsNullOrEmpty($env:HOME))
|
||||
{
|
||||
$env:HOME=Get-Location
|
||||
}
|
||||
|
||||
# use azure cli to upload to blob storage. We cannot use Invoke-WebRequest to do this becuase azure has a max limit of 64mb that can be uploaded using REST
|
||||
#$statusCode = (Invoke-WebRequest -URI "$Upload_URI" -Method PUT -Headers @{"x-ms-blob-type"="BlockBlob"; "x-ms-date"="2015-10-23";"x-ms-version"="2013-08-15"} -InFile $Uploadfile).StatusCode
|
||||
azure storage blob upload --quiet --container $env:STORAGE_CONTAINER --blob $Blob --blobtype block --connection-string "$env:CONNECTION_STRING" --file $Uploadfile | Out-Host
|
||||
|
||||
if($LastExitCode -eq 0)
|
||||
if($?)
|
||||
{
|
||||
Write-Host "Successfully uploaded $Uploadfile to dotnet feed."
|
||||
return $true
|
||||
|
@ -140,10 +145,10 @@ function UploadVersionBadge($badgeFile)
|
|||
$fileName = "windows_$Configuration_$([System.IO.Path]::GetFileName($badgeFile))"
|
||||
|
||||
Write-Host "Uploading the version badge to Latest"
|
||||
UploadFile "dev/Binaries/Latest/$filename" $badgeFile
|
||||
UploadFile "$env:CHANNEL/Binaries/Latest/$fileName" $badgeFile
|
||||
|
||||
Write-Host "Uploading the version badge to $env:DOTNET_CLI_VERSION"
|
||||
UploadFile "dev/Binaries/$env:DOTNET_CLI_VERSION/$filename" $badgeFile
|
||||
UploadFile "$env:CHANNEL/Binaries/$env:DOTNET_CLI_VERSION/$fileName" $badgeFile
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -192,12 +192,12 @@ upload_installers_to_blob_storage(){
|
|||
|
||||
upload_version_badge(){
|
||||
local badgefile=$1
|
||||
local filename="$OSNAME_$CONFIGURATION_$(basename $badgefile)"
|
||||
local filename="${OSNAME}_${CONFIGURATION}_$(basename $badgefile)"
|
||||
echo "Uploading the version badge to Latest"
|
||||
upload_file_to_blob_storage_azure_cli "dev/Binaries/Latest/$filename" $badgefile
|
||||
upload_file_to_blob_storage_azure_cli "$CHANNEL/Binaries/Latest/$filename" $badgefile
|
||||
|
||||
echo "Uploading the version badge to $DOTNET_CLI_VERSION"
|
||||
upload_file_to_blob_storage_azure_cli "dev/Binaries/$DOTNET_CLI_VERSION/$filename" $badgefile
|
||||
upload_file_to_blob_storage_azure_cli "$CHANNEL/Binaries/$DOTNET_CLI_VERSION/$filename" $badgefile
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue