You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.199
Former-commit-id: f4d318e4b2f128fa9f4d31b37bb3839a3fc0dfb2
This commit is contained in:
parent
536cd135cc
commit
5924117973
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
|
||||
<DefineConstants>$(DefineConstants);NET_CORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<AssemblyName>illink</AssemblyName>
|
||||
<OutputType>exe</OutputType>
|
||||
<OutputType>Library</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -77,10 +77,15 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void InitializeAssembly (AssemblyDefinition assembly)
|
||||
{
|
||||
MarkAssembly (assembly);
|
||||
Annotations.Push (assembly);
|
||||
try {
|
||||
MarkAssembly (assembly);
|
||||
|
||||
foreach (TypeDefinition type in assembly.MainModule.Types)
|
||||
InitializeType (type);
|
||||
foreach (TypeDefinition type in assembly.MainModule.Types)
|
||||
InitializeType (type);
|
||||
} finally {
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeType (TypeDefinition type)
|
||||
@@ -152,9 +157,14 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
if (!Annotations.IsMarked (type))
|
||||
continue;
|
||||
Annotations.Mark (exported);
|
||||
if (_context.KeepTypeForwarderOnlyAssemblies) {
|
||||
Annotations.Mark (assembly.MainModule);
|
||||
Annotations.Push (type);
|
||||
try {
|
||||
Annotations.Mark (exported);
|
||||
if (_context.KeepTypeForwarderOnlyAssemblies) {
|
||||
Annotations.Mark (assembly.MainModule);
|
||||
}
|
||||
} finally {
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,8 +255,13 @@ namespace Mono.Linker.Steps {
|
||||
if (!provider.HasCustomAttributes)
|
||||
return;
|
||||
|
||||
foreach (CustomAttribute ca in provider.CustomAttributes)
|
||||
MarkCustomAttribute (ca);
|
||||
Annotations.Push (provider);
|
||||
try {
|
||||
foreach (CustomAttribute ca in provider.CustomAttributes)
|
||||
MarkCustomAttribute (ca);
|
||||
} finally {
|
||||
Annotations.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
void LazyMarkCustomAttributes (ICustomAttributeProvider provider)
|
||||
@@ -508,9 +523,15 @@ namespace Mono.Linker.Steps {
|
||||
while (_topLevelAttributes.Count != 0) {
|
||||
var customAttribute = _topLevelAttributes.Dequeue ();
|
||||
|
||||
var resolved = customAttribute.AttributeType.Resolve ();
|
||||
if (resolved == null) {
|
||||
HandleUnresolvedType (customAttribute.AttributeType);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If an attribute's module has not been marked after processing all types in all assemblies and the attribute itself has not been marked,
|
||||
// then surely nothing is using this attribute and there is no need to mark it
|
||||
if (!Annotations.IsMarked (customAttribute.AttributeType.Resolve ().Module) && !Annotations.IsMarked (customAttribute.AttributeType))
|
||||
if (!Annotations.IsMarked (resolved.Module) && !Annotations.IsMarked (customAttribute.AttributeType))
|
||||
continue;
|
||||
|
||||
MarkCustomAttribute (customAttribute);
|
||||
@@ -625,8 +646,10 @@ namespace Mono.Linker.Steps {
|
||||
MarkFields (type, type.IsEnum);
|
||||
|
||||
if (type.HasInterfaces) {
|
||||
foreach (var iface in type.Interfaces)
|
||||
foreach (var iface in type.Interfaces) {
|
||||
MarkCustomAttributes (iface);
|
||||
MarkType (iface.InterfaceType);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.HasMethods) {
|
||||
|
||||
@@ -123,6 +123,26 @@ namespace Mono.Linker.Steps
|
||||
} catch (AssemblyResolutionException) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (resolvedExportedType == null) {
|
||||
//
|
||||
// It's quite common for assemblies to have broken exported types
|
||||
//
|
||||
// One source of them is from native csc which added all nested types of
|
||||
// type-forwarded types automatically including private ones.
|
||||
//
|
||||
// Next source of broken type-forwarders is from custom metadata writers which
|
||||
// simply write bogus information.
|
||||
//
|
||||
// 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}'");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
context.Resolve (resolvedExportedType.Scope);
|
||||
MarkType (context, resolvedExportedType, rootVisibility);
|
||||
context.Annotations.Mark (exported);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using SR = System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.XPath;
|
||||
@@ -51,8 +51,12 @@ namespace Mono.Linker.Steps {
|
||||
static readonly string _fullname = "fullname";
|
||||
static readonly string _required = "required";
|
||||
static readonly string _preserve = "preserve";
|
||||
static readonly string _accessors = "accessors";
|
||||
static readonly string _ns = string.Empty;
|
||||
|
||||
static readonly string[] _accessorsAll = new string[] { "all" };
|
||||
static readonly char[] _accessorsSep = new char[] { ';' };
|
||||
|
||||
XPathDocument _document;
|
||||
string _xmlDocumentLocation;
|
||||
|
||||
@@ -161,7 +165,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
static Regex CreateRegexFromPattern (string pattern)
|
||||
{
|
||||
return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
|
||||
return new Regex (pattern.Replace (".", @"\.").Replace ("*", "(.*)"));
|
||||
}
|
||||
|
||||
void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
|
||||
@@ -204,7 +208,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
if (assembly.MainModule.HasExportedTypes) {
|
||||
foreach (var exported in assembly.MainModule.ExportedTypes) {
|
||||
MatchExportedType(exported, assembly.MainModule, regex, nav);
|
||||
MatchExportedType (exported, assembly.MainModule, regex, nav);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,6 +238,8 @@ namespace Mono.Linker.Steps {
|
||||
if (nav.HasChildren) {
|
||||
MarkSelectedFields (nav, type);
|
||||
MarkSelectedMethods (nav, type);
|
||||
MarkSelectedEvents (nav, type);
|
||||
MarkSelectedProperties (nav, type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +261,24 @@ namespace Mono.Linker.Steps {
|
||||
ProcessMethods (type, methods);
|
||||
}
|
||||
|
||||
void MarkSelectedEvents (XPathNavigator nav, TypeDefinition type)
|
||||
{
|
||||
XPathNodeIterator events = nav.SelectChildren ("event", _ns);
|
||||
if (events.Count == 0)
|
||||
return;
|
||||
|
||||
ProcessEvents (type, events);
|
||||
}
|
||||
|
||||
void MarkSelectedProperties (XPathNavigator nav, TypeDefinition type)
|
||||
{
|
||||
XPathNodeIterator properties = nav.SelectChildren ("property", _ns);
|
||||
if (properties.Count == 0)
|
||||
return;
|
||||
|
||||
ProcessProperties (type, properties);
|
||||
}
|
||||
|
||||
static TypePreserve GetTypePreserve (XPathNavigator nav)
|
||||
{
|
||||
string attribute = GetAttribute (nav, _preserve);
|
||||
@@ -324,7 +348,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
while (iterator.MoveNext()) {
|
||||
while (iterator.MoveNext ()) {
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessMethodSignature (type, value);
|
||||
@@ -344,12 +368,25 @@ namespace Mono.Linker.Steps {
|
||||
void MarkMethod (TypeDefinition type, MethodDefinition method, string signature)
|
||||
{
|
||||
if (method != null) {
|
||||
Annotations.Mark (method);
|
||||
Annotations.SetAction (method, MethodAction.Parse);
|
||||
MarkMethod (method);
|
||||
} else
|
||||
AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature));
|
||||
}
|
||||
|
||||
void MarkMethod (MethodDefinition method)
|
||||
{
|
||||
Annotations.Mark (method);
|
||||
Annotations.SetAction (method, MethodAction.Parse);
|
||||
}
|
||||
|
||||
void MarkMethodIfNotNull (MethodDefinition method)
|
||||
{
|
||||
if (method == null)
|
||||
return;
|
||||
|
||||
MarkMethod (method);
|
||||
}
|
||||
|
||||
void ProcessMethodName (TypeDefinition type, string name)
|
||||
{
|
||||
if (!type.HasMethods)
|
||||
@@ -389,6 +426,141 @@ namespace Mono.Linker.Steps {
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
void ProcessEvents (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
while (iterator.MoveNext ()) {
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessEventSignature (type, value);
|
||||
|
||||
value = GetAttribute (iterator.Current, "name");
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessEventName (type, value);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessEventSignature (TypeDefinition type, string signature)
|
||||
{
|
||||
EventDefinition @event = GetEvent (type, signature);
|
||||
MarkEvent (type, @event, signature);
|
||||
}
|
||||
|
||||
void MarkEvent (TypeDefinition type, EventDefinition @event, string signature)
|
||||
{
|
||||
if (@event != null) {
|
||||
Annotations.Mark (@event);
|
||||
|
||||
MarkMethod (@event.AddMethod);
|
||||
MarkMethod (@event.RemoveMethod);
|
||||
MarkMethodIfNotNull (@event.InvokeMethod);
|
||||
} else
|
||||
AddUnresolveMarker (string.Format ("T: {0}; E: {1}", type, signature));
|
||||
}
|
||||
|
||||
void ProcessEventName (TypeDefinition type, string name)
|
||||
{
|
||||
if (!type.HasEvents)
|
||||
return;
|
||||
|
||||
foreach (EventDefinition @event in type.Events)
|
||||
if (@event.Name == name)
|
||||
MarkEvent (type, @event, name);
|
||||
}
|
||||
|
||||
static EventDefinition GetEvent (TypeDefinition type, string signature)
|
||||
{
|
||||
if (!type.HasEvents)
|
||||
return null;
|
||||
|
||||
foreach (EventDefinition @event in type.Events)
|
||||
if (signature == GetEventSignature (@event))
|
||||
return @event;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static string GetEventSignature (EventDefinition @event)
|
||||
{
|
||||
return @event.EventType.FullName + " " + @event.Name;
|
||||
}
|
||||
|
||||
void ProcessProperties (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
while (iterator.MoveNext ()) {
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessPropertySignature (type, value, GetAccessors (iterator.Current));
|
||||
|
||||
value = GetAttribute (iterator.Current, "name");
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessPropertyName (type, value, _accessorsAll);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessPropertySignature (TypeDefinition type, string signature, string[] accessors)
|
||||
{
|
||||
PropertyDefinition property = GetProperty (type, signature);
|
||||
MarkProperty (type, property, signature, accessors);
|
||||
}
|
||||
|
||||
void MarkProperty (TypeDefinition type, PropertyDefinition property, string signature, string[] accessors)
|
||||
{
|
||||
if (property != null) {
|
||||
Annotations.Mark (property);
|
||||
|
||||
MarkPropertyAccessors (type, property, accessors);
|
||||
} else
|
||||
AddUnresolveMarker (string.Format ("T: {0}; P: {1}", type, signature));
|
||||
}
|
||||
|
||||
void MarkPropertyAccessors (TypeDefinition type, PropertyDefinition property, string[] accessors)
|
||||
{
|
||||
if (Array.IndexOf (accessors, "all") >= 0) {
|
||||
MarkMethodIfNotNull (property.GetMethod);
|
||||
MarkMethodIfNotNull (property.SetMethod);
|
||||
|
||||
return;
|
||||
}
|
||||
if (property.GetMethod != null
|
||||
&& Array.IndexOf (accessors, "get") >= 0)
|
||||
MarkMethod (property.GetMethod);
|
||||
else if (property.GetMethod == null)
|
||||
AddUnresolveMarker (string.Format ("T: {0}' M: {1} get_{2}", type, property.PropertyType, property.Name));
|
||||
|
||||
if (property.SetMethod != null
|
||||
&& Array.IndexOf (accessors, "set") >= 0)
|
||||
MarkMethod (property.SetMethod);
|
||||
else if (property.SetMethod == null)
|
||||
AddUnresolveMarker (string.Format ("T: {0}' M: System.Void set_{2} ({1})", type, property.PropertyType, property.Name));
|
||||
}
|
||||
|
||||
void ProcessPropertyName (TypeDefinition type, string name, string[] accessors)
|
||||
{
|
||||
if (!type.HasProperties)
|
||||
return;
|
||||
|
||||
foreach (PropertyDefinition property in type.Properties)
|
||||
if (property.Name == name)
|
||||
MarkProperty (type, property, name, accessors);
|
||||
}
|
||||
|
||||
static PropertyDefinition GetProperty (TypeDefinition type, string signature)
|
||||
{
|
||||
if (!type.HasProperties)
|
||||
return null;
|
||||
|
||||
foreach (PropertyDefinition property in type.Properties)
|
||||
if (signature == GetPropertySignature (property))
|
||||
return property;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static string GetPropertySignature (PropertyDefinition property)
|
||||
{
|
||||
return property.PropertyType.FullName + " " + property.Name;
|
||||
}
|
||||
|
||||
static AssemblyDefinition GetAssembly (LinkContext context, string assemblyName)
|
||||
{
|
||||
AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
|
||||
@@ -433,9 +605,32 @@ namespace Mono.Linker.Steps {
|
||||
return GetAttribute (nav, _fullname);
|
||||
}
|
||||
|
||||
static string[] GetAccessors (XPathNavigator nav)
|
||||
{
|
||||
string accessorsValue = GetAttribute (nav, _accessors);
|
||||
|
||||
if (accessorsValue != null) {
|
||||
string[] accessors = accessorsValue.Split (
|
||||
_accessorsSep, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (accessors.Length > 0) {
|
||||
for (int i = 0; i < accessors.Length; ++i)
|
||||
accessors[i] = accessors[i].ToLower ();
|
||||
|
||||
return accessors;
|
||||
}
|
||||
}
|
||||
return _accessorsAll;
|
||||
}
|
||||
|
||||
static string GetAttribute (XPathNavigator nav, string attribute)
|
||||
{
|
||||
return nav.GetAttribute (attribute, _ns);
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return "ResolveFromXmlStep: " + _xmlDocumentLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
external/linker/linker/Mono.Linker.csproj
vendored
22
external/linker/linker/Mono.Linker.csproj
vendored
@@ -10,11 +10,11 @@
|
||||
targets.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<NetCoreBuild Condition=" $(Configuration.StartsWith('netcore')) Or '$(NuGetRestoreTargets)' != '' ">true</NetCoreBuild>
|
||||
<NetCoreBuild Condition=" '$(NetCoreBuild)' == '' ">false</NetCoreBuild>
|
||||
<ILLinkBuild Condition=" $(Configuration.StartsWith('illink')) Or '$(NuGetRestoreTargets)' != '' ">true</ILLinkBuild>
|
||||
<ILLinkBuild Condition=" '$(ILLinkBuild)' == '' ">false</ILLinkBuild>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<Import Project="NetCore.props" Condition=" $(NetCoreBuild) " />
|
||||
<Import Project="ILLink.props" Condition=" $(ILLinkBuild) " />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -24,8 +24,8 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Mono.Linker</RootNamespace>
|
||||
<AssemblyName Condition=" ! $(NetCoreBuild) ">monolinker</AssemblyName>
|
||||
<AssemblyName Condition=" $(NetCoreBuild) ">illink</AssemblyName>
|
||||
<AssemblyName Condition=" ! $(ILLinkBuild) ">monolinker</AssemblyName>
|
||||
<AssemblyName Condition=" $(ILLinkBuild) ">illink</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
@@ -45,7 +45,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(NetCoreBuild) " />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(ILLinkBuild) " />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
@@ -53,7 +53,7 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup Condition=" ! $(NetCoreBuild) ">
|
||||
<ItemGroup Condition=" ! $(ILLinkBuild) ">
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml" />
|
||||
@@ -98,14 +98,14 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\cecil\Mono.Cecil.csproj">
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
|
||||
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
|
||||
<Name>Mono.Cecil</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj">
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
|
||||
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
|
||||
<Project>{63E6915C-7EA4-4D76-AB28-0D7191EEA626}</Project>
|
||||
<Name>Mono.Cecil.Pdb</Name>
|
||||
</ProjectReference>
|
||||
|
||||
@@ -302,10 +302,13 @@ namespace Mono.Linker {
|
||||
return;
|
||||
|
||||
KeyValuePair<object, object> pair = new KeyValuePair<object, object> (dependency_stack.Count > 0 ? dependency_stack.Peek () : null, o);
|
||||
writer.WriteStartElement ("edge");
|
||||
writer.WriteAttributeString ("b", TokenString (pair.Key));
|
||||
writer.WriteAttributeString ("e", TokenString (pair.Value));
|
||||
writer.WriteEndElement ();
|
||||
if (pair.Key != pair.Value)
|
||||
{
|
||||
writer.WriteStartElement ("edge");
|
||||
writer.WriteAttributeString ("b", TokenString (pair.Key));
|
||||
writer.WriteAttributeString ("e", TokenString (pair.Value));
|
||||
writer.WriteEndElement ();
|
||||
}
|
||||
}
|
||||
|
||||
public void Push (object o)
|
||||
|
||||
@@ -33,7 +33,7 @@ using Mono.Cecil;
|
||||
|
||||
namespace Mono.Linker {
|
||||
|
||||
#if NET_CORE
|
||||
#if FEATURE_ILLINK
|
||||
public class AssemblyResolver : DirectoryAssemblyResolver {
|
||||
#else
|
||||
public class AssemblyResolver : BaseAssemblyResolver {
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.IO;
|
||||
using Mono.Collections.Generic;
|
||||
using Mono.Cecil;
|
||||
|
||||
#if NET_CORE
|
||||
#if FEATURE_ILLINK
|
||||
namespace Mono.Linker {
|
||||
|
||||
public abstract class DirectoryAssemblyResolver : IAssemblyResolver {
|
||||
|
||||
4
external/linker/linker/Mono.Linker/Driver.cs
vendored
4
external/linker/linker/Mono.Linker/Driver.cs
vendored
@@ -37,7 +37,7 @@ namespace Mono.Linker {
|
||||
|
||||
public class Driver {
|
||||
|
||||
#if NET_CORE
|
||||
#if FEATURE_ILLINK
|
||||
static readonly string _linker = "IL Linker";
|
||||
#else
|
||||
static readonly string _linker = "Mono CIL Linker";
|
||||
@@ -284,7 +284,7 @@ namespace Mono.Linker {
|
||||
Console.WriteLine (_linker);
|
||||
if (msg != null)
|
||||
Console.WriteLine ("Error: " + msg);
|
||||
#if NET_CORE
|
||||
#if FEATURE_ILLINK
|
||||
Console.WriteLine ("illink [options] -x|-a|-i file");
|
||||
#else
|
||||
Console.WriteLine ("monolinker [options] -x|-a|-i file");
|
||||
|
||||
@@ -179,8 +179,8 @@ namespace Mono.Linker {
|
||||
|
||||
return assembly;
|
||||
}
|
||||
catch {
|
||||
throw new AssemblyResolutionException (reference);
|
||||
catch (Exception e) {
|
||||
throw new AssemblyResolutionException (reference, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace Mono.Linker {
|
||||
}
|
||||
}
|
||||
|
||||
public AssemblyDefinition [] GetAssemblies ()
|
||||
public virtual AssemblyDefinition [] GetAssemblies ()
|
||||
{
|
||||
var cache = _resolver.AssemblyCache;
|
||||
AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count];
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
using System;
|
||||
// The MIT License(MIT)
|
||||
// =====================
|
||||
//
|
||||
// Copyright © `2015-2017` `Lucas Meijer`
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -283,6 +309,11 @@ namespace Mono.Linker.Tests.Extensions
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static implicit operator string(NPath path)
|
||||
{
|
||||
return path.ToString();
|
||||
}
|
||||
|
||||
static char Slash(SlashMode slashMode)
|
||||
{
|
||||
switch (slashMode)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
public abstract class BaseInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class KeptBackingFieldAttribute : KeptAttribute {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
|
||||
public class KeptInterfaceAttribute : KeptAttribute
|
||||
{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class KeptMemberAttribute : KeptAttribute {
|
||||
|
||||
public KeptMemberAttribute (string name)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
|
||||
public class KeptMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
|
||||
public class KeptMemberInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
|
||||
public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames)
|
||||
{
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
|
||||
public class KeptTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute
|
||||
{
|
||||
public class KeptTypeInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type)
|
||||
{
|
||||
if (type == null)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public class RemovedForwarderAttribute : BaseInAssemblyAttribute
|
||||
{
|
||||
public RemovedForwarderAttribute (string assemblyFileName, string typeName)
|
||||
{
|
||||
if (string.IsNullOrEmpty (assemblyFileName))
|
||||
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));
|
||||
if (string.IsNullOrEmpty (typeName))
|
||||
throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
|
||||
public class RemovedMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
|
||||
public class RemovedMemberInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
|
||||
public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
|
||||
public class RemovedTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
|
||||
public class RemovedTypeInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type)
|
||||
{
|
||||
if (type == null)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user