After NuGet started lower casing the packages, we started hitting issues where we failed to locate dependencies under our list of libraries due to different casing in the libraries names. The fix here is to compare the library names ignoring casing.
This commit is contained in:
parent
ad66b8935c
commit
b05b0e6dc5
13 changed files with 32 additions and 19 deletions
|
@ -77,6 +77,6 @@ if (!(Test-Path "$DOTNET_LOCAL_PATH"))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize build tools
|
# 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 $env:DOTNET_LOCAL_PATH\dotnet.exe $BUILD_TOOLS_PATH" >> "$INIT_TOOLS_LOG"
|
||||||
Write-Host "Done initializing tools."
|
Write-Host "Done initializing tools."
|
||||||
Write-Host "Init-Tools completed for BuildTools Version: $BUILD_TOOLS_VERSION" > $BUILD_TOOLS_SEMAPHORE
|
Write-Host "Init-Tools completed for BuildTools Version: $BUILD_TOOLS_VERSION" > $BUILD_TOOLS_SEMAPHORE
|
||||||
|
|
|
@ -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_PACKAGE_VERSION=$(cat $DIR/BuildToolsVersion.txt)
|
||||||
__BUILD_TOOLS_PATH=$NUGET_PACKAGES/Microsoft.DotNet.BuildTools/$__BUILD_TOOLS_PACKAGE_VERSION/lib
|
__BUILD_TOOLS_PATH=$NUGET_PACKAGES/Microsoft.DotNet.BuildTools/$__BUILD_TOOLS_PACKAGE_VERSION/lib
|
||||||
__BUILD_TOOLS_SEMAPHORE=$__BUILD_TOOLS_DIR/init-tools.completed
|
__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_PATH=$__BUILD_TOOLS_DIR/$__BUILD_TOOLS_PACKAGE_VERSION
|
||||||
__PROJECT_JSON_FILE=$__PROJECT_JSON_PATH/project.json
|
__PROJECT_JSON_FILE=$__PROJECT_JSON_PATH/project.json
|
||||||
__PROJECT_JSON_CONTENTS="{ \"dependencies\": { \"Microsoft.DotNet.BuildTools\": \"$__BUILD_TOOLS_PACKAGE_VERSION\" }, \"frameworks\": { \"netcoreapp1.0\": { } } }"
|
__PROJECT_JSON_CONTENTS="{ \"dependencies\": { \"Microsoft.DotNet.BuildTools\": \"$__BUILD_TOOLS_PACKAGE_VERSION\" }, \"frameworks\": { \"netcoreapp1.0\": { } } }"
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
|
||||||
private void WriteDepsFileAndCopyProjectDependencies(LibraryExporter exporter, bool skipRuntimeConfig)
|
private void WriteDepsFileAndCopyProjectDependencies(LibraryExporter exporter, bool skipRuntimeConfig)
|
||||||
{
|
{
|
||||||
var exports = exporter.GetAllExports().ToList();
|
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 platformExclusionList = _context.GetPlatformExclusionList(exportsLookup);
|
||||||
var filteredExports = exports.FilterExports(platformExclusionList);
|
var filteredExports = exports.FilterExports(platformExclusionList);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
.Select(export => export.Library.Identity)
|
.Select(export => export.Library.Identity)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.Select(identity => new Dependency(identity.Name, identity.Version.ToString()))
|
.Select(identity => new Dependency(identity.Name, identity.Version.ToString()))
|
||||||
.ToDictionary(dependency => dependency.Name);
|
.ToDictionary(dependency => dependency.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var compilationOptions = compilerOptions != null
|
var compilationOptions = compilerOptions != null
|
||||||
? GetCompilationOptions(compilerOptions)
|
? GetCompilationOptions(compilerOptions)
|
||||||
|
|
|
@ -21,7 +21,10 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
||||||
_reader = reader;
|
_reader = reader;
|
||||||
|
|
||||||
var msbuildProjectLibraries = lockFile.ProjectLibraries.Where(MSBuildDependencyProvider.IsMSBuildProjectLibrary);
|
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()
|
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}");
|
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);
|
var uncoveredLibraries = _msbuildTargetLibraries.Keys.Except(exportDict.Keys);
|
||||||
if (uncoveredLibraries.Any())
|
if (uncoveredLibraries.Any())
|
||||||
|
|
|
@ -588,7 +588,10 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
type = LibraryType.Package;
|
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);
|
libraries.Add(new LibraryKey(library.Name), description);
|
||||||
}
|
}
|
||||||
|
@ -674,14 +677,14 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
var otherKey = (LibraryKey)obj;
|
var otherKey = (LibraryKey)obj;
|
||||||
|
|
||||||
return string.Equals(otherKey.Name, Name, StringComparison.Ordinal) &&
|
return string.Equals(otherKey.Name, Name, StringComparison.OrdinalIgnoreCase) &&
|
||||||
otherKey.LibraryType.Equals(LibraryType);
|
otherKey.LibraryType.Equals(LibraryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
var combiner = new HashCodeCombiner();
|
var combiner = new HashCodeCombiner();
|
||||||
combiner.Add(Name);
|
combiner.Add(Name.ToLowerInvariant());
|
||||||
combiner.Add(LibraryType);
|
combiner.Add(LibraryType);
|
||||||
|
|
||||||
return combiner.CombinedHash;
|
return combiner.CombinedHash;
|
||||||
|
|
|
@ -67,7 +67,9 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
if (targetLibrary != null)
|
if (targetLibrary != null)
|
||||||
{
|
{
|
||||||
// The lock file entry might have a filtered set of dependencies
|
// 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
|
// 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);
|
dependencies.RemoveAll(m => !lockFileDependencies.ContainsKey(m.Name) && m.Target != LibraryType.ReferenceAssembly);
|
||||||
|
|
|
@ -124,8 +124,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
private JObject WritePortableTarget(IReadOnlyList<RuntimeLibrary> runtimeLibraries, IReadOnlyList<CompilationLibrary> compilationLibraries)
|
private JObject WritePortableTarget(IReadOnlyList<RuntimeLibrary> runtimeLibraries, IReadOnlyList<CompilationLibrary> compilationLibraries)
|
||||||
{
|
{
|
||||||
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name);
|
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
var compileLookup = compilationLibraries.ToDictionary(l => l.Name);
|
var compileLookup = compilationLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var targetObject = new JObject();
|
var targetObject = new JObject();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
foreach (var context in contexts)
|
foreach (var context in contexts)
|
||||||
{
|
{
|
||||||
var libraries = context.LibraryManager.GetLibraries();
|
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];
|
var root = lookup[context.ProjectFile.Name];
|
||||||
yield return TraverseProject((ProjectDescription) root, lookup, context);
|
yield return TraverseProject((ProjectDescription) root, lookup, context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,10 +96,13 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
public static List<CultureResgenIO> GetCultureResources(Project project, string outputPath)
|
public static List<CultureResgenIO> GetCultureResources(Project project, string outputPath)
|
||||||
{
|
{
|
||||||
return
|
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
|
let culture = resourceFileGroup.Key
|
||||||
where !string.IsNullOrEmpty(culture)
|
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 resourceOutputPath = Path.Combine(outputPath, culture)
|
||||||
let outputFile = Path.Combine(resourceOutputPath, project.Name + ".resources.dll")
|
let outputFile = Path.Combine(resourceOutputPath, project.Name + ".resources.dll")
|
||||||
select new CultureResgenIO(culture, inputFileToMetadata, outputFile)
|
select new CultureResgenIO(culture, inputFileToMetadata, outputFile)
|
||||||
|
|
|
@ -126,7 +126,9 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
if (compilationOptions.PreserveCompilationContext == true)
|
if (compilationOptions.PreserveCompilationContext == true)
|
||||||
{
|
{
|
||||||
var allExports = exporter.GetAllExports().ToList();
|
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 buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
|
||||||
var filteredExports = allExports
|
var filteredExports = allExports
|
||||||
.Where(e => e.Library.Identity.Type.Equals(LibraryType.ReferenceAssembly) ||
|
.Where(e => e.Library.Identity.Type.Equals(LibraryType.ReferenceAssembly) ||
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
|
|
||||||
var exports = exporter.GetAllExports();
|
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 platformExclusionList = context.GetPlatformExclusionList(exportsLookup);
|
||||||
var buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
|
var buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
|
||||||
var allExclusionList = new HashSet<string>(platformExclusionList);
|
var allExclusionList = new HashSet<string>(platformExclusionList);
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
// Will fail with dupes if any
|
// 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]
|
[Fact]
|
||||||
|
@ -153,7 +153,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
// Will fail with dupes if any
|
// Will fail with dupes if any
|
||||||
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name);
|
context.LibraryManager.GetLibraries().ToDictionary(l => l.Identity.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue