Some PR feedback, cleaning up namespaces.

This commit is contained in:
piotrp 2016-01-04 23:12:40 -08:00
parent ef0fc05119
commit cb90b1122c
15 changed files with 28 additions and 38 deletions

View file

@ -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

View file

@ -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
{

View file

@ -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
{

View file

@ -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<LibraryExport> 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)

View file

@ -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
{

View file

@ -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<string> values)
{

View file

@ -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<string> GenerateLines(LibraryExport export, IEnumerable<LibraryAsset> 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,

View file

@ -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;

View file

@ -14,7 +14,7 @@
"Microsoft.DotNet.Cli.Utils": {
"type": "build",
"version": "1.0.0-*"
},
}
},
"frameworks": {
"dnxcore50": { }

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{

View file

@ -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;

View file

@ -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
{

View file

@ -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