Turn linker resolution errors into warnings

This commit is contained in:
Frank A. Krueger 2018-03-23 13:58:29 -07:00
parent 2e93848265
commit 865929c434
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
1 changed files with 17 additions and 1 deletions

View File

@ -123,6 +123,7 @@ namespace Ooui.Wasm.Build.Tasks
context.CoreAction = AssemblyAction.CopyUsed;
context.UserAction = AssemblyAction.CopyUsed;
context.OutputDirectory = managedPath;
context.IgnoreUnresolved = true;
pipeline.PrependStep (new ResolveFromAssemblyStep (asmPath, ResolveFromAssemblyStep.RootVisibility.Any));
@ -212,7 +213,7 @@ namespace Ooui.Wasm.Build.Tasks
p.AppendStep (new PreserveUsingAttributesStep (bclAssemblies.Values.Select (Path.GetFileNameWithoutExtension)));
p.AppendStep (new BlacklistStep ());
p.AppendStep (new TypeMapStep ());
p.AppendStep (new MarkStep ());
p.AppendStep (new MarkStepWithUnresolvedLogging { Log = Log });
p.AppendStep (new SweepStep ());
p.AppendStep (new CleanStep ());
p.AppendStep (new RegenerateGuidStep ());
@ -220,6 +221,21 @@ namespace Ooui.Wasm.Build.Tasks
return p;
}
class MarkStepWithUnresolvedLogging : MarkStep
{
public TaskLoggingHelper Log;
protected override void HandleUnresolvedType (TypeReference reference)
{
Log.LogWarning ($"Failed to resolve type {reference}");
}
protected override void HandleUnresolvedMethod (MethodReference reference)
{
Log.LogWarning ($"Failed to resolve method {reference}");
}
}
void ExtractClientJs ()
{
var oouiPath = refpaths.FirstOrDefault (x => Path.GetFileName (x).Equals ("Ooui.dll", StringComparison.InvariantCultureIgnoreCase));