You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.88
Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
parent
7d05485754
commit
6123a772ed
@@ -96,9 +96,9 @@ namespace Mono.Linker.Steps {
|
||||
return false;
|
||||
}
|
||||
|
||||
static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
|
||||
protected virtual IStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
|
||||
{
|
||||
return new ResolveFromXmlStep (GetExternalDescriptor (resource), "resource " + resource.Name + " in " + assembly.FullName);
|
||||
return new ResolveFromXmlStep (GetExternalDescriptor (resource), resource.Name, assembly, "resource " + resource.Name + " in " + assembly.FullName);
|
||||
}
|
||||
|
||||
static ResolveFromXmlStep GetResolveStep (string descriptor)
|
||||
@@ -106,7 +106,7 @@ namespace Mono.Linker.Steps {
|
||||
return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName);
|
||||
}
|
||||
|
||||
static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
|
||||
protected static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
|
||||
{
|
||||
using (var sr = new StreamReader (resource.GetResourceStream ())) {
|
||||
return new XPathDocument (new StringReader (sr.ReadToEnd ()));
|
||||
|
||||
@@ -647,8 +647,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
if (type.HasInterfaces) {
|
||||
foreach (var iface in type.Interfaces) {
|
||||
MarkCustomAttributes (iface);
|
||||
MarkType (iface.InterfaceType);
|
||||
MarkInterfaceImplementation (type, iface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1444,7 +1443,14 @@ namespace Mono.Linker.Steps {
|
||||
return true;
|
||||
case MethodAction.Parse:
|
||||
AssemblyDefinition assembly = ResolveAssembly (method.DeclaringType.Scope);
|
||||
return Annotations.GetAction (assembly) == AssemblyAction.Link;
|
||||
switch (Annotations.GetAction (assembly)) {
|
||||
case AssemblyAction.Link:
|
||||
case AssemblyAction.Copy:
|
||||
case AssemblyAction.CopyUsed:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -1550,12 +1556,22 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void HandleUnresolvedType (TypeReference reference)
|
||||
{
|
||||
throw new ResolutionException (reference);
|
||||
if (!_context.IgnoreUnresolved) {
|
||||
throw new ResolutionException (reference);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void HandleUnresolvedMethod (MethodReference reference)
|
||||
{
|
||||
throw new ResolutionException (reference);
|
||||
if (!_context.IgnoreUnresolved) {
|
||||
throw new ResolutionException (reference);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void MarkInterfaceImplementation (TypeDefinition type, InterfaceImplementation iface)
|
||||
{
|
||||
MarkCustomAttributes (iface);
|
||||
MarkType (iface.InterfaceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
XPathDocument _document;
|
||||
string _xmlDocumentLocation;
|
||||
string _resourceName;
|
||||
AssemblyDefinition _resourceAssembly;
|
||||
|
||||
public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "<unspecified>")
|
||||
{
|
||||
@@ -66,18 +68,33 @@ namespace Mono.Linker.Steps {
|
||||
_xmlDocumentLocation = xmlDocumentLocation;
|
||||
}
|
||||
|
||||
public ResolveFromXmlStep (XPathDocument document, string resourceName, AssemblyDefinition resourceAssembly, string xmlDocumentLocation = "<unspecified>")
|
||||
: this (document, xmlDocumentLocation)
|
||||
{
|
||||
if (string.IsNullOrEmpty (resourceName))
|
||||
throw new ArgumentNullException (nameof (resourceName));
|
||||
|
||||
if (resourceAssembly == null)
|
||||
throw new ArgumentNullException (nameof (resourceAssembly));
|
||||
|
||||
_resourceName = resourceName;
|
||||
_resourceAssembly = resourceAssembly;
|
||||
}
|
||||
|
||||
protected override void Process ()
|
||||
{
|
||||
XPathNavigator nav = _document.CreateNavigator ();
|
||||
nav.MoveToFirstChild ();
|
||||
|
||||
// This step can be created with XML files that aren't necessarily
|
||||
// linker descriptor files. So bail if we don't have a <linker> element.
|
||||
if (nav.LocalName != "linker")
|
||||
if (!nav.MoveToChild("linker", _ns))
|
||||
return;
|
||||
|
||||
try {
|
||||
ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
|
||||
|
||||
if (!string.IsNullOrEmpty (_resourceName))
|
||||
Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName);
|
||||
} catch (Exception ex) {
|
||||
throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex);
|
||||
}
|
||||
|
||||
@@ -75,11 +75,23 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
void SweepAssembly (AssemblyDefinition assembly)
|
||||
{
|
||||
if (Annotations.GetAction (assembly) != AssemblyAction.Link)
|
||||
switch (Annotations.GetAction (assembly)) {
|
||||
case AssemblyAction.Link:
|
||||
if (!IsMarkedAssembly (assembly)) {
|
||||
RemoveAssembly (assembly);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case AssemblyAction.CopyUsed:
|
||||
if (!IsMarkedAssembly (assembly)) {
|
||||
RemoveAssembly (assembly);
|
||||
} else {
|
||||
Annotations.SetAction (assembly, AssemblyAction.Copy);
|
||||
}
|
||||
return;
|
||||
|
||||
if (!IsMarkedAssembly (assembly)) {
|
||||
RemoveAssembly (assembly);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,6 +113,8 @@ namespace Mono.Linker.Steps {
|
||||
assembly.MainModule.Types.Clear ();
|
||||
foreach (TypeDefinition type in types)
|
||||
assembly.MainModule.Types.Add (type);
|
||||
|
||||
SweepResources (assembly);
|
||||
}
|
||||
|
||||
bool IsMarkedAssembly (AssemblyDefinition assembly)
|
||||
@@ -115,6 +129,23 @@ namespace Mono.Linker.Steps {
|
||||
SweepReferences (assembly);
|
||||
}
|
||||
|
||||
void SweepResources (AssemblyDefinition assembly)
|
||||
{
|
||||
var resourcesToRemove = Annotations.GetResourcesToRemove (assembly);
|
||||
if (resourcesToRemove != null) {
|
||||
var resources = assembly.MainModule.Resources;
|
||||
|
||||
for (int i = 0; i < resources.Count; i++) {
|
||||
var resource = resources [i] as EmbeddedResource;
|
||||
if (resource == null)
|
||||
continue;
|
||||
|
||||
if (resourcesToRemove.Contains (resource.Name))
|
||||
resources.RemoveAt (i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SweepReferences (AssemblyDefinition target)
|
||||
{
|
||||
foreach (var assembly in assemblies)
|
||||
@@ -147,8 +178,8 @@ namespace Mono.Linker.Steps {
|
||||
case AssemblyAction.Copy:
|
||||
// Copy means even if "unlinked" we still want that assembly to be saved back
|
||||
// to disk (OutputStep) without the (removed) reference
|
||||
Annotations.SetAction (assembly, AssemblyAction.Save);
|
||||
if (!Context.KeepTypeForwarderOnlyAssemblies) {
|
||||
Annotations.SetAction (assembly, AssemblyAction.Save);
|
||||
ResolveAllTypeReferences (assembly);
|
||||
}
|
||||
break;
|
||||
@@ -224,6 +255,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
if (type.HasNestedTypes)
|
||||
SweepNestedTypes (type);
|
||||
|
||||
if (type.HasInterfaces)
|
||||
SweepInterfaces (type);
|
||||
}
|
||||
|
||||
protected void SweepNestedTypes (TypeDefinition type)
|
||||
@@ -239,6 +273,17 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
protected void SweepInterfaces (TypeDefinition type)
|
||||
{
|
||||
for (int i = type.Interfaces.Count - 1; i >= 0; i--) {
|
||||
var iface = type.Interfaces [i];
|
||||
if (Annotations.IsMarked (iface.InterfaceType.Resolve ()))
|
||||
continue;
|
||||
InterfaceRemoved (type, iface);
|
||||
type.Interfaces.RemoveAt (i);
|
||||
}
|
||||
}
|
||||
|
||||
void SweepMethods (Collection<MethodDefinition> methods)
|
||||
{
|
||||
SweepCollection (methods);
|
||||
@@ -321,5 +366,9 @@ namespace Mono.Linker.Steps {
|
||||
protected virtual void ReferenceRemoved (AssemblyDefinition assembly, AssemblyNameReference reference)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void InterfaceRemoved (TypeDefinition type, InterfaceImplementation iface)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Mono.Linker {
|
||||
readonly Dictionary<AssemblyDefinition, ISymbolReader> symbol_readers = new Dictionary<AssemblyDefinition, ISymbolReader> ();
|
||||
|
||||
readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
|
||||
readonly Dictionary<AssemblyDefinition, HashSet<string>> resources_to_remove = new Dictionary<AssemblyDefinition, HashSet<string>> ();
|
||||
|
||||
Stack<object> dependency_stack;
|
||||
System.Xml.XmlWriter writer;
|
||||
@@ -180,6 +181,25 @@ namespace Mono.Linker {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
public HashSet<string> GetResourcesToRemove (AssemblyDefinition assembly)
|
||||
{
|
||||
HashSet<string> resources;
|
||||
if (resources_to_remove.TryGetValue (assembly, out resources))
|
||||
return resources;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddResourceToRemove (AssemblyDefinition assembly, string name)
|
||||
{
|
||||
HashSet<string> resources;
|
||||
if (!resources_to_remove.TryGetValue (assembly, out resources)) {
|
||||
resources = resources_to_remove [assembly] = new HashSet<string> ();
|
||||
}
|
||||
|
||||
resources.Add (name);
|
||||
}
|
||||
|
||||
public void SetPublic (IMetadataTokenProvider provider)
|
||||
{
|
||||
public_api.Add (provider);
|
||||
|
||||
@@ -32,8 +32,12 @@ namespace Mono.Linker {
|
||||
// Ignore the assembly
|
||||
Skip,
|
||||
// Copy the existing files, assembly and symbols, into the output destination. E.g. .dll and .mdb
|
||||
// The linker still analyze the assemblies (to know what they require) but does not modify them
|
||||
// The linker still analyzes the assemblies (to know what they require) but does not modify them.
|
||||
Copy,
|
||||
// Copy the existing files, assembly and symbols, into the output destination if and only if
|
||||
// anything from the assembly is used.
|
||||
// The linker still analyzes the assemblies (to know what they require) but does not modify them.
|
||||
CopyUsed,
|
||||
// Link the assembly
|
||||
Link,
|
||||
// Remove the assembly from the output
|
||||
|
||||
49
external/linker/linker/Mono.Linker/Driver.cs
vendored
49
external/linker/linker/Mono.Linker/Driver.cs
vendored
@@ -95,6 +95,11 @@ namespace Mono.Linker {
|
||||
if (token.Length < 3)
|
||||
Usage ("Option is too short");
|
||||
|
||||
if (token == "--skip-unresolved") {
|
||||
context.IgnoreUnresolved = bool.Parse (GetParam ());
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (token [2]) {
|
||||
case 'v':
|
||||
Version ();
|
||||
@@ -120,6 +125,9 @@ namespace Mono.Linker {
|
||||
case 'c':
|
||||
context.CoreAction = ParseAssemblyAction (GetParam ());
|
||||
break;
|
||||
case 'u':
|
||||
context.UserAction = ParseAssemblyAction (GetParam ());
|
||||
break;
|
||||
case 'p':
|
||||
AssemblyAction action = ParseAssemblyAction (GetParam ());
|
||||
context.Actions [GetParam ()] = action;
|
||||
@@ -275,6 +283,7 @@ namespace Mono.Linker {
|
||||
{
|
||||
LinkContext context = new LinkContext (pipeline);
|
||||
context.CoreAction = AssemblyAction.Skip;
|
||||
context.UserAction = AssemblyAction.Link;
|
||||
context.OutputDirectory = "output";
|
||||
return context;
|
||||
}
|
||||
@@ -290,25 +299,27 @@ namespace Mono.Linker {
|
||||
Console.WriteLine ("monolinker [options] -x|-a|-i file");
|
||||
#endif
|
||||
|
||||
Console.WriteLine (" --about About the {0}", _linker);
|
||||
Console.WriteLine (" --version Print the version number of the {0}", _linker);
|
||||
Console.WriteLine (" -out Specify the output directory, default to `output'");
|
||||
Console.WriteLine (" -c Action on the core assemblies, skip, copy or link, default to skip");
|
||||
Console.WriteLine (" -p Action per assembly");
|
||||
Console.WriteLine (" -s Add a new step to the pipeline.");
|
||||
Console.WriteLine (" -t Keep assemblies in which only type forwarders are referenced.");
|
||||
Console.WriteLine (" -d Add a directory where the linker will look for assemblies");
|
||||
Console.WriteLine (" -b Generate debug symbols for each linked module (true or false)");
|
||||
Console.WriteLine (" -g Generate a new unique guid for each linked module (true or false)");
|
||||
Console.WriteLine (" -v Keep memebers needed by debugger attributes (true or false)");
|
||||
Console.WriteLine (" -l List of i18n assemblies to copy to the output directory");
|
||||
Console.WriteLine (" separated with a comma: none,all,cjk,mideast,other,rare,west");
|
||||
Console.WriteLine (" default is all");
|
||||
Console.WriteLine (" -x Link from an XML descriptor");
|
||||
Console.WriteLine (" -a Link from a list of assemblies");
|
||||
Console.WriteLine (" -r Link from a list of assemblies using roots visible outside of the assembly");
|
||||
Console.WriteLine (" -i Link from an mono-api-info descriptor");
|
||||
Console.WriteLine (" -z Include default preservations (true or false), default to true");
|
||||
Console.WriteLine (" --about About the {0}", _linker);
|
||||
Console.WriteLine (" --version Print the version number of the {0}", _linker);
|
||||
Console.WriteLine (" --skip-unresolved Ignore unresolved types and methods (true or false)");
|
||||
Console.WriteLine (" -out Specify the output directory, default to `output'");
|
||||
Console.WriteLine (" -c Action on the core assemblies, skip, copy, copyused or link, default to skip");
|
||||
Console.WriteLine (" -u Action on the user assemblies, skip, copy, copyused or link, default to link");
|
||||
Console.WriteLine (" -p Action per assembly");
|
||||
Console.WriteLine (" -s Add a new step to the pipeline.");
|
||||
Console.WriteLine (" -t Keep assemblies in which only type forwarders are referenced.");
|
||||
Console.WriteLine (" -d Add a directory where the linker will look for assemblies");
|
||||
Console.WriteLine (" -b Generate debug symbols for each linked module (true or false)");
|
||||
Console.WriteLine (" -g Generate a new unique guid for each linked module (true or false)");
|
||||
Console.WriteLine (" -v Keep memebers needed by debugger attributes (true or false)");
|
||||
Console.WriteLine (" -l List of i18n assemblies to copy to the output directory");
|
||||
Console.WriteLine (" separated with a comma: none,all,cjk,mideast,other,rare,west");
|
||||
Console.WriteLine (" default is all");
|
||||
Console.WriteLine (" -x Link from an XML descriptor");
|
||||
Console.WriteLine (" -a Link from a list of assemblies");
|
||||
Console.WriteLine (" -r Link from a list of assemblies using roots visible outside of the assembly");
|
||||
Console.WriteLine (" -i Link from an mono-api-info descriptor");
|
||||
Console.WriteLine (" -z Include default preservations (true or false), default to true");
|
||||
Console.WriteLine ("");
|
||||
|
||||
Environment.Exit (1);
|
||||
|
||||
@@ -38,12 +38,14 @@ namespace Mono.Linker {
|
||||
|
||||
Pipeline _pipeline;
|
||||
AssemblyAction _coreAction;
|
||||
AssemblyAction _userAction;
|
||||
Dictionary<string, AssemblyAction> _actions;
|
||||
string _outputDirectory;
|
||||
readonly Dictionary<string, string> _parameters;
|
||||
bool _linkSymbols;
|
||||
bool _keepTypeForwarderOnlyAssemblies;
|
||||
bool _keepMembersForDebuggerAttributes;
|
||||
bool _ignoreUnresolved;
|
||||
|
||||
AssemblyResolver _resolver;
|
||||
|
||||
@@ -71,6 +73,11 @@ namespace Mono.Linker {
|
||||
set { _coreAction = value; }
|
||||
}
|
||||
|
||||
public AssemblyAction UserAction {
|
||||
get { return _userAction; }
|
||||
set { _userAction = value; }
|
||||
}
|
||||
|
||||
public bool LinkSymbols {
|
||||
get { return _linkSymbols; }
|
||||
set { _linkSymbols = value; }
|
||||
@@ -88,6 +95,12 @@ namespace Mono.Linker {
|
||||
set { _keepMembersForDebuggerAttributes = value; }
|
||||
}
|
||||
|
||||
public bool IgnoreUnresolved
|
||||
{
|
||||
get { return _ignoreUnresolved; }
|
||||
set { _ignoreUnresolved = value; }
|
||||
}
|
||||
|
||||
public System.Collections.IDictionary Actions {
|
||||
get { return _actions; }
|
||||
}
|
||||
@@ -247,7 +260,7 @@ namespace Mono.Linker {
|
||||
} else if (IsCore (name)) {
|
||||
action = _coreAction;
|
||||
} else {
|
||||
action = AssemblyAction.Link;
|
||||
action = _userAction;
|
||||
}
|
||||
|
||||
_annotations.SetAction (assembly, action);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
/// <summary>
|
||||
/// Verifies that a resource exists in the test case assembly
|
||||
/// </summary>
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public class KeptResourceAttribute : KeptAttribute {
|
||||
public KeptResourceAttribute (string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty (name))
|
||||
throw new ArgumentException ("Value cannot be null or empty.", nameof (name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
/// <summary>
|
||||
/// Verifies that an embedded resource exists in an assembly
|
||||
/// </summary>
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public class KeptResourceInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
public KeptResourceInAssemblyAttribute (string assemblyFileName, string resourceName)
|
||||
{
|
||||
if (string.IsNullOrEmpty (assemblyFileName))
|
||||
throw new ArgumentNullException (nameof (assemblyFileName));
|
||||
|
||||
if (string.IsNullOrEmpty (resourceName))
|
||||
throw new ArgumentNullException (nameof (resourceName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
|
||||
/// <summary>
|
||||
/// Verifies that an embedded resource was removed from an assembly
|
||||
/// </summary>
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public class RemovedResourceInAssemblyAttribute : BaseInAssemblyAttribute {
|
||||
public RemovedResourceInAssemblyAttribute (string assemblyFileName, string resourceName)
|
||||
{
|
||||
if (string.IsNullOrEmpty (assemblyFileName))
|
||||
throw new ArgumentNullException (nameof (assemblyFileName));
|
||||
|
||||
if (string.IsNullOrEmpty (resourceName))
|
||||
throw new ArgumentNullException (nameof (resourceName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
|
||||
[AttributeUsage (AttributeTargets.Class)]
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
|
||||
public class SandboxDependencyAttribute : BaseMetadataAttribute {
|
||||
|
||||
public SandboxDependencyAttribute (string relativePathToFile)
|
||||
public SandboxDependencyAttribute (string relativePathToFile, string destinationFileName = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty (relativePathToFile))
|
||||
throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile));
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class SetupCompileAssemblyNameAttribute : BaseMetadataAttribute {
|
||||
public SetupCompileAssemblyNameAttribute (string outputName)
|
||||
{
|
||||
if (string.IsNullOrEmpty (outputName))
|
||||
throw new ArgumentNullException (nameof (outputName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
|
||||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
|
||||
public class SetupCompileResourceAttribute : BaseMetadataAttribute {
|
||||
public SetupCompileResourceAttribute (string relativePathToFile, string destinationFileName = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty (relativePathToFile))
|
||||
throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,13 +45,17 @@
|
||||
<Compile Include="Assertions\KeptBackingFieldAttribute.cs" />
|
||||
<Compile Include="Assertions\KeptMemberAttribute.cs" />
|
||||
<Compile Include="Assertions\KeptMemberInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\KeptResourceAttribute.cs" />
|
||||
<Compile Include="Assertions\KeptResourceInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\KeptTypeInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\RemovedAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\RemovedMemberInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\RemovedResourceInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\RemovedTypeInAssemblyAttribute.cs" />
|
||||
<Compile Include="Assertions\SkipPeVerifyAttribute.cs" />
|
||||
<Compile Include="Metadata\BaseMetadataAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupCompileAfterAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupCompileAssemblyNameAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupCompileBeforeAttribute.cs" />
|
||||
<Compile Include="Metadata\DefineAttribute.cs" />
|
||||
<Compile Include="Metadata\IncludeBlacklistStepAttribute.cs" />
|
||||
@@ -66,6 +70,7 @@
|
||||
<Compile Include="Assertions\RemovedForwarderAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupLinkerActionAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupLinkerCoreActionAttribute.cs" />
|
||||
<Compile Include="Metadata\SetupCompileResourceAttribute.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
24
external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs
vendored
Normal file
24
external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
using Mono.Linker.Tests.Cases.Expectations.Assertions;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.Basic
|
||||
{
|
||||
class UsedInterfaceIsKept
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
A a = new A ();
|
||||
}
|
||||
|
||||
[Kept]
|
||||
[KeptInterface (typeof (I))]
|
||||
[KeptMember (".ctor()")]
|
||||
class A : I
|
||||
{
|
||||
}
|
||||
|
||||
[Kept]
|
||||
interface I
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Mono.Linker.Tests.Cases.Expectations.Assertions;
|
||||
|
||||
namespace Mono.Linker.Tests.Cases.LinkXml {
|
||||
class UnusedTypePreservedByLinkXmlWithCommentIsKept {
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Kept]
|
||||
[KeptMember (".ctor()")]
|
||||
class UnusedTypePreservedByLinkXmlWithCommentIsKeptUnusedType
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<!-- this is a comment -->
|
||||
<linker>
|
||||
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="Mono.Linker.Tests.Cases.LinkXml.UnusedTypePreservedByLinkXmlWithCommentIsKeptUnusedType" />
|
||||
</assembly>
|
||||
</linker>
|
||||
@@ -59,10 +59,17 @@
|
||||
<Compile Include="Basic\UsedStructIsKept.cs" />
|
||||
<Compile Include="LinkXml\UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs" />
|
||||
<Compile Include="LinkXml\UnusedEventPreservedByLinkXmlIsKept.cs" />
|
||||
<Compile Include="LinkXml\UnusedTypePreservedByLinkXmlWithCommentIsKept.cs" />
|
||||
<Compile Include="LinkXml\UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs" />
|
||||
<Compile Include="Resources\EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs" />
|
||||
<Compile Include="Resources\EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs" />
|
||||
<Compile Include="Resources\EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.cs" />
|
||||
<Compile Include="Resources\EmbeddedLinkXmlFileIsProcessed.cs" />
|
||||
<Compile Include="Resources\NonLinkerEmbeddedResourceHasNoImpact.cs" />
|
||||
<Compile Include="TestFramework\CanCompileILAssembly.cs" />
|
||||
<Compile Include="TestFramework\VerifyDefineAttributeBehavior.cs" />
|
||||
<None Include="TypeForwarding\Dependencies\ForwarderLibrary.cs" />
|
||||
<Compile Include="TestFramework\VerifyResourceInAssemblyAttributesBehavior.cs" />
|
||||
<Compile Include="TypeForwarding\Dependencies\ImplementationLibrary.cs" />
|
||||
<Compile Include="TypeForwarding\Dependencies\LibraryUsingForwarder.cs" />
|
||||
<Compile Include="TypeForwarding\Dependencies\ReferenceImplementationLibrary.cs" />
|
||||
@@ -140,6 +147,7 @@
|
||||
<Compile Include="VirtualMethods\VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs" />
|
||||
<Compile Include="TypeForwarding\MissingTargetReference.cs" />
|
||||
<None Include="TypeForwarding\Dependencies\TypeForwarderMissingReference.il" />
|
||||
<Compile Include="Basic\UsedInterfaceIsKept.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="LinkXml\TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml" />
|
||||
@@ -151,12 +159,19 @@
|
||||
<Content Include="LinkXml\UnusedPropertyPreservedByLinkXmlIsKept.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml" />
|
||||
<Content Include="LinkXml\UnusedTypePreservedByLinkXmlIsKept.xml" />
|
||||
<Content Include="LinkXml\UnusedTypePreservedByLinkXmlWithCommentIsKept.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithPreserveAllHasAllMembersPreserved.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithPreserveNothingAndPreserveMembers.xml" />
|
||||
<Content Include="LinkXml\UnusedTypeWithPreserveNothingHasMembersRemoved.xml" />
|
||||
<Content Include="Resources\Dependencies\EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml" />
|
||||
<Content Include="Resources\Dependencies\EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml" />
|
||||
<Content Include="Resources\Dependencies\EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml" />
|
||||
<Content Include="Resources\Dependencies\EmbeddedLinkXmlFileIsProcessed.xml" />
|
||||
<Content Include="Resources\Dependencies\NonLinkerEmbeddedResourceHasNoImpact.xml" />
|
||||
<Content Include="TestFramework\Dependencies\VerifyResourceInAssemblyAttributesBehavior.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj">
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<linker>
|
||||
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<type fullname="Mono.Linker.Tests.Cases.Resources.EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly/Unused" />
|
||||
</assembly>
|
||||
</linker>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user