From 078d6a8d5f9c6a5bcd341b81ec30fc144bfc768a Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 15 Feb 2016 09:42:17 -0800 Subject: [PATCH 1/4] Build and project cleanup --- scripts/dotnet-cli-build/CompileTargets.cs | 9 ++- scripts/dotnet-cli-build/PrepareTargets.cs | 15 ++-- scripts/dotnet-cli-build/TestTargets.cs | 10 +-- src/Microsoft.DotNet.Cli.Utils/project.json | 11 ++- .../project.json | 14 ++-- src/Microsoft.DotNet.Files/project.json | 53 ++++++------- .../project.json | 2 +- .../project.json | 2 +- .../project.json | 43 +++++----- src/Microsoft.DotNet.Runtime/project.json | 6 +- .../project.json | 79 +++++++++---------- .../project.json | 54 ++++++------- 12 files changed, 151 insertions(+), 147 deletions(-) diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index 000244524..ef3ec06f8 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -127,6 +127,7 @@ namespace Microsoft.DotNet.Cli.Build 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( @@ -210,7 +211,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 +220,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,7 +235,7 @@ namespace Microsoft.DotNet.Cli.Build // Copy AppDeps result = CopyAppDeps(c, binDir); - if(!result.Success) + if (!result.Success) { return result; } diff --git a/scripts/dotnet-cli-build/PrepareTargets.cs b/scripts/dotnet-cli-build/PrepareTargets.cs index abd94ba68..dc4905c9d 100644 --- a/scripts/dotnet-cli-build/PrepareTargets.cs +++ b/scripts/dotnet-cli-build/PrepareTargets.cs @@ -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(); 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]; diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index 6937781f8..463281f60 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -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() @@ -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"); diff --git a/src/Microsoft.DotNet.Cli.Utils/project.json b/src/Microsoft.DotNet.Cli.Utils/project.json index 65f76a078..72eeaa107 100644 --- a/src/Microsoft.DotNet.Cli.Utils/project.json +++ b/src/Microsoft.DotNet.Cli.Utils/project.json @@ -9,13 +9,18 @@ "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" }, "frameworks": { - "net451": {}, + "net451": { + "frameworkAssemblies": { + "System.Runtime": { + "type": "build" + } + } + }, "dnxcore50": { "imports": "portable-net45+win8", "dependencies": { "NETStandard.Library": "1.0.0-rc2-23811" } } - }, - "scripts": {} + } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.Compiler.Common/project.json b/src/Microsoft.DotNet.Compiler.Common/project.json index 597117d84..d1c8437f3 100644 --- a/src/Microsoft.DotNet.Compiler.Common/project.json +++ b/src/Microsoft.DotNet.Compiler.Common/project.json @@ -1,23 +1,23 @@ { "version": "1.0.0-*", - "compilationOptions": { "keyFile": "../../tools/Key.snk" }, - "dependencies": { "NETStandard.Library": "1.0.0-rc2-23811", "System.CommandLine": "0.1.0-e160119-1", - "Microsoft.CodeAnalysis.CSharp": "1.2.0-beta1-20160202-02", + "Microsoft.CodeAnalysis.CSharp": "1.2.0-beta1-20160202-02", "Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*", - "Microsoft.DotNet.Files": {"version": "1.0.0-*", "target": "project"} + "Microsoft.DotNet.Files": { + "version": "1.0.0-*", + "target": "project" + } }, "frameworks": { "dnxcore50": { "imports": "portable-net45+win8" } }, - "scripts": { - } -} + "scripts": {} +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Files/project.json b/src/Microsoft.DotNet.Files/project.json index 256bc8562..119323e51 100644 --- a/src/Microsoft.DotNet.Files/project.json +++ b/src/Microsoft.DotNet.Files/project.json @@ -1,31 +1,26 @@ { - "version": "1.0.0-*", - "compilationOptions": { - "keyFile": "../../tools/Key.snk" - }, - "description": "Abstraction to interact with the file system and file paths.", - "dependencies": { - "NETStandard.Library": "1.0.0-rc2-23811", - "System.Linq.Expressions": "4.0.11-rc2-23811", - - "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996", - - "Microsoft.DotNet.Cli.Utils": { - "type": "build", - "version": "1.0.0-*" + "version": "1.0.0-*", + "compilationOptions": { + "keyFile": "../../tools/Key.snk" }, - - "Microsoft.DotNet.ProjectModel": { - "type": "build", - "version": "1.0.0-*" - } - }, - - "frameworks": { - "dnxcore50": { - "imports": "portable-net45+win8" - } - }, - "scripts": { - } -} + "description": "Abstraction to interact with the file system and file paths.", + "dependencies": { + "NETStandard.Library": "1.0.0-rc2-23811", + "System.Linq.Expressions": "4.0.11-rc2-23811", + "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996", + "Microsoft.DotNet.Cli.Utils": { + "type": "build", + "version": "1.0.0-*" + }, + "Microsoft.DotNet.ProjectModel": { + "type": "build", + "version": "1.0.0-*" + } + }, + "frameworks": { + "dnxcore50": { + "imports": "portable-net45+win8" + } + }, + "scripts": {} +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectModel.Loader/project.json b/src/Microsoft.DotNet.ProjectModel.Loader/project.json index ad7f763ea..75b1ce0ce 100644 --- a/src/Microsoft.DotNet.ProjectModel.Loader/project.json +++ b/src/Microsoft.DotNet.ProjectModel.Loader/project.json @@ -13,4 +13,4 @@ "imports": "portable-net45+win8" } } -} +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectModel.Workspaces/project.json b/src/Microsoft.DotNet.ProjectModel.Workspaces/project.json index af109b793..63dd15c8e 100644 --- a/src/Microsoft.DotNet.ProjectModel.Workspaces/project.json +++ b/src/Microsoft.DotNet.ProjectModel.Workspaces/project.json @@ -14,4 +14,4 @@ "imports": "portable-net45+win8" } } -} +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.ProjectModel/project.json b/src/Microsoft.DotNet.ProjectModel/project.json index a83b39c74..71e4647f4 100644 --- a/src/Microsoft.DotNet.ProjectModel/project.json +++ b/src/Microsoft.DotNet.ProjectModel/project.json @@ -5,8 +5,7 @@ }, "description": "Types to model a .NET Project", "dependencies": { - "System.Reflection.Metadata": "1.2.0-rc3-23811", - + "System.Reflection.Metadata": "1.2.0-rc3-23811", "NuGet.Packaging": "3.4.0-beta-583", "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996", "Microsoft.Extensions.JsonParser.Sources": { @@ -23,23 +22,29 @@ } }, "frameworks": { - "net451": { - "frameworkAssemblies": { - "System.IO": "" - } - }, + "net451": { + "frameworkAssemblies": { + "System.Runtime": { + "type": "build" + }, + "System.Collections": { + "type": "build" + }, + "System.IO": { + "type": "build" + } + } + }, "dnxcore50": { - "imports": "portable-net45+win8", - "dependencies": { - "NETStandard.Library": "1.0.0-rc2-23811", - "System.Dynamic.Runtime": "4.0.11-rc2-23811", - "System.Runtime.Loader": "4.0.0-rc2-23811", - "System.Security.Cryptography.Algorithms": "4.0.0-rc2-23811", - "Microsoft.CSharp": "4.0.1-rc2-23811", - "System.Xml.XDocument": "4.0.11-rc2-23811" + "imports": "portable-net45+win8", + "dependencies": { + "NETStandard.Library": "1.0.0-rc2-23811", + "System.Dynamic.Runtime": "4.0.11-rc2-23811", + "System.Runtime.Loader": "4.0.0-rc2-23811", + "System.Security.Cryptography.Algorithms": "4.0.0-rc2-23811", + "Microsoft.CSharp": "4.0.1-rc2-23811", + "System.Xml.XDocument": "4.0.11-rc2-23811" + } } } - }, - "scripts": { - } -} +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Runtime/project.json b/src/Microsoft.DotNet.Runtime/project.json index 3c49af54d..cca2c5c83 100644 --- a/src/Microsoft.DotNet.Runtime/project.json +++ b/src/Microsoft.DotNet.Runtime/project.json @@ -3,14 +3,12 @@ "compilationOptions": { "emitEntryPoint": true }, - "dependencies": { - "NETStandard.Library" : "1.0.0-rc2-23811" + "NETStandard.Library": "1.0.0-rc2-23811" }, - "frameworks": { "dnxcore50": { "imports": "portable-net45+win8" } } -} +} \ No newline at end of file diff --git a/src/Microsoft.Extensions.DependencyModel/project.json b/src/Microsoft.Extensions.DependencyModel/project.json index 82df91b47..01e65852d 100644 --- a/src/Microsoft.Extensions.DependencyModel/project.json +++ b/src/Microsoft.Extensions.DependencyModel/project.json @@ -1,42 +1,41 @@ { - "description": "Abstractions for reading `.deps` files.", - "version": "1.0.0-*", - "repository": { - "type": "git", - "url": "git://github.com/dotnet/cli" - }, - "compilationOptions": { - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" - }, - "dependencies": { - "Newtonsoft.Json": "7.0.1", - "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" - }, - "frameworks": { - "net451": { }, - "dotnet5.4": { - "imports": "portable-net451+win8", - "dependencies": { - "System.IO.FileSystem": "4.0.1-rc2-23811", - "System.Linq": "4.0.1-rc2-23811", - "System.Runtime": "4.0.21-rc2-23811", - "System.Reflection": "4.1.0-rc2-23811", - "System.Dynamic.Runtime": "4.0.11-rc2-23811" - } + "description": "Abstractions for reading `.deps` files.", + "version": "1.0.0-*", + "repository": { + "type": "git", + "url": "git://github.com/dotnet/cli" }, - "dnxcore50": { - "imports": "portable-net45+win8", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1-rc2-23811", - "System.IO.FileSystem": "4.0.1-rc2-23811", - "System.Linq": "4.0.1-rc2-23811", - "System.Runtime": "4.0.21-rc2-23811", - "System.Reflection": "4.1.0-rc2-23811", - "System.Dynamic.Runtime": "4.0.11-rc2-23811" - } - } - }, - "scripts": { - } -} + "compilationOptions": { + "warningsAsErrors": true, + "keyFile": "../../tools/Key.snk" + }, + "dependencies": { + "Newtonsoft.Json": "7.0.1", + "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537" + }, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "imports": "portable-net451+win8", + "dependencies": { + "System.IO.FileSystem": "4.0.1-rc2-23811", + "System.Linq": "4.0.1-rc2-23811", + "System.Runtime": "4.0.21-rc2-23811", + "System.Reflection": "4.1.0-rc2-23811", + "System.Dynamic.Runtime": "4.0.11-rc2-23811" + } + }, + "dnxcore50": { + "imports": "portable-net45+win8", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.0.1-rc2-23811", + "System.IO.FileSystem": "4.0.1-rc2-23811", + "System.Linq": "4.0.1-rc2-23811", + "System.Runtime": "4.0.21-rc2-23811", + "System.Reflection": "4.1.0-rc2-23811", + "System.Dynamic.Runtime": "4.0.11-rc2-23811" + } + } + }, + "scripts": {} +} \ No newline at end of file diff --git a/src/Microsoft.Extensions.Testing.Abstractions/project.json b/src/Microsoft.Extensions.Testing.Abstractions/project.json index 889044a2f..2748f3a2b 100644 --- a/src/Microsoft.Extensions.Testing.Abstractions/project.json +++ b/src/Microsoft.Extensions.Testing.Abstractions/project.json @@ -1,29 +1,29 @@ { - "description": "Abstractions for test runners to communicate to a tool, such as Visual Studio.", - "version": "1.0.0-*", - "repository": { - "type": "git", - "url": "git://github.com/dotnet/cli" - }, - "compilationOptions": { - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" - }, - "dependencies": { - "Newtonsoft.Json": "7.0.1", - "Microsoft.DotNet.ProjectModel": "1.0.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16040" - }, - "frameworks": { - "net451": { }, - "dnxcore50": { - "imports": "portable-net45+win8", - "dependencies": { - "NETStandard.Library": "1.0.0-rc2-23811", - "System.Resources.ResourceManager": "4.0.1-rc2-23811", - "System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811" - } - } - }, - "scripts": { } + "description": "Abstractions for test runners to communicate to a tool, such as Visual Studio.", + "version": "1.0.0-*", + "repository": { + "type": "git", + "url": "git://github.com/dotnet/cli" + }, + "compilationOptions": { + "warningsAsErrors": true, + "keyFile": "../../tools/Key.snk" + }, + "dependencies": { + "Newtonsoft.Json": "7.0.1", + "Microsoft.DotNet.ProjectModel": "1.0.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16040" + }, + "frameworks": { + "net451": {}, + "dnxcore50": { + "imports": "portable-net45+win8", + "dependencies": { + "NETStandard.Library": "1.0.0-rc2-23811", + "System.Resources.ResourceManager": "4.0.1-rc2-23811", + "System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811" + } + } + }, + "scripts": {} } \ No newline at end of file From c7e9139fa69c0347524ec1d7380b074eca49953d Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 15 Feb 2016 10:07:39 -0800 Subject: [PATCH 2/4] More build cleanup and tweaks - Added generic Get to build context --- .../BuildContext.cs | 2 ++ scripts/dotnet-cli-build/CompileTargets.cs | 14 +++++++------- scripts/dotnet-cli-build/PublishTargets.cs | 8 ++++---- scripts/dotnet-cli-build/TestTargets.cs | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildContext.cs b/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildContext.cs index 312fdd6ce..a7b059ce0 100644 --- a/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildContext.cs +++ b/scripts/Microsoft.DotNet.Cli.Build.Framework/BuildContext.cs @@ -33,6 +33,8 @@ namespace Microsoft.DotNet.Cli.Build.Framework _maxTargetLen = targets.Values.Select(t => t.Name.Length).Max(); } + public T Get(string name) => (T)this[name]; + public BuildTargetResult RunTarget(string name) => RunTarget(name, force: false); public BuildTargetResult RunTarget(string name, bool force) diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index ef3ec06f8..1f346ef74 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -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; @@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Cli.Build Rmdir(cmakeOut); Mkdirp(cmakeOut); - var configuration = (string)c.BuildContext["Configuration"]; + var configuration = c.BuildContext.Get("Configuration"); // Run the build if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -120,7 +120,7 @@ namespace Microsoft.DotNet.Cli.Build [Target] public static BuildTargetResult CompileStage2(BuildTargetContext c) { - var configuration = (string)c.BuildContext["Configuration"]; + var configuration = c.BuildContext.Get("Configuration"); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src")); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test")); @@ -161,7 +161,7 @@ namespace Microsoft.DotNet.Cli.Build dotnet.SetDotNetHome(); - var configuration = (string)c.BuildContext["Configuration"]; + var configuration = c.BuildContext.Get("Configuration"); var binDir = Path.Combine(outputDir, "bin"); var runtimeOutputDir = Path.Combine(outputDir, "runtime", "coreclr"); @@ -241,7 +241,7 @@ namespace Microsoft.DotNet.Cli.Build } // Generate .version file - var version = ((BuildVersion)c.BuildContext["BuildVersion"]).SimpleVersion; + var version = c.BuildContext.Get("BuildVersion").SimpleVersion; var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}"; File.WriteAllText(Path.Combine(outputDir, ".version"), content); diff --git a/scripts/dotnet-cli-build/PublishTargets.cs b/scripts/dotnet-cli-build/PublishTargets.cs index e7dbe752b..7330f8c7b 100644 --- a/scripts/dotnet-cli-build/PublishTargets.cs +++ b/scripts/dotnet-cli-build/PublishTargets.cs @@ -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"); var env = new Dictionary() { { "RID", PlatformServices.Default.Runtime.GetRuntimeIdentifier() }, diff --git a/scripts/dotnet-cli-build/TestTargets.cs b/scripts/dotnet-cli-build/TestTargets.cs index 463281f60..b325e22a2 100644 --- a/scripts/dotnet-cli-build/TestTargets.cs +++ b/scripts/dotnet-cli-build/TestTargets.cs @@ -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 { @@ -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("Configuration"); var dotnet = DotNetCli.Stage2; c.Info("Publishing MultiProjectValidator"); From 50e7a8b71a8f243c3a878c9702337b351d3f8dc8 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 15 Feb 2016 10:22:47 -0800 Subject: [PATCH 3/4] Remove setting of DOTNET_HOME during compile --- scripts/dotnet-cli-build/CompileTargets.cs | 2 -- scripts/dotnet-cli-build/Utils/DotNetCli.cs | 5 ----- 2 files changed, 7 deletions(-) diff --git a/scripts/dotnet-cli-build/CompileTargets.cs b/scripts/dotnet-cli-build/CompileTargets.cs index 1f346ef74..ae89b80b4 100644 --- a/scripts/dotnet-cli-build/CompileTargets.cs +++ b/scripts/dotnet-cli-build/CompileTargets.cs @@ -159,8 +159,6 @@ namespace Microsoft.DotNet.Cli.Build { Rmdir(outputDir); - dotnet.SetDotNetHome(); - var configuration = c.BuildContext.Get("Configuration"); var binDir = Path.Combine(outputDir, "bin"); var runtimeOutputDir = Path.Combine(outputDir, "runtime", "coreclr"); diff --git a/scripts/dotnet-cli-build/Utils/DotNetCli.cs b/scripts/dotnet-cli-build/Utils/DotNetCli.cs index 51e194504..67d30fa8b 100644 --- a/scripts/dotnet-cli-build/Utils/DotNetCli.cs +++ b/scripts/dotnet-cli-build/Utils/DotNetCli.cs @@ -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)); From 467cd196627912675459de5901ba0e8de617b5a9 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 15 Feb 2016 10:52:29 -0800 Subject: [PATCH 4/4] Fixed the build dependencies in project.json --- src/Microsoft.DotNet.Compiler.Common/project.json | 5 +---- src/Microsoft.DotNet.Files/project.json | 10 ++-------- src/Microsoft.DotNet.ProjectModel/project.json | 5 +---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.DotNet.Compiler.Common/project.json b/src/Microsoft.DotNet.Compiler.Common/project.json index d1c8437f3..d5cdc889e 100644 --- a/src/Microsoft.DotNet.Compiler.Common/project.json +++ b/src/Microsoft.DotNet.Compiler.Common/project.json @@ -9,10 +9,7 @@ "Microsoft.CodeAnalysis.CSharp": "1.2.0-beta1-20160202-02", "Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*", - "Microsoft.DotNet.Files": { - "version": "1.0.0-*", - "target": "project" - } + "Microsoft.DotNet.Files": "1.0.0-*" }, "frameworks": { "dnxcore50": { diff --git a/src/Microsoft.DotNet.Files/project.json b/src/Microsoft.DotNet.Files/project.json index 119323e51..11ee828db 100644 --- a/src/Microsoft.DotNet.Files/project.json +++ b/src/Microsoft.DotNet.Files/project.json @@ -8,14 +8,8 @@ "NETStandard.Library": "1.0.0-rc2-23811", "System.Linq.Expressions": "4.0.11-rc2-23811", "Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996", - "Microsoft.DotNet.Cli.Utils": { - "type": "build", - "version": "1.0.0-*" - }, - "Microsoft.DotNet.ProjectModel": { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.DotNet.Cli.Utils": "1.0.0-*", + "Microsoft.DotNet.ProjectModel": "1.0.0-*" }, "frameworks": { "dnxcore50": { diff --git a/src/Microsoft.DotNet.ProjectModel/project.json b/src/Microsoft.DotNet.ProjectModel/project.json index 71e4647f4..54b6b53eb 100644 --- a/src/Microsoft.DotNet.ProjectModel/project.json +++ b/src/Microsoft.DotNet.ProjectModel/project.json @@ -16,10 +16,7 @@ "type": "build", "version": "1.0.0-rc2-16054" }, - "Microsoft.Extensions.DependencyModel": { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.Extensions.DependencyModel": "1.0.0-*" }, "frameworks": { "net451": {