You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -51,13 +51,11 @@ namespace Mono.Linker.Steps {
|
||||
continue;
|
||||
|
||||
try {
|
||||
if (Context.LogInternalExceptions)
|
||||
Console.WriteLine ("Processing resource linker descriptor: {0}", name);
|
||||
Context.LogMessage ("Processing resource linker descriptor: {0}", name);
|
||||
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
|
||||
} catch (XmlException ex) {
|
||||
/* This could happen if some broken XML file is included. */
|
||||
if (Context.LogInternalExceptions)
|
||||
Console.WriteLine ("Error processing {0}: {1}", name, ex);
|
||||
Context.LogMessage ("Error processing {0}: {1}", name, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,14 +67,12 @@ namespace Mono.Linker.Steps {
|
||||
.Where (res => IsReferenced (GetAssemblyName (res.Name)))
|
||||
.Cast<EmbeddedResource> ()) {
|
||||
try {
|
||||
if (Context.LogInternalExceptions)
|
||||
Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
|
||||
Context.LogMessage ("Processing embedded resource linker descriptor: {0}", rsc.Name);
|
||||
|
||||
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc, asm));
|
||||
} catch (XmlException ex) {
|
||||
/* This could happen if some broken XML file is embedded. */
|
||||
if (Context.LogInternalExceptions)
|
||||
Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
|
||||
Context.LogMessage ("Error processing {0}: {1}", rsc.Name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void MarkCustomAttribute (CustomAttribute ca)
|
||||
{
|
||||
Annotations.Push (ca);
|
||||
Annotations.Push ((object)ca.AttributeType ?? (object)ca);
|
||||
try {
|
||||
MarkMethod (ca.Constructor);
|
||||
|
||||
@@ -986,11 +986,8 @@ namespace Mono.Linker.Steps {
|
||||
protected void MarkMethodsIf (Collection<MethodDefinition> methods, Func<MethodDefinition, bool> predicate)
|
||||
{
|
||||
foreach (MethodDefinition method in methods)
|
||||
if (predicate (method)) {
|
||||
Annotations.Push (predicate);
|
||||
if (predicate (method))
|
||||
MarkMethod (method);
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsDefaultConstructor (MethodDefinition method)
|
||||
|
||||
@@ -137,8 +137,7 @@ namespace Mono.Linker.Steps
|
||||
// Both cases are bugs not on our end but we still want to link all assemblies
|
||||
// especially when such types cannot be used anyway
|
||||
//
|
||||
if (context.LogInternalExceptions)
|
||||
System.Console.WriteLine ($"Cannot find declaration of exported type '{exported}' from the assembly '{assembly}'");
|
||||
context.LogMessage ($"Cannot find declaration of exported type '{exported}' from the assembly '{assembly}'");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
4
external/linker/linker/Mono.Linker.csproj
vendored
4
external/linker/linker/Mono.Linker.csproj
vendored
@@ -91,6 +91,8 @@
|
||||
<Compile Include="Mono.Linker\TypeReferenceExtensions.cs" />
|
||||
<Compile Include="Mono.Linker\XApiReader.cs" />
|
||||
<Compile Include="Mono.Linker.Steps\TypeMapStep.cs" />
|
||||
<Compile Include="Mono.Linker\ILogger.cs" />
|
||||
<Compile Include="Mono.Linker\ConsoleLogger.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
@@ -99,7 +101,9 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\cecil\Mono.Cecil.csproj">
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' And '$(TargetFramework)' == 'net46' ">Configuration=net_4_0_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' And '$(TargetFramework)' == 'net46' ">Configuration=net_4_0_Release</SetConfiguration>
|
||||
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
|
||||
<Name>Mono.Cecil</Name>
|
||||
</ProjectReference>
|
||||
|
||||
11
external/linker/linker/Mono.Linker/ConsoleLogger.cs
vendored
Normal file
11
external/linker/linker/Mono.Linker/ConsoleLogger.cs
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
namespace Mono.Linker
|
||||
{
|
||||
public class ConsoleLogger : ILogger
|
||||
{
|
||||
public void LogMessage (MessageImportance importance, string message, params object[] values)
|
||||
{
|
||||
Console.WriteLine (message, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
external/linker/linker/Mono.Linker/ILogger.cs
vendored
Normal file
15
external/linker/linker/Mono.Linker/ILogger.cs
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
namespace Mono.Linker
|
||||
{
|
||||
public enum MessageImportance
|
||||
{
|
||||
High,
|
||||
Low,
|
||||
Normal,
|
||||
}
|
||||
|
||||
public interface ILogger
|
||||
{
|
||||
void LogMessage (MessageImportance importance, string message, params object[] values);
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,8 @@ namespace Mono.Linker {
|
||||
|
||||
public bool LogInternalExceptions { get; set; } = false;
|
||||
|
||||
public ILogger Logger { get; set; } = new ConsoleLogger ();
|
||||
|
||||
public LinkContext (Pipeline pipeline)
|
||||
: this (pipeline, new AssemblyResolver ())
|
||||
{
|
||||
@@ -301,5 +303,16 @@ namespace Mono.Linker {
|
||||
{
|
||||
_resolver.Dispose ();
|
||||
}
|
||||
|
||||
public void LogMessage (string message, params object[] values)
|
||||
{
|
||||
LogMessage (MessageImportance.Normal, message, values);
|
||||
}
|
||||
|
||||
public void LogMessage (MessageImportance importance, string message, params object [] values)
|
||||
{
|
||||
if (LogInternalExceptions && Logger != null)
|
||||
Logger.LogMessage (importance, message, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user