Merge pull request #3963 from livarcocc/compare_ignore_case

Compare ignore case
This commit is contained in:
Livar 2016-07-29 00:31:22 -07:00 committed by GitHub
commit 7d74c31aa8
16 changed files with 45 additions and 29 deletions

View file

@ -8,9 +8,9 @@
<CoreCLRRid Condition=" '$(OSName)' == 'osx' ">osx.10.10-x64</CoreCLRRid>
<CoreCLRRid Condition=" '$(OSName)' == 'centos' OR '$(OSName)' == 'rhel' ">rhel.7-x64</CoreCLRRid>
<CrossGenPackageName>runtime.$(CoreCLRRid).Microsoft.NETCore.Runtime.CoreCLR</CrossGenPackageName>
<LibCLRJitPackageName>runtime.$(CoreCLRRid).Microsoft.NETCore.Jit</LibCLRJitPackageName>
<CoreCLRPackageName>runtime.$(CoreCLRRid).Microsoft.NETCore.Runtime.CoreCLR</CoreCLRPackageName>
<CrossGenPackageName>runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr</CrossGenPackageName>
<LibCLRJitPackageName>runtime.$(CoreCLRRid).microsoft.netcore.jit</LibCLRJitPackageName>
<CoreCLRPackageName>runtime.$(CoreCLRRid).microsoft.netcore.runtime.coreclr</CoreCLRPackageName>
<CoreCLRLibsDir>$(NuGetPackagesDir)/$(CoreCLRPackageName)/$(CoreCLRVersion)/runtimes/$(CoreCLRRid)/lib/netstandard1.0</CoreCLRLibsDir>
<CrossgenPath>$(NuGetPackagesDir)/$(CrossGenPackageName)/$(CoreCLRVersion)/tools/crossgen$(ExeExtension)</CrossgenPath>

View file

@ -58,6 +58,8 @@
<PreTestProjectsToExclude Include="test$(PathSeparator)**$(PathSeparator)bin$(PathSeparator)**$(PathSeparator)project.json" />
<PreTestProjectsToExclude Include="test$(PathSeparator)dotnet-build3.Tests$(PathSeparator)project.json" />
<TestProjectsToExclude Include="%(PreTestProjectsToExclude.RelativeDir)project.json" />
<PreTestProjects Include="test$(PathSeparator)**$(PathSeparator)project.json;" />

View file

@ -77,6 +77,6 @@ if (!(Test-Path "$DOTNET_LOCAL_PATH"))
}
# Initialize build tools
cmd /c "$BUILD_TOOLS_PACKAGE_PATH\init-tools.cmd $RepoRoot $env:DOTNET_INSTALL_DIR\dotnet.exe $BUILD_TOOLS_PATH" >> "$INIT_TOOLS_LOG"
cmd /c "$BUILD_TOOLS_PACKAGE_PATH\init-tools.cmd $RepoRoot $DOTNET_LOCAL_PATH\dotnet.exe $BUILD_TOOLS_PATH" >> "$INIT_TOOLS_LOG"
Write-Host "Done initializing tools."
Write-Host "Init-Tools completed for BuildTools Version: $BUILD_TOOLS_VERSION" > $BUILD_TOOLS_SEMAPHORE

View file

@ -24,7 +24,7 @@ __BUILD_TOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.j
__BUILD_TOOLS_PACKAGE_VERSION=$(cat $DIR/BuildToolsVersion.txt)
__BUILD_TOOLS_PATH=$NUGET_PACKAGES/Microsoft.DotNet.BuildTools/$__BUILD_TOOLS_PACKAGE_VERSION/lib
__BUILD_TOOLS_SEMAPHORE=$__BUILD_TOOLS_DIR/init-tools.completed
__DOTNET_CMD=$DOTNET_INSTALL_DIR/dotnet
__DOTNET_CMD=$__BUILD_TOOLS_CLI_DIR/dotnet
__PROJECT_JSON_PATH=$__BUILD_TOOLS_DIR/$__BUILD_TOOLS_PACKAGE_VERSION
__PROJECT_JSON_FILE=$__PROJECT_JSON_PATH/project.json
__PROJECT_JSON_CONTENTS="{ \"dependencies\": { \"Microsoft.DotNet.BuildTools\": \"$__BUILD_TOOLS_PACKAGE_VERSION\" }, \"frameworks\": { \"netcoreapp1.0\": { } } }"
@ -33,18 +33,18 @@ if [ ! -e "$__PROJECT_JSON_FILE" ]; then
mkdir -p "$__PROJECT_JSON_PATH"
echo "$__PROJECT_JSON_CONTENTS" > "$__PROJECT_JSON_FILE"
if [ ! -d "$__BUILD_TOOLS_CLI_DIR" ]; then
echo "Installing Build Tools CLI Version: $__BUILD_TOOLS_CLI_VERSION"
"$DIR/scripts/obtain/dotnet-install.sh" --channel rel-1.0.0 --version "$__BUILD_TOOLS_CLI_VERSION" --install-dir "$__BUILD_TOOLS_CLI_DIR"
fi
if [ ! -d "$__BUILD_TOOLS_PATH" ]; then
echo "Restoring build tools version $__BUILD_TOOLS_PACKAGE_VERSION..."
"$__DOTNET_CMD" restore "$__PROJECT_JSON_FILE" --packages "$NUGET_PACKAGES" --source "$__BUILD_TOOLS_SOURCE"
if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."; fi
find .
fi
if [ ! -d "$__BUILD_TOOLS_CLI_DIR" ]; then
echo "Installing Build Tools CLI Version: $__BUILD_TOOLS_CLI_VERSION"
"$DIR/scripts/obtain/dotnet-install.sh" --channel rel-1.0.0 --version "$__BUILD_TOOLS_CLI_VERSION" --install-dir "$__BUILD_TOOLS_CLI_DIR"
fi
fi
echo "Initializing build tools..."
"$__BUILD_TOOLS_PATH/init-tools.sh" "$DIR" "$__DOTNET_CMD" "$__BUILD_TOOLS_DIR" >> "$__init_tools_log" 2>&1

View file

@ -158,7 +158,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
private void WriteDepsFileAndCopyProjectDependencies(LibraryExporter exporter, bool skipRuntimeConfig)
{
var exports = exporter.GetAllExports().ToList();
var exportsLookup = exports.ToDictionary(e => e.Library.Identity.Name);
var exportsLookup = exports.ToDictionary(e => e.Library.Identity.Name, StringComparer.OrdinalIgnoreCase);
var platformExclusionList = _context.GetPlatformExclusionList(exportsLookup);
var filteredExports = exports.FilterExports(platformExclusionList);

View file

@ -46,7 +46,7 @@ namespace Microsoft.Extensions.DependencyModel
.Select(export => export.Library.Identity)
.Distinct()
.Select(identity => new Dependency(identity.Name, identity.Version.ToString()))
.ToDictionary(dependency => dependency.Name);
.ToDictionary(dependency => dependency.Name, StringComparer.OrdinalIgnoreCase);
var compilationOptions = compilerOptions != null
? GetCompilationOptions(compilerOptions)

View file

@ -21,7 +21,10 @@ namespace Microsoft.DotNet.ProjectModel.Graph
_reader = reader;
var msbuildProjectLibraries = lockFile.ProjectLibraries.Where(MSBuildDependencyProvider.IsMSBuildProjectLibrary);
_msbuildTargetLibraries = msbuildProjectLibraries.ToDictionary(GetProjectLibraryKey, l => GetTargetsForLibrary(_lockFile, l));
_msbuildTargetLibraries = msbuildProjectLibraries.ToDictionary(
GetProjectLibraryKey,
l => GetTargetsForLibrary(_lockFile, l),
StringComparer.OrdinalIgnoreCase);
}
public void Patch()
@ -53,7 +56,7 @@ namespace Microsoft.DotNet.ProjectModel.Graph
throw new LockFilePatchingException($"Export file {exportFile.ExportFilePath} has a different version than the lock file {_lockFile.LockFilePath}");
}
var exportDict = exportFile.Exports.ToDictionary(GetTargetLibraryKey);
var exportDict = exportFile.Exports.ToDictionary(GetTargetLibraryKey, StringComparer.OrdinalIgnoreCase);
var uncoveredLibraries = _msbuildTargetLibraries.Keys.Except(exportDict.Keys);
if (uncoveredLibraries.Any())

View file

@ -588,7 +588,10 @@ namespace Microsoft.DotNet.ProjectModel
type = LibraryType.Package;
}
description = description ?? UnresolvedDependencyProvider.GetDescription(new LibraryRange(library.Name, type), target.TargetFramework);
description = description ??
UnresolvedDependencyProvider.GetDescription(
new LibraryRange(library.Name, type),
target.TargetFramework);
libraries.Add(new LibraryKey(library.Name), description);
}
@ -674,14 +677,14 @@ namespace Microsoft.DotNet.ProjectModel
{
var otherKey = (LibraryKey)obj;
return string.Equals(otherKey.Name, Name, StringComparison.Ordinal) &&
return string.Equals(otherKey.Name, Name, StringComparison.OrdinalIgnoreCase) &&
otherKey.LibraryType.Equals(LibraryType);
}
public override int GetHashCode()
{
var combiner = new HashCodeCombiner();
combiner.Add(Name);
combiner.Add(Name.ToLowerInvariant());
combiner.Add(LibraryType);
return combiner.CombinedHash;

View file

@ -67,7 +67,9 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
if (targetLibrary != null)
{
// The lock file entry might have a filtered set of dependencies
var lockFileDependencies = targetLibrary.Dependencies.ToDictionary(d => d.Id);
var lockFileDependencies = targetLibrary.Dependencies.ToDictionary(
d => d.Id,
StringComparer.OrdinalIgnoreCase);
// Remove all non-framework dependencies that don't appear in the lock file entry
dependencies.RemoveAll(m => !lockFileDependencies.ContainsKey(m.Name) && m.Target != LibraryType.ReferenceAssembly);

View file

@ -124,8 +124,8 @@ namespace Microsoft.Extensions.DependencyModel
private JObject WritePortableTarget(IReadOnlyList<RuntimeLibrary> runtimeLibraries, IReadOnlyList<CompilationLibrary> compilationLibraries)
{
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name);
var compileLookup = compilationLibraries.ToDictionary(l => l.Name);
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
var compileLookup = compilationLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
var targetObject = new JObject();

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Tools.Build
foreach (var context in contexts)
{
var libraries = context.LibraryManager.GetLibraries();
var lookup = libraries.ToDictionary(l => l.Identity.Name);
var lookup = libraries.ToDictionary(l => l.Identity.Name, StringComparer.OrdinalIgnoreCase);
var root = lookup[context.ProjectFile.Name];
yield return TraverseProject((ProjectDescription) root, lookup, context);
}

View file

@ -96,10 +96,13 @@ namespace Microsoft.DotNet.Tools.Compiler
public static List<CultureResgenIO> GetCultureResources(Project project, string outputPath)
{
return
(from resourceFileGroup in project.Files.ResourceFiles.GroupBy(resourceFile => ResourceUtility.GetResourceCultureName(resourceFile.Key))
(from resourceFileGroup in project.Files.ResourceFiles.GroupBy(
resourceFile => ResourceUtility.GetResourceCultureName(resourceFile.Key))
let culture = resourceFileGroup.Key
where !string.IsNullOrEmpty(culture)
let inputFileToMetadata = resourceFileGroup.ToDictionary(r => r.Key, r => GetResourceFileMetadataName(project, r.Key, r.Value))
let inputFileToMetadata = resourceFileGroup.ToDictionary(
r => r.Key,
r => GetResourceFileMetadataName(project, r.Key, r.Value))
let resourceOutputPath = Path.Combine(outputPath, culture)
let outputFile = Path.Combine(resourceOutputPath, project.Name + ".resources.dll")
select new CultureResgenIO(culture, inputFileToMetadata, outputFile)

View file

@ -126,7 +126,9 @@ namespace Microsoft.DotNet.Tools.Compiler
if (compilationOptions.PreserveCompilationContext == true)
{
var allExports = exporter.GetAllExports().ToList();
var exportsLookup = allExports.ToDictionary(e => e.Library.Identity.Name);
var exportsLookup = allExports.ToDictionary(
e => e.Library.Identity.Name,
StringComparer.OrdinalIgnoreCase);
var buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
var filteredExports = allExports
.Where(e => e.Library.Identity.Type.Equals(LibraryType.ReferenceAssembly) ||

View file

@ -134,7 +134,7 @@ namespace Microsoft.DotNet.Tools.Publish
var exports = exporter.GetAllExports();
var exportsLookup = exports.ToDictionary(e => e.Library.Identity.Name);
var exportsLookup = exports.ToDictionary(e => e.Library.Identity.Name, StringComparer.OrdinalIgnoreCase);
var platformExclusionList = context.GetPlatformExclusionList(exportsLookup);
var buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
var allExclusionList = new HashSet<string>(platformExclusionList);

View file

@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{
public class GivenDotNetUsesMSBuild : TestBase
{
[Fact]
[Fact(Skip="ResolveNuGetPackageAssets needs to be made case insensitive.")]
public void ItCanNewRestoreBuildRunMSBuildProject()
{
using (DisposableDirectory directory = Temp.CreateDirectory())

View file

@ -1,3 +1,4 @@
using System;
using System.Linq;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.DotNet.ProjectModel.Resolution;
@ -126,7 +127,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
.Build();
// Will fail with dupes if any
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name);
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name, StringComparer.OrdinalIgnoreCase);
}
[Fact]
@ -153,7 +154,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
.Build();
// Will fail with dupes if any
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name);
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name, StringComparer.OrdinalIgnoreCase);
}
}
}