You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.142
Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
parent
e52655b4dc
commit
0abdbe5a7d
@@ -213,18 +213,27 @@ namespace Mono.Linker.Steps {
|
||||
if (source == target)
|
||||
return;
|
||||
|
||||
File.Copy (source, target, true);
|
||||
CopyFileAndRemoveReadOnly (source, target);
|
||||
|
||||
if (!Context.LinkSymbols)
|
||||
return;
|
||||
|
||||
var mdb = source + ".mdb";
|
||||
if (File.Exists (mdb))
|
||||
File.Copy (mdb, target + ".mdb", true);
|
||||
CopyFileAndRemoveReadOnly (mdb, target + ".mdb");
|
||||
|
||||
var pdb = Path.ChangeExtension (source, "pdb");
|
||||
if (File.Exists (pdb))
|
||||
File.Copy (pdb, Path.ChangeExtension (target, "pdb"), true);
|
||||
CopyFileAndRemoveReadOnly (pdb, Path.ChangeExtension (target, "pdb"));
|
||||
}
|
||||
|
||||
static void CopyFileAndRemoveReadOnly (string src, string dest) {
|
||||
File.Copy (src, dest, true);
|
||||
|
||||
FileAttributes attrs = File.GetAttributes (dest);
|
||||
|
||||
if ((attrs & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
File.SetAttributes (dest, attrs & ~FileAttributes.ReadOnly);
|
||||
}
|
||||
|
||||
protected virtual string GetAssemblyFileName (AssemblyDefinition assembly, string directory)
|
||||
|
||||
@@ -110,6 +110,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIterator iterator)
|
||||
{
|
||||
if (IsExcluded (iterator.Current))
|
||||
return;
|
||||
|
||||
Tracer.Push (assembly);
|
||||
if (GetTypePreserve (iterator.Current) == TypePreserve.All) {
|
||||
foreach (var type in assembly.MainModule.Types)
|
||||
@@ -155,10 +158,6 @@ namespace Mono.Linker.Steps {
|
||||
while (iterator.MoveNext ()) {
|
||||
XPathNavigator nav = iterator.Current;
|
||||
|
||||
var feature = GetAttribute (nav, "feature");
|
||||
if (Context.IsFeatureExcluded (feature))
|
||||
continue;
|
||||
|
||||
string fullname = GetFullName (nav);
|
||||
|
||||
if (IsTypePattern (fullname)) {
|
||||
@@ -243,6 +242,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessType (TypeDefinition type, XPathNavigator nav)
|
||||
{
|
||||
if (IsExcluded (nav))
|
||||
return;
|
||||
|
||||
TypePreserve preserve = GetTypePreserve (nav);
|
||||
|
||||
if (!IsRequired (nav)) {
|
||||
@@ -335,6 +337,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessField (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
if (IsExcluded (iterator.Current))
|
||||
return;
|
||||
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessFieldSignature (type, value);
|
||||
@@ -397,6 +402,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessMethod (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
if (IsExcluded (iterator.Current))
|
||||
return;
|
||||
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessMethodSignature (type, value);
|
||||
@@ -485,6 +493,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessEvent (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
if (IsExcluded (iterator.Current))
|
||||
return;
|
||||
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessEventSignature (type, value);
|
||||
@@ -550,6 +561,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
protected virtual void ProcessProperty (TypeDefinition type, XPathNodeIterator iterator)
|
||||
{
|
||||
if (IsExcluded (iterator.Current))
|
||||
return;
|
||||
|
||||
string value = GetSignature (iterator.Current);
|
||||
if (!String.IsNullOrEmpty (value))
|
||||
ProcessPropertySignature (type, value, GetAccessors (iterator.Current));
|
||||
@@ -687,6 +701,16 @@ namespace Mono.Linker.Steps {
|
||||
{
|
||||
return nav.GetAttribute (attribute, _ns);
|
||||
}
|
||||
|
||||
protected virtual bool IsExcluded (XPathNavigator nav)
|
||||
{
|
||||
var value = GetAttribute (nav, "feature");
|
||||
if (string.IsNullOrEmpty (value))
|
||||
return false;
|
||||
|
||||
return Context.IsFeatureExcluded (value);
|
||||
}
|
||||
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
|
||||
26
external/linker/linker/Linker/Annotations.cs
vendored
26
external/linker/linker/Linker/Annotations.cs
vendored
@@ -38,20 +38,20 @@ namespace Mono.Linker {
|
||||
|
||||
protected readonly LinkContext context;
|
||||
|
||||
readonly Dictionary<AssemblyDefinition, AssemblyAction> assembly_actions = new Dictionary<AssemblyDefinition, AssemblyAction> ();
|
||||
readonly Dictionary<MethodDefinition, MethodAction> method_actions = new Dictionary<MethodDefinition, MethodAction> ();
|
||||
readonly HashSet<IMetadataTokenProvider> marked = new HashSet<IMetadataTokenProvider> ();
|
||||
readonly HashSet<IMetadataTokenProvider> processed = new HashSet<IMetadataTokenProvider> ();
|
||||
readonly Dictionary<TypeDefinition, TypePreserve> preserved_types = new Dictionary<TypeDefinition, TypePreserve> ();
|
||||
readonly Dictionary<IMemberDefinition, List<MethodDefinition>> preserved_methods = new Dictionary<IMemberDefinition, List<MethodDefinition>> ();
|
||||
readonly HashSet<IMetadataTokenProvider> public_api = new HashSet<IMetadataTokenProvider> ();
|
||||
readonly Dictionary<MethodDefinition, List<MethodDefinition>> override_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
|
||||
readonly Dictionary<MethodDefinition, List<MethodDefinition>> base_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
|
||||
readonly Dictionary<AssemblyDefinition, ISymbolReader> symbol_readers = new Dictionary<AssemblyDefinition, ISymbolReader> ();
|
||||
protected readonly Dictionary<AssemblyDefinition, AssemblyAction> assembly_actions = new Dictionary<AssemblyDefinition, AssemblyAction> ();
|
||||
protected readonly Dictionary<MethodDefinition, MethodAction> method_actions = new Dictionary<MethodDefinition, MethodAction> ();
|
||||
protected readonly HashSet<IMetadataTokenProvider> marked = new HashSet<IMetadataTokenProvider> ();
|
||||
protected readonly HashSet<IMetadataTokenProvider> processed = new HashSet<IMetadataTokenProvider> ();
|
||||
protected readonly Dictionary<TypeDefinition, TypePreserve> preserved_types = new Dictionary<TypeDefinition, TypePreserve> ();
|
||||
protected readonly Dictionary<IMemberDefinition, List<MethodDefinition>> preserved_methods = new Dictionary<IMemberDefinition, List<MethodDefinition>> ();
|
||||
protected readonly HashSet<IMetadataTokenProvider> public_api = new HashSet<IMetadataTokenProvider> ();
|
||||
protected readonly Dictionary<MethodDefinition, List<MethodDefinition>> override_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
|
||||
protected readonly Dictionary<MethodDefinition, List<MethodDefinition>> base_methods = new Dictionary<MethodDefinition, List<MethodDefinition>> ();
|
||||
protected 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>> ();
|
||||
readonly HashSet<CustomAttribute> marked_attributes = new HashSet<CustomAttribute> ();
|
||||
protected readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
|
||||
protected readonly Dictionary<AssemblyDefinition, HashSet<string>> resources_to_remove = new Dictionary<AssemblyDefinition, HashSet<string>> ();
|
||||
protected readonly HashSet<CustomAttribute> marked_attributes = new HashSet<CustomAttribute> ();
|
||||
|
||||
public AnnotationStore (LinkContext context) => this.context = context;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user