diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResult.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResult.cs index c49c40c00..778d72316 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResult.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResult.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.IO; - namespace Microsoft.DotNet.Cli.Utils { public struct CommandResult diff --git a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs index 765f0126a..ab24413fb 100644 --- a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs +++ b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoFileGenerator.cs @@ -11,7 +11,7 @@ using System.IO; using System.Runtime.Versioning; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Microsoft.Dotnet.Cli.Compiler.Common +namespace Microsoft.DotNet.Cli.Compiler.Common { public class AssemblyInfoFileGenerator { diff --git a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoOptions.cs b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoOptions.cs index 3f2ddfd0e..0fe593c8d 100644 --- a/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoOptions.cs +++ b/src/Microsoft.DotNet.Compiler.Common/AssemblyInfoOptions.cs @@ -2,13 +2,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.DotNet.ProjectModel; -using System; using System.Collections.Generic; using System.CommandLine; -using System.Linq; using NuGet.Frameworks; -namespace Microsoft.Dotnet.Cli.Compiler.Common +namespace Microsoft.DotNet.Cli.Compiler.Common { public class AssemblyInfoOptions { diff --git a/src/Microsoft.DotNet.Cli.Utils/BindingRedirectGenerator.cs b/src/Microsoft.DotNet.Compiler.Common/BindingRedirectGenerator.cs similarity index 97% rename from src/Microsoft.DotNet.Cli.Utils/BindingRedirectGenerator.cs rename to src/Microsoft.DotNet.Compiler.Common/BindingRedirectGenerator.cs index a7236e9f3..a8477c5ee 100644 --- a/src/Microsoft.DotNet.Cli.Utils/BindingRedirectGenerator.cs +++ b/src/Microsoft.DotNet.Compiler.Common/BindingRedirectGenerator.cs @@ -12,9 +12,9 @@ using System.Text; using System.Xml.Linq; using Microsoft.DotNet.ProjectModel.Compilation; -namespace Microsoft.DotNet.Cli.Utils +namespace Microsoft.DotNet.Cli.Compiler.Common { - internal static class BindingRedirectGenerator + public static class BindingRedirectGenerator { private const int TokenLength = 8; private const string Namespace = "urn:schemas-microsoft-com:asm.v1"; @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Utils private static readonly XName OldVersionAttributeName = XName.Get("oldVersion"); private static readonly XName NewVersionAttributeName = XName.Get("newVersion"); - internal static SHA1 Sha1 { get; } = SHA1.Create(); + private static SHA1 Sha1 { get; } = SHA1.Create(); internal static XDocument GenerateBindingRedirects(this IEnumerable dependencies, XDocument document) { @@ -92,7 +92,7 @@ namespace Microsoft.DotNet.Cli.Utils (string)identity.Attribute(CultureAttributeName) == redirect.From.Culture; } - public static XElement GetOrAddElement(XContainer parent, XName elementName) + private static XElement GetOrAddElement(XContainer parent, XName elementName) { XElement element; if (parent.Element(elementName) != null) diff --git a/src/Microsoft.DotNet.Cli.Utils/CoreHost.cs b/src/Microsoft.DotNet.Compiler.Common/CoreHost.cs similarity index 89% rename from src/Microsoft.DotNet.Cli.Utils/CoreHost.cs rename to src/Microsoft.DotNet.Compiler.Common/CoreHost.cs index a1d027065..eb508105f 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CoreHost.cs +++ b/src/Microsoft.DotNet.Compiler.Common/CoreHost.cs @@ -1,7 +1,8 @@ using System.IO; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; -namespace Microsoft.DotNet.Cli.Utils +namespace Microsoft.DotNet.Cli.Compiler.Common { internal static class CoreHost { diff --git a/src/Microsoft.DotNet.Cli.Utils/CsvFormatter.cs b/src/Microsoft.DotNet.Compiler.Common/DepsFormatter.cs similarity index 83% rename from src/Microsoft.DotNet.Cli.Utils/CsvFormatter.cs rename to src/Microsoft.DotNet.Compiler.Common/DepsFormatter.cs index d5dcb0731..3406c9e3f 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CsvFormatter.cs +++ b/src/Microsoft.DotNet.Compiler.Common/DepsFormatter.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Linq; -namespace Microsoft.DotNet.Cli.Utils +namespace Microsoft.DotNet.Cli.Compiler.Common { - internal static class CsvFormatter + internal static class DepsFormatter { internal static string EscapeRow(IEnumerable values) { diff --git a/src/Microsoft.DotNet.Cli.Utils/LibraryExporterExtensions.cs b/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs similarity index 94% rename from src/Microsoft.DotNet.Cli.Utils/LibraryExporterExtensions.cs rename to src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs index 26cd3c6c1..2be231946 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LibraryExporterExtensions.cs +++ b/src/Microsoft.DotNet.Compiler.Common/LibraryExporterExtensions.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.IO; -using Microsoft.DotNet.ProjectModel.Compilation; using System.Linq; using Microsoft.DotNet.ProjectModel; +using Microsoft.DotNet.ProjectModel.Compilation; -namespace Microsoft.DotNet.Cli.Utils +namespace Microsoft.DotNet.Cli.Compiler.Common { internal static class LibraryExporterExtensions { @@ -30,7 +30,7 @@ namespace Microsoft.DotNet.Cli.Utils private static IEnumerable GenerateLines(LibraryExport export, IEnumerable items, string type) { - return items.Select(i => CsvFormatter.EscapeRow(new[] + return items.Select(i => DepsFormatter.EscapeRow(new[] { export.Library.Identity.Type.Value, export.Library.Identity.Name, diff --git a/src/Microsoft.DotNet.Cli.Utils/ProjectContextExtensions.cs b/src/Microsoft.DotNet.Compiler.Common/ProjectContextExtensions.cs similarity index 91% rename from src/Microsoft.DotNet.Cli.Utils/ProjectContextExtensions.cs rename to src/Microsoft.DotNet.Compiler.Common/ProjectContextExtensions.cs index 43988047d..f5a0420b0 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ProjectContextExtensions.cs +++ b/src/Microsoft.DotNet.Compiler.Common/ProjectContextExtensions.cs @@ -7,14 +7,16 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Linq; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; +using Microsoft.DotNet.ProjectModel.Compilation; using Microsoft.DotNet.ProjectModel.Graph; using Microsoft.DotNet.Tools.Common; using NuGet.Frameworks; -namespace Microsoft.DotNet.Cli.Utils +namespace Microsoft.DotNet.Cli.Compiler.Common { - internal static class ProjectContextExtensions + public static class ProjectContextExtensions { public static string ProjectName(this ProjectContext context) => context.RootProject.Identity.Name; @@ -60,7 +62,7 @@ namespace Microsoft.DotNet.Cli.Utils public static string GetDefaultRootOutputPath(ProjectContext context, string currentOutputPath) { - string rootOutputPath = string.Empty; + var rootOutputPath = string.Empty; if (string.IsNullOrEmpty(currentOutputPath)) { @@ -70,7 +72,7 @@ namespace Microsoft.DotNet.Cli.Utils return rootOutputPath; } - internal static void MakeCompilationOutputRunnable(this ProjectContext context, string outputPath, string configuration) + public static void MakeCompilationOutputRunnable(this ProjectContext context, string outputPath, string configuration) { context .ProjectFile @@ -88,7 +90,7 @@ namespace Microsoft.DotNet.Cli.Utils .SelectMany(e => e.RuntimeAssets()) .CopyTo(outputPath); - GenerateBindingRedirects(context, outputPath, configuration); + GenerateBindingRedirects(context, exporter, outputPath); } else { @@ -151,7 +153,7 @@ namespace Microsoft.DotNet.Cli.Utils } - private static void GenerateBindingRedirects(this ProjectContext context, string outputPath, string configuration) + private static void GenerateBindingRedirects(this ProjectContext context, LibraryExporter exporter, string outputPath) { var existingConfig = new DirectoryInfo(context.ProjectDirectory) .EnumerateFiles() @@ -167,7 +169,7 @@ namespace Microsoft.DotNet.Cli.Utils } } - var appConfig = context.CreateExporter(configuration).GetAllExports().GenerateBindingRedirects(baseAppConfig); + var appConfig = exporter.GetAllExports().GenerateBindingRedirects(baseAppConfig); if (appConfig == null) return; diff --git a/src/Microsoft.DotNet.Compiler.Common/project.json b/src/Microsoft.DotNet.Compiler.Common/project.json index 33a18ddb1..a3b6663d0 100644 --- a/src/Microsoft.DotNet.Compiler.Common/project.json +++ b/src/Microsoft.DotNet.Compiler.Common/project.json @@ -14,7 +14,7 @@ "Microsoft.DotNet.Cli.Utils": { "type": "build", "version": "1.0.0-*" - }, + } }, "frameworks": { "dnxcore50": { } diff --git a/src/Microsoft.DotNet.Tools.Builder/CompileContext.cs b/src/Microsoft.DotNet.Tools.Builder/CompileContext.cs index e06d4f82d..47ac12d30 100644 --- a/src/Microsoft.DotNet.Tools.Builder/CompileContext.cs +++ b/src/Microsoft.DotNet.Tools.Builder/CompileContext.cs @@ -10,7 +10,7 @@ using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; using Microsoft.DotNet.Tools.Compiler; using Microsoft.DotNet.ProjectModel.Utilities; - +using Microsoft.DotNet.Cli.Compiler.Common; namespace Microsoft.DotNet.Tools.Build { diff --git a/src/Microsoft.DotNet.Tools.Compiler.Csc/Program.cs b/src/Microsoft.DotNet.Tools.Compiler.Csc/Program.cs index 6633ecb44..2314c4a78 100644 --- a/src/Microsoft.DotNet.Tools.Compiler.Csc/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler.Csc/Program.cs @@ -4,7 +4,6 @@ using System; using System.CommandLine; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -13,7 +12,6 @@ using System.Text; using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; -using Microsoft.Dotnet.Cli.Compiler.Common; namespace Microsoft.DotNet.Tools.Compiler.Csc { diff --git a/src/Microsoft.DotNet.Tools.Compiler.Fsc/Program.cs b/src/Microsoft.DotNet.Tools.Compiler.Fsc/Program.cs index f9f12a2ad..9afc57280 100644 --- a/src/Microsoft.DotNet.Tools.Compiler.Fsc/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler.Fsc/Program.cs @@ -4,7 +4,6 @@ using System; using System.CommandLine; using System.Collections.Generic; -using System.Reflection; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -13,7 +12,6 @@ using System.Text; using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; -using Microsoft.Dotnet.Cli.Compiler.Common; namespace Microsoft.DotNet.Tools.Compiler.Fsc { diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index db565fe76..d08961c25 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -6,15 +6,10 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Xml.Linq; -using Microsoft.Dnx.Runtime.Common.CommandLine; -using Microsoft.Dotnet.Cli.Compiler.Common; -using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Compiler.Common; -using Microsoft.DotNet.Tools.Common; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; using Microsoft.DotNet.ProjectModel.Compilation; -using Microsoft.DotNet.ProjectModel.Graph; using Microsoft.DotNet.ProjectModel.Utilities; using NuGet.Frameworks; using Microsoft.Extensions.DependencyModel; diff --git a/src/Microsoft.DotNet.Tools.Resgen/Program.cs b/src/Microsoft.DotNet.Tools.Resgen/Program.cs index eacabc01f..65032267f 100644 --- a/src/Microsoft.DotNet.Tools.Resgen/Program.cs +++ b/src/Microsoft.DotNet.Tools.Resgen/Program.cs @@ -1,12 +1,12 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; using System.IO; using System.Linq; using Microsoft.Dnx.Runtime.Common.CommandLine; +using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Utils; -using System; -using Microsoft.Dotnet.Cli.Compiler.Common; namespace Microsoft.DotNet.Tools.Resgen { diff --git a/src/Microsoft.DotNet.Tools.Resgen/ResourceAssemblyGenerator.cs b/src/Microsoft.DotNet.Tools.Resgen/ResourceAssemblyGenerator.cs index 319e7baf4..c95a56dba 100644 --- a/src/Microsoft.DotNet.Tools.Resgen/ResourceAssemblyGenerator.cs +++ b/src/Microsoft.DotNet.Tools.Resgen/ResourceAssemblyGenerator.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; -using Microsoft.Dotnet.Cli.Compiler.Common; +using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Resgen