Skip to content
Permalink
Browse files

[Tests] Fix sample games unit tests

  • Loading branch information
xen2 committed Apr 18, 2019
1 parent c894473 commit d9660087fe00284b22d500d7566489b505232534
@@ -4,6 +4,7 @@
<Import Project="Sdk.props" Sdk="MSBuild.Sdk.Extras" Version="1.6.65" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
@@ -236,6 +236,31 @@ private Assembly LoadAssemblyFromPathInternal([NotNull] string assemblyFullPath)
}
}
}

// It seems .deps.json files don't contain library info if referencer is non-RID specific and dependency is RID specific
// (i.e. compiling Game project without runtime identifier and a dependency needs runtime identifier)
// TODO: Look for a proper way to query that properly, maybe using NuGet API? however some constraints are:
// - limited info (only .deps.json available from path, no project info; we might need to reconstruct a proper NuGet restore request from .deps.json)
// - need to be fast (make sure to use NuGet caching mechanism)
if (library.RuntimeAssemblyGroups.Count == 0)
{
var runtimeFolder = new[] { "win-d3d11", "win", "any" }
.Select(runtime => Path.Combine(globalPackagesFolder, library.Path, "runtimes", runtime))
.Where(Directory.Exists)
.SelectMany(folder => Directory.EnumerateDirectories(Path.Combine(folder, "lib")))
.FirstOrDefault(file => Path.GetFileName(file).StartsWith("net")); // Only consider framework netXX and netstandardX.X
if (runtimeFolder != null)
{
foreach (var runtimeFile in Directory.EnumerateFiles(runtimeFolder, "*.dll"))
{
var assemblyName = Path.GetFileNameWithoutExtension(runtimeFile);

// TODO: Properly deal with file duplicates (same file in multiple package, or RID conflicts)
if (!dependenciesMapping.ContainsKey(assemblyName))
dependenciesMapping.Add(assemblyName, runtimeFile);
}
}
}
}
}

0 comments on commit d966008

Please sign in to comment.
You can’t perform that action at this time.