Move CompilerOptions onto TargetFrameworkInformation

This commit is contained in:
David Fowler 2015-10-17 08:36:22 -07:00
parent b2ebe529bd
commit fa3cf52f10
3 changed files with 7 additions and 19 deletions

View file

@ -17,7 +17,6 @@ namespace Microsoft.Extensions.ProjectModel
// REVIEW: It's kinda hacky making these internal but the reader needs to set them // REVIEW: It's kinda hacky making these internal but the reader needs to set them
internal Dictionary<NuGetFramework, TargetFrameworkInformation> _targetFrameworks = new Dictionary<NuGetFramework, TargetFrameworkInformation>(); internal Dictionary<NuGetFramework, TargetFrameworkInformation> _targetFrameworks = new Dictionary<NuGetFramework, TargetFrameworkInformation>();
internal Dictionary<NuGetFramework, CompilerOptions> _compilerOptionsByFramework = new Dictionary<NuGetFramework, CompilerOptions>();
internal Dictionary<string, CompilerOptions> _compilerOptionsByConfiguration = new Dictionary<string, CompilerOptions>(StringComparer.OrdinalIgnoreCase); internal Dictionary<string, CompilerOptions> _compilerOptionsByConfiguration = new Dictionary<string, CompilerOptions>(StringComparer.OrdinalIgnoreCase);
internal CompilerOptions _defaultCompilerOptions; internal CompilerOptions _defaultCompilerOptions;
@ -186,13 +185,7 @@ namespace Microsoft.Extensions.ProjectModel
private CompilerOptions GetCompilerOptions(NuGetFramework frameworkName) private CompilerOptions GetCompilerOptions(NuGetFramework frameworkName)
{ {
CompilerOptions options; return GetTargetFramework(frameworkName)?.CompilerOptions;
if (_compilerOptionsByFramework.TryGetValue(frameworkName, out options))
{
return options;
}
return null;
} }
} }
} }

View file

@ -417,7 +417,8 @@ namespace Microsoft.Extensions.ProjectModel
var targetFrameworkInformation = new TargetFrameworkInformation var targetFrameworkInformation = new TargetFrameworkInformation
{ {
FrameworkName = frameworkName, FrameworkName = frameworkName,
Dependencies = new List<LibraryRange>() Dependencies = new List<LibraryRange>(),
CompilerOptions = compilerOptions
}; };
var frameworkDependencies = new List<LibraryRange>(); var frameworkDependencies = new List<LibraryRange>();
@ -449,7 +450,6 @@ namespace Microsoft.Extensions.ProjectModel
targetFrameworkInformation.PdbPath = binNode.ValueAsString("pdb"); targetFrameworkInformation.PdbPath = binNode.ValueAsString("pdb");
} }
project._compilerOptionsByFramework[frameworkName] = compilerOptions;
project._targetFrameworks[frameworkName] = targetFrameworkInformation; project._targetFrameworks[frameworkName] = targetFrameworkInformation;
return true; return true;

View file

@ -7,24 +7,19 @@ using NuGet.Frameworks;
namespace Microsoft.Extensions.ProjectModel namespace Microsoft.Extensions.ProjectModel
{ {
public class TargetFrameworkInformation : IFrameworkTargetable public class TargetFrameworkInformation
{ {
public NuGetFramework FrameworkName { get; set; } public NuGetFramework FrameworkName { get; set; }
public IReadOnlyList<LibraryRange> Dependencies { get; set; } public IReadOnlyList<LibraryRange> Dependencies { get; set; }
public CompilerOptions CompilerOptions { get; set; }
// REVIEW: Wrapping, we might do this differntly
public string WrappedProject { get; set; } public string WrappedProject { get; set; }
public string AssemblyPath { get; set; } public string AssemblyPath { get; set; }
public string PdbPath { get; set; } public string PdbPath { get; set; }
public IEnumerable<NuGetFramework> SupportedFrameworks
{
get
{
return new[] { FrameworkName };
}
}
} }
} }