Remove extracted linker sources and reuse them via submodule
authorMarek Safar <marek.safar@gmail.com>
Fri, 11 Nov 2016 17:39:40 +0000 (18:39 +0100)
committerMarek Safar <marek.safar@gmail.com>
Fri, 11 Nov 2016 17:53:31 +0000 (18:53 +0100)
152 files changed:
.gitmodules
external/linker [new submodule]
mcs/tools/Makefile
mcs/tools/linker/AUTHORS [deleted file]
mcs/tools/linker/MIT.X11 [deleted file]
mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/IStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs [deleted file]
mcs/tools/linker/Mono.Linker.csproj [deleted file]
mcs/tools/linker/Mono.Linker/Annotations.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyAction.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyInfo.cs [deleted file]
mcs/tools/linker/Mono.Linker/AssemblyResolver.cs [deleted file]
mcs/tools/linker/Mono.Linker/Driver.cs [deleted file]
mcs/tools/linker/Mono.Linker/I18nAssemblies.cs [deleted file]
mcs/tools/linker/Mono.Linker/IXApiVisitor.cs [deleted file]
mcs/tools/linker/Mono.Linker/LinkContext.cs [deleted file]
mcs/tools/linker/Mono.Linker/MethodAction.cs [deleted file]
mcs/tools/linker/Mono.Linker/Pipeline.cs [deleted file]
mcs/tools/linker/Mono.Linker/TypePreserve.cs [deleted file]
mcs/tools/linker/Mono.Linker/XApiReader.cs [deleted file]
mcs/tools/linker/README [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console-runner.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console.exe [deleted file]
mcs/tools/linker/Tests/Libs/nunit-console.exe.config [deleted file]
mcs/tools/linker/Tests/Libs/nunit.core.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit.framework.dll [deleted file]
mcs/tools/linker/Tests/Libs/nunit.util.dll [deleted file]
mcs/tools/linker/Tests/Makefile [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests.csproj [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs [deleted file]
mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile [deleted file]
mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml [deleted file]
mcs/tools/linker/Tests/TestCases/config.make [deleted file]
mcs/tools/linker/configure [deleted file]
mcs/tools/linker/monolinker.exe.sources
mcs/tools/linker/monolinker.in [deleted file]
mcs/tools/linker/profiler/Makefile [deleted file]
mcs/tools/linker/profiler/link.c [deleted file]
mcs/tools/linker/standalone.make [deleted file]
mcs/tools/tuner/Makefile [deleted file]
mcs/tools/tuner/Mono.Tuner-net_4_x.csproj [deleted file]
mcs/tools/tuner/Mono.Tuner.csproj [deleted file]
mcs/tools/tuner/Mono.Tuner.dll.sources [deleted file]
mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CecilRocks.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Dispatcher.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Extensions.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PrintStatus.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/Profile.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveResources.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs [deleted file]
mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/Extensions.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml [deleted file]
mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs [deleted file]
mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs [deleted file]

index 337fbe06c0b3ca4df54eaf18e0818d83c718667b..7545a7bacd2e8d4088874f996a435b01cb09385e 100644 (file)
@@ -49,3 +49,6 @@
 [submodule "external/bockbuild"]
        path = external/bockbuild
        url = git://github.com/mono/bockbuild.git
+[submodule "external/linker"]
+       path = external/linker
+       url = git@github.com:mono/linker.git
diff --git a/external/linker b/external/linker
new file mode 160000 (submodule)
index 0000000..e4d9784
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit e4d9784ac37b9ebf4757175c92bc7a3ec9fd867a
index af120d403ed56646c67d8ad8299c5779f5a6cb12..60600a30a325741f01915bcfef2b9706338f0267 100644 (file)
@@ -3,7 +3,6 @@ thisdir = tools
 net_4_5_dirs := \
        al              \
        linker          \
-       tuner           \
        culevel         \
        genxs           \
        mkbundle        \
diff --git a/mcs/tools/linker/AUTHORS b/mcs/tools/linker/AUTHORS
deleted file mode 100644 (file)
index 4af5896..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Jb Evain <jbevain@novell.com>
diff --git a/mcs/tools/linker/MIT.X11 b/mcs/tools/linker/MIT.X11
deleted file mode 100644 (file)
index d2d78ee..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2007 Novell, Inc and the individuals listed on the
-ChangeLog entries.
-
-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.
diff --git a/mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs b/mcs/tools/linker/Mono.Linker.Steps/BaseStep.cs
deleted file mode 100644 (file)
index 13cf468..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// BaseStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public abstract class BaseStep : IStep {
-
-               private LinkContext _context;
-
-               public LinkContext Context {
-                       get { return _context; }
-               }
-
-               public AnnotationStore Annotations {
-                       get { return _context.Annotations; }
-               }
-
-               public void Process (LinkContext context)
-               {
-                       _context = context;
-
-                       if (!ConditionToProcess ())
-                               return;
-
-                       Process ();
-
-                       foreach (AssemblyDefinition assembly in context.GetAssemblies ())
-                               ProcessAssembly (assembly);
-
-                       EndProcess ();
-               }
-
-               protected virtual bool ConditionToProcess ()
-               {
-                       return true;
-               }
-
-               protected virtual void Process ()
-               {
-               }
-
-               protected virtual void EndProcess ()
-               {
-               }
-
-               protected virtual void ProcessAssembly (AssemblyDefinition assembly)
-               {
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs b/mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs
deleted file mode 100644 (file)
index 6c6344b..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-// Blacklist.cs
-//
-// Author:
-//   Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell Inc.
-//
-// 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.Linq;
-using System.IO;
-using System.Reflection;
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class BlacklistStep : BaseStep {
-
-               protected override bool ConditionToProcess()
-               {
-                       return Context.CoreAction == AssemblyAction.Link;
-               }
-
-               protected override void Process ()
-               {
-                       foreach (string name in Assembly.GetExecutingAssembly ().GetManifestResourceNames ()) {
-                               if (!name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase) || !IsReferenced (GetAssemblyName (name)))
-                                       continue;
-
-                               try {
-                                       if (Context.LogInternalExceptions)
-                                               Console.WriteLine ("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);
-                               }
-                       }
-
-                       foreach (var asm in Context.GetAssemblies ()) {
-                               foreach (var rsc in asm.Modules
-                                                                       .SelectMany (mod => mod.Resources)
-                                                                       .Where (res => res.ResourceType == ResourceType.Embedded)
-                                                                       .Where (res => res.Name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase))
-                                                                       .Where (res => IsReferenced (GetAssemblyName (res.Name)))
-                                                                       .Cast<EmbeddedResource> ()) {
-                                       try {
-                                               if (Context.LogInternalExceptions)
-                                                       Console.WriteLine ("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);
-                                       }
-                               }
-                       }
-               }
-
-               static string GetAssemblyName (string descriptor)
-               {
-                       int pos = descriptor.LastIndexOf ('.');
-                       if (pos == -1)
-                               return descriptor;
-
-                       return descriptor.Substring (0, pos);
-               }
-
-               bool IsReferenced (string name)
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
-                               if (assembly.Name.Name == name)
-                                       return true;
-
-                       return false;
-               }
-
-               static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
-               {
-                       return new ResolveFromXmlStep (GetExternalDescriptor (resource), "resource " + resource.Name + " in " + assembly.FullName);
-               }
-
-               static ResolveFromXmlStep GetResolveStep (string descriptor)
-               {
-                       return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName);
-               }
-
-               static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
-               {
-                       using (var sr = new StreamReader (resource.GetResourceStream ())) {
-                               return new XPathDocument (new StringReader (sr.ReadToEnd ()));
-                       }
-               }
-
-               static XPathDocument GetDescriptor (string descriptor)
-               {
-                       using (StreamReader sr = new StreamReader (GetResource (descriptor))) {
-                               return new XPathDocument (new StringReader (sr.ReadToEnd ()));
-                       }
-               }
-
-               static Stream GetResource (string descriptor)
-               {
-                       return Assembly.GetExecutingAssembly ().GetManifestResourceStream (descriptor);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs b/mcs/tools/linker/Mono.Linker.Steps/CleanStep.cs
deleted file mode 100644 (file)
index ccc34cb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// CleanStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Collections;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class CleanStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) == AssemblyAction.Link)
-                               CleanAssembly (assembly);
-               }
-
-               static void CleanAssembly (AssemblyDefinition asm)
-               {
-                       foreach (TypeDefinition type in asm.MainModule.Types)
-                               CleanType (type);
-               }
-
-               static void CleanType (TypeDefinition type)
-               {
-                       if (type.HasProperties)
-                               CleanProperties (type);
-                       if (type.HasEvents)
-                               CleanEvents (type);
-
-                       if (type.HasNestedTypes)
-                               foreach (var nested in type.NestedTypes)
-                                       CleanType (nested);
-               }
-
-               static MethodDefinition CheckMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       if (method == null)
-                               return null;
-
-                       return type.Methods.Contains (method) ? method : null;
-               }
-
-               static void CleanEvents (TypeDefinition type)
-               {
-                       var events = type.Events;
-
-                       for (int i = 0; i < events.Count; i++) {
-                               var evt = events [i];
-                               evt.AddMethod = CheckMethod (type, evt.AddMethod);
-                               evt.InvokeMethod = CheckMethod (type, evt.InvokeMethod);
-                               evt.RemoveMethod = CheckMethod (type, evt.RemoveMethod);
-
-                               if (!IsEventUsed (evt))
-                                       events.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsEventUsed (EventDefinition evt)
-               {
-                       return evt.AddMethod != null || evt.InvokeMethod != null || evt.RemoveMethod != null;
-               }
-
-               static void CleanProperties (TypeDefinition type)
-               {
-                       var properties = type.Properties;
-
-                       for (int i = 0; i < properties.Count; i++) {
-                               var prop = properties [i];
-                               prop.GetMethod = CheckMethod (type, prop.GetMethod);
-                               prop.SetMethod = CheckMethod (type, prop.SetMethod);
-
-                               if (!IsPropertyUsed (prop))
-                                       properties.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsPropertyUsed (PropertyDefinition prop)
-               {
-                       return prop.GetMethod != null || prop.SetMethod != null;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/IStep.cs b/mcs/tools/linker/Mono.Linker.Steps/IStep.cs
deleted file mode 100644 (file)
index c01ef1e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// IStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Steps {
-
-       public interface IStep {
-               void Process (LinkContext context);
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs b/mcs/tools/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
deleted file mode 100644 (file)
index 45ac924..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// LoadI18nAssemblies.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class LoadI18nAssemblies : BaseStep {
-
-               static readonly byte [] _pktoken = new byte [] {0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56};
-
-               I18nAssemblies _assemblies;
-
-               public LoadI18nAssemblies (I18nAssemblies assemblies)
-               {
-                       _assemblies = assemblies;
-               }
-
-               protected override bool ConditionToProcess ()
-               {
-                       return _assemblies != I18nAssemblies.None &&
-                               Type.GetType ("System.MonoType") != null;
-               }
-
-               protected override void Process()
-               {
-                       LoadAssembly (GetAssemblyName (I18nAssemblies.Base));
-
-                       LoadI18nAssembly (I18nAssemblies.CJK);
-                       LoadI18nAssembly (I18nAssemblies.MidEast);
-                       LoadI18nAssembly (I18nAssemblies.Other);
-                       LoadI18nAssembly (I18nAssemblies.Rare);
-                       LoadI18nAssembly (I18nAssemblies.West);
-               }
-
-               bool ShouldCopyAssembly (I18nAssemblies current)
-               {
-                       return (current & _assemblies) != 0;
-               }
-
-               void LoadI18nAssembly (I18nAssemblies asm)
-               {
-                       if (!ShouldCopyAssembly (asm))
-                               return;
-
-                       AssemblyNameReference name = GetAssemblyName (asm);
-                       LoadAssembly (name);
-               }
-
-               void LoadAssembly (AssemblyNameReference name)
-               {
-                       AssemblyDefinition assembly = Context.Resolve (name);
-                       ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
-               }
-
-               AssemblyNameReference GetAssemblyName (I18nAssemblies assembly)
-               {
-                       AssemblyNameReference name = new AssemblyNameReference ("I18N", GetCorlibVersion ());
-                       if (assembly != I18nAssemblies.Base)
-                               name.Name += "." + assembly;
-
-                       name.PublicKeyToken = _pktoken;
-                       return name;
-               }
-
-               Version GetCorlibVersion ()
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ())
-                               if (assembly.Name.Name == "mscorlib")
-                                       return assembly.Name.Version;
-
-                       return new Version ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs b/mcs/tools/linker/Mono.Linker.Steps/LoadReferencesStep.cs
deleted file mode 100644 (file)
index a55fd1d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// LoadReferencesStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Collections;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class LoadReferencesStep : BaseStep {
-
-               IDictionary _references = new Hashtable ();
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessReferences (assembly);
-               }
-
-               void ProcessReferences (AssemblyDefinition assembly)
-               {
-                       if (_references.Contains (assembly.Name))
-                               return;
-
-                       _references.Add (assembly.Name, assembly);
-
-                       foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences)
-                               ProcessReferences (Context.Resolve (reference));
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
deleted file mode 100644 (file)
index 9bf293d..0000000
+++ /dev/null
@@ -1,1150 +0,0 @@
-//
-// MarkStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
-       public class MarkStep : IStep {
-
-               protected LinkContext _context;
-               protected Queue _methods;
-               protected ArrayList _virtual_methods;
-
-               public AnnotationStore Annotations {
-                       get { return _context.Annotations; }
-               }
-
-               public MarkStep ()
-               {
-                       _methods = new Queue ();
-                       _virtual_methods = new ArrayList ();
-               }
-
-               public virtual void Process (LinkContext context)
-               {
-                       _context = context;
-
-                       Initialize ();
-                       Process ();
-               }
-
-               void Initialize ()
-               {
-                       foreach (AssemblyDefinition assembly in _context.GetAssemblies ())
-                               InitializeAssembly (assembly);
-               }
-
-               protected virtual void InitializeAssembly (AssemblyDefinition assembly)
-               {
-                       MarkAssembly (assembly);
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               InitializeType (type);
-               }
-
-               void InitializeType (TypeDefinition type)
-               {
-                       if (type.HasNestedTypes) {
-                               foreach (var nested in type.NestedTypes)
-                                       InitializeType (nested);
-                       }
-
-                       if (!Annotations.IsMarked (type))
-                               return;
-
-                       MarkType (type);
-
-                       if (type.HasFields)
-                               InitializeFields (type);
-                       if (type.HasMethods)
-                               InitializeMethods (type.Methods);
-               }
-
-               void InitializeFields (TypeDefinition type)
-               {
-                       foreach (FieldDefinition field in type.Fields)
-                               if (Annotations.IsMarked (field))
-                                       MarkField (field);
-               }
-
-               void InitializeMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (Annotations.IsMarked (method))
-                                       EnqueueMethod (method);
-               }
-
-               void Process ()
-               {
-                       if (QueueIsEmpty ())
-                               throw new InvalidOperationException ("No entry methods");
-
-                       while (!QueueIsEmpty ()) {
-                               ProcessQueue ();
-                               ProcessVirtualMethods ();
-                       }
-               }
-
-               void ProcessQueue ()
-               {
-                       while (!QueueIsEmpty ()) {
-                               MethodDefinition method = (MethodDefinition) _methods.Dequeue ();
-                               Annotations.Push (method);
-                               ProcessMethod (method);
-                               Annotations.Pop ();
-                       }
-               }
-
-               bool QueueIsEmpty ()
-               {
-                       return _methods.Count == 0;
-               }
-
-               protected virtual void EnqueueMethod (MethodDefinition method)
-               {
-                       _methods.Enqueue (method);
-               }
-
-               void ProcessVirtualMethods ()
-               {
-                       foreach (MethodDefinition method in _virtual_methods) {
-                               Annotations.Push (method);
-                               ProcessVirtualMethod (method);
-                               Annotations.Pop ();
-                       }
-               }
-
-               void ProcessVirtualMethod (MethodDefinition method)
-               {
-                       IList overrides = Annotations.GetOverrides (method);
-                       if (overrides == null)
-                               return;
-
-                       foreach (MethodDefinition @override in overrides)
-                               ProcessOverride (@override);
-               }
-
-               void ProcessOverride (MethodDefinition method)
-               {
-                       if (!Annotations.IsMarked (method.DeclaringType))
-                               return;
-
-                       if (Annotations.IsProcessed (method))
-                               return;
-
-                       if (Annotations.IsMarked (method))
-                               return;
-
-                       MarkMethod (method);
-                       ProcessVirtualMethod (method);
-               }
-
-               void MarkMarshalSpec (IMarshalInfoProvider spec)
-               {
-                       if (!spec.HasMarshalInfo)
-                               return;
-
-                       var marshaler = spec.MarshalInfo as CustomMarshalInfo;
-                       if (marshaler == null)
-                               return;
-
-                       MarkType (marshaler.ManagedType);
-               }
-
-               void MarkCustomAttributes (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute ca in provider.CustomAttributes)
-                               MarkCustomAttribute (ca);
-               }
-
-               protected virtual void MarkCustomAttribute (CustomAttribute ca)
-               {
-                       Annotations.Push (ca);
-                       MarkMethod (ca.Constructor);
-
-                       MarkCustomAttributeArguments (ca);
-
-                       TypeReference constructor_type = ca.Constructor.DeclaringType;
-                       TypeDefinition type = constructor_type.Resolve ();
-                       if (type == null) {
-                               Annotations.Pop ();
-                               throw new ResolutionException (constructor_type);
-                       }
-
-                       MarkCustomAttributeProperties (ca, type);
-                       MarkCustomAttributeFields (ca, type);
-                       Annotations.Pop ();
-               }
-
-               protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider)
-               {
-                       // most security declarations are removed (if linked) but user code might still have some
-                       // and if the attribtues references types then they need to be marked too
-                       if ((provider == null) || !provider.HasSecurityDeclarations)
-                               return;
-
-                       foreach (var sd in provider.SecurityDeclarations)
-                               MarkSecurityDeclaration (sd);
-               }
-
-               protected virtual void MarkSecurityDeclaration (SecurityDeclaration sd)
-               {
-                       if (!sd.HasSecurityAttributes)
-                               return;
-                       
-                       foreach (var sa in sd.SecurityAttributes)
-                               MarkSecurityAttribute (sa);
-               }
-
-               protected virtual void MarkSecurityAttribute (SecurityAttribute sa)
-               {
-                       TypeReference security_type = sa.AttributeType;
-                       TypeDefinition type = security_type.Resolve ();
-                       if (type == null)
-                               throw new ResolutionException (security_type);
-                       
-                       MarkType (security_type);
-                       MarkSecurityAttributeProperties (sa, type);
-                       MarkSecurityAttributeFields (sa, type);
-               }
-
-               protected void MarkSecurityAttributeProperties (SecurityAttribute sa, TypeDefinition attribute)
-               {
-                       if (!sa.HasProperties)
-                               return;
-
-                       foreach (var named_argument in sa.Properties)
-                               MarkCustomAttributeProperty (named_argument, attribute);
-               }
-
-               protected void MarkSecurityAttributeFields (SecurityAttribute sa, TypeDefinition attribute)
-               {
-                       if (!sa.HasFields)
-                               return;
-
-                       foreach (var named_argument in sa.Fields)
-                               MarkCustomAttributeField (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute)
-               {
-                       if (!ca.HasProperties)
-                               return;
-
-                       foreach (var named_argument in ca.Properties)
-                               MarkCustomAttributeProperty (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
-               {
-                       PropertyDefinition property = GetProperty (attribute, namedArgument.Name);
-                       Annotations.Push (property);
-                       if (property != null)
-                               MarkMethod (property.SetMethod);
-
-                       MarkIfType (namedArgument.Argument);
-                       Annotations.Pop ();
-               }
-
-               PropertyDefinition GetProperty (TypeDefinition type, string propertyname)
-               {
-                       while (type != null) {
-                               PropertyDefinition property = type.Properties.FirstOrDefault (p => p.Name == propertyname);
-                               if (property != null)
-                                       return property;
-
-                               type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
-                       }
-
-                       return null;
-               }
-
-               protected void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute)
-               {
-                       if (!ca.HasFields)
-                               return;
-
-                       foreach (var named_argument in ca.Fields)
-                               MarkCustomAttributeField (named_argument, attribute);
-               }
-
-               protected void MarkCustomAttributeField (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
-               {
-                       FieldDefinition field = GetField (attribute, namedArgument.Name);
-                       if (field != null)
-                               MarkField (field);
-
-                       MarkIfType (namedArgument.Argument);
-               }
-
-               FieldDefinition GetField (TypeDefinition type, string fieldname)
-               {
-                       while (type != null) {
-                               FieldDefinition field = type.Fields.FirstOrDefault (f => f.Name == fieldname);
-                               if (field != null)
-                                       return field;
-
-                               type = type.BaseType != null ? ResolveTypeDefinition (type.BaseType) : null;
-                       }
-
-                       return null;
-               }
-
-               void MarkCustomAttributeArguments (CustomAttribute ca)
-               {
-                       if (!ca.HasConstructorArguments)
-                               return;
-
-                       foreach (var argument in ca.ConstructorArguments)
-                               MarkIfType (argument);
-               }
-
-               void MarkIfType (CustomAttributeArgument argument)
-               {
-                       var at = argument.Type;
-                       if (at.IsArray) {
-                               var et = at.GetElementType ();
-                               if (et.Namespace != "System" || et.Name != "Type")
-                                       return;
-
-                               MarkType (et);
-                               if (argument.Value == null)
-                                       return;
-
-                               foreach (var cac in (CustomAttributeArgument[]) argument.Value)
-                                       MarkWithResolvedScope ((TypeReference) cac.Value);
-                       } else if (at.Namespace == "System" && at.Name == "Type") {
-                               MarkType (argument.Type);
-                               MarkWithResolvedScope ((TypeReference) argument.Value);
-                       }
-               }
-
-               // custom attributes encoding means it's possible to have a scope that will point into a PCL facade
-               // even if we (just before saving) will resolve all type references (bug #26752)
-               void MarkWithResolvedScope (TypeReference type)
-               {
-                       if (type == null)
-                               return;
-
-                       // a GenericInstanceType can could contains generic arguments with scope that
-                       // needs to be updated out of the PCL facade (bug #28823)
-                       var git = (type as GenericInstanceType);
-                       if ((git != null) && git.HasGenericArguments) {
-                               foreach (var ga in git.GenericArguments)
-                                       MarkWithResolvedScope (ga);
-                       }
-                       // we cannot set the Scope of a TypeSpecification but it's element type can be set
-                       // e.g. System.String[] -> System.String
-                       var ts = (type as TypeSpecification);
-                       if (ts != null) {
-                               MarkWithResolvedScope (ts.GetElementType ());
-                               return;
-                       }
-
-                       var td = type.Resolve ();
-                       if (td != null)
-                               type.Scope = td.Scope;
-                       MarkType (type);
-               }
-
-               protected bool CheckProcessed (IMetadataTokenProvider provider)
-               {
-                       if (Annotations.IsProcessed (provider))
-                               return true;
-
-                       Annotations.Processed (provider);
-                       return false;
-               }
-
-               protected void MarkAssembly (AssemblyDefinition assembly)
-               {
-                       if (CheckProcessed (assembly))
-                               return;
-
-                       ProcessModule (assembly);
-
-                       MarkCustomAttributes (assembly);
-                       MarkSecurityDeclarations (assembly);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               MarkCustomAttributes (module);
-               }
-
-               void ProcessModule (AssemblyDefinition assembly)
-               {
-                       // Pre-mark <Module> if there is any methods as they need to be executed 
-                       // at assembly load time
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                       {
-                               if (type.Name == "<Module>" && type.HasMethods)
-                               {
-                                       MarkType (type);
-                                       break;
-                               }
-                       }
-               }
-
-               protected void MarkField (FieldReference reference)
-               {
-//                     if (IgnoreScope (reference.DeclaringType.Scope))
-//                             return;
-
-                       if (reference.DeclaringType is GenericInstanceType)
-                               MarkType (reference.DeclaringType);
-
-                       FieldDefinition field = ResolveFieldDefinition (reference);
-
-                       if (field == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (field))
-                               return;
-
-                       MarkType (field.DeclaringType);
-                       MarkType (field.FieldType);
-                       MarkCustomAttributes (field);
-                       MarkMarshalSpec (field);
-
-                       Annotations.Mark (field);
-               }
-
-               protected virtual bool IgnoreScope (IMetadataScope scope)
-               {
-                       AssemblyDefinition assembly = ResolveAssembly (scope);
-                       return Annotations.GetAction (assembly) != AssemblyAction.Link;
-               }
-
-               FieldDefinition ResolveFieldDefinition (FieldReference field)
-               {
-                       FieldDefinition fd = field as FieldDefinition;
-                       if (fd == null)
-                               fd = field.Resolve ();
-
-                       return fd;
-               }
-
-               void MarkScope (IMetadataScope scope)
-               {
-                       var provider = scope as IMetadataTokenProvider;
-                       if (provider == null)
-                               return;
-
-                       Annotations.Mark (provider);
-               }
-
-               protected virtual void MarkSerializable (TypeDefinition type)
-               {
-                       MarkDefaultConstructor (type);
-                       MarkMethodsIf (type.Methods, IsSpecialSerializationConstructorPredicate);
-               }
-
-               protected virtual TypeDefinition MarkType (TypeReference reference)
-               {
-                       if (reference == null)
-                               return null;
-
-                       reference = GetOriginalType (reference);
-
-                       if (reference is GenericParameter)
-                               return null;
-
-//                     if (IgnoreScope (reference.Scope))
-//                             return;
-
-                       TypeDefinition type = ResolveTypeDefinition (reference);
-
-                       if (type == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (type))
-                               return null;
-
-                       Annotations.Push (type);
-
-                       MarkScope (type.Scope);
-                       MarkType (type.BaseType);
-                       MarkType (type.DeclaringType);
-                       MarkCustomAttributes (type);
-                       MarkSecurityDeclarations (type);
-
-                       if (IsMulticastDelegate (type)) {
-                               MarkMethodCollection (type.Methods);
-                       }
-
-                       if (IsSerializable (type))
-                               MarkSerializable (type);
-
-                       MarkTypeSpecialCustomAttributes (type);
-
-                       MarkGenericParameterProvider (type);
-
-                       // keep fields for value-types and for classes with LayoutKind.Sequential or Explicit
-                       if (type.IsValueType || !type.IsAutoLayout)
-                               MarkFields (type, type.IsEnum);
-
-                       if (type.HasInterfaces) {
-                               foreach (var iface in type.Interfaces)
-                                       MarkType (iface.InterfaceType);
-                       }
-
-                       if (type.HasMethods) {
-                               MarkMethodsIf (type.Methods, IsVirtualAndHasPreservedParent);
-                               MarkMethodsIf (type.Methods, IsStaticConstructorPredicate);
-                               MarkMethodsIf (type.Methods, HasSerializationAttribute);
-                       }
-
-                       DoAdditionalTypeProcessing (type);
-
-                       Annotations.Pop ();
-
-                       Annotations.Mark (type);
-
-                       ApplyPreserveInfo (type);
-
-                       return type;
-               }
-
-               // Allow subclassers to mark additional things when marking a method
-               protected virtual void DoAdditionalTypeProcessing (TypeDefinition method)
-               {
-               }
-
-               void MarkTypeSpecialCustomAttributes (TypeDefinition type)
-               {
-                       if (!type.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute attribute in type.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case "System.Xml.Serialization.XmlSchemaProviderAttribute":
-                                       MarkXmlSchemaProvider (type, attribute);
-                                       break;
-                               }
-                       }
-               }
-
-               void MarkMethodSpecialCustomAttributes (MethodDefinition method)
-               {
-                       if (!method.HasCustomAttributes)
-                               return;
-
-                       foreach (CustomAttribute attribute in method.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case "System.Web.Services.Protocols.SoapHeaderAttribute":
-                                       MarkSoapHeader (method, attribute);
-                                       break;
-                               }
-                       }
-               }
-
-               void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute)
-               {
-                       string method_name;
-                       if (!TryGetStringArgument (attribute, out method_name))
-                               return;
-
-                       MarkNamedMethod (type, method_name);
-               }
-
-               static bool TryGetStringArgument (CustomAttribute attribute, out string argument)
-               {
-                       argument = null;
-
-                       if (attribute.ConstructorArguments.Count < 1)
-                               return false;
-
-                       argument = attribute.ConstructorArguments [0].Value as string;
-
-                       return argument != null;
-               }
-
-               protected int MarkNamedMethod (TypeDefinition type, string method_name)
-               {
-                       if (!type.HasMethods)
-                               return 0;
-
-                       int count = 0;
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (method.Name != method_name)
-                                       continue;
-
-                               MarkMethod (method);
-                               count++;
-                       }
-
-                       return count;
-               }
-
-               void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute)
-               {
-                       string member_name;
-                       if (!TryGetStringArgument (attribute, out member_name))
-                               return;
-
-                       MarkNamedField (method.DeclaringType, member_name);
-                       MarkNamedProperty (method.DeclaringType, member_name);
-               }
-
-               void MarkNamedField (TypeDefinition type, string field_name)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (field.Name != field_name)
-                                       continue;
-
-                               MarkField (field);
-                       }
-               }
-
-               void MarkNamedProperty (TypeDefinition type, string property_name)
-               {
-                       if (!type.HasProperties)
-                               return;
-
-                       foreach (PropertyDefinition property in type.Properties) {
-                               if (property.Name != property_name)
-                                       continue;
-
-                               Annotations.Push (property);
-                               MarkMethod (property.GetMethod);
-                               MarkMethod (property.SetMethod);
-                               Annotations.Pop ();
-                       }
-               }
-
-               void MarkGenericParameterProvider (IGenericParameterProvider provider)
-               {
-                       if (!provider.HasGenericParameters)
-                               return;
-
-                       foreach (GenericParameter parameter in provider.GenericParameters)
-                               MarkGenericParameter (parameter);
-               }
-
-               void MarkGenericParameter (GenericParameter parameter)
-               {
-                       MarkCustomAttributes (parameter);
-                       foreach (TypeReference constraint in parameter.Constraints)
-                               MarkType (constraint);
-               }
-
-               bool IsVirtualAndHasPreservedParent (MethodDefinition method)
-               {
-                       if (!method.IsVirtual)
-                               return false;
-
-                       var base_list = Annotations.GetBaseMethods (method);
-                       if (base_list == null)
-                               return false;
-
-                       foreach (MethodDefinition @base in base_list) {
-                               if (IgnoreScope (@base.DeclaringType.Scope))
-                                       return true;
-
-                               if (IsVirtualAndHasPreservedParent (@base))
-                                       return true;
-                       }
-
-                       return false;
-               }
-
-               static MethodPredicate IsSpecialSerializationConstructorPredicate = new MethodPredicate (IsSpecialSerializationConstructor);
-
-               static bool IsSpecialSerializationConstructor (MethodDefinition method)
-               {
-                       if (!IsConstructor (method))
-                               return false;
-
-                       var parameters = method.Parameters;
-                       if (parameters.Count != 2)
-                               return false;
-
-                       return parameters [0].ParameterType.Name == "SerializationInfo" &&
-                               parameters [1].ParameterType.Name == "StreamingContext";
-               }
-
-               delegate bool MethodPredicate (MethodDefinition method);
-
-               void MarkMethodsIf (ICollection methods, MethodPredicate predicate)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (predicate (method)) {
-                                       Annotations.Push (predicate);
-                                       MarkMethod (method);
-                                       Annotations.Pop ();
-                               }
-               }
-
-               static MethodPredicate IsDefaultConstructorPredicate = new MethodPredicate (IsDefaultConstructor);
-
-               static bool IsDefaultConstructor (MethodDefinition method)
-               {
-                       return IsConstructor (method) && !method.HasParameters;
-               }
-
-               static bool IsConstructor (MethodDefinition method)
-               {
-                       return method.IsConstructor && !method.IsStatic;
-               }
-
-               protected void MarkDefaultConstructor (TypeDefinition type)
-               {
-                       if ((type == null) || !type.HasMethods)
-                               return;
-
-                       MarkMethodsIf (type.Methods, IsDefaultConstructorPredicate);
-               }
-
-               static MethodPredicate IsStaticConstructorPredicate = new MethodPredicate (IsStaticConstructor);
-
-               static bool IsStaticConstructor (MethodDefinition method)
-               {
-                       return method.IsConstructor && method.IsStatic;
-               }
-
-               static bool HasSerializationAttribute (MethodDefinition method)
-               {
-                       if (!method.HasCustomAttributes)
-                               return false;
-                       foreach (var ca in method.CustomAttributes) {
-                               var cat = ca.AttributeType;
-                               if (cat.Namespace != "System.Runtime.Serialization")
-                                       continue;
-                               switch (cat.Name) {
-                               case "OnDeserializedAttribute":
-                               case "OnDeserializingAttribute":
-                               case "OnSerializedAttribute":
-                               case "OnSerializingAttribute":
-                                       return true;
-                               }
-                       }
-                       return false;
-               }
-
-               static bool IsSerializable (TypeDefinition td)
-               {
-                       return (td.Attributes & TypeAttributes.Serializable) != 0;
-               }
-
-               static bool IsMulticastDelegate (TypeDefinition td)
-               {
-                       return td.BaseType != null && td.BaseType.FullName == "System.MulticastDelegate";
-               }
-
-               protected TypeDefinition ResolveTypeDefinition (TypeReference type)
-               {
-                       TypeDefinition td = type as TypeDefinition;
-                       if (td == null)
-                               td = type.Resolve ();
-
-                       return td;
-               }
-
-               protected TypeReference GetOriginalType (TypeReference type)
-               {
-                       while (type is TypeSpecification) {
-                               GenericInstanceType git = type as GenericInstanceType;
-                               if (git != null)
-                                       MarkGenericArguments (git);
-
-                               var mod = type as IModifierType;
-                               if (mod != null)
-                                       MarkModifierType (mod);
-
-                               type = ((TypeSpecification) type).ElementType;
-                       }
-
-                       return type;
-               }
-
-               void MarkModifierType (IModifierType mod)
-               {
-                       MarkType (mod.ModifierType);
-               }
-
-               void MarkGenericArguments (IGenericInstance instance)
-               {
-                       foreach (TypeReference argument in instance.GenericArguments)
-                               MarkType (argument);
-
-                       MarkGenericArgumentConstructors (instance);
-               }
-
-               void MarkGenericArgumentConstructors (IGenericInstance instance)
-               {
-                       var arguments = instance.GenericArguments;
-
-                       var generic_element = GetGenericProviderFromInstance (instance);
-                       if (generic_element == null)
-                               return;
-
-                       var parameters = generic_element.GenericParameters;
-
-                       if (arguments.Count != parameters.Count)
-                               return;
-
-                       for (int i = 0; i < arguments.Count; i++) {
-                               var argument = arguments [i];
-                               var parameter = parameters [i];
-
-                               if (!parameter.HasDefaultConstructorConstraint)
-                                       continue;
-
-                               var argument_definition = ResolveTypeDefinition (argument);
-                               if (argument_definition == null)
-                                       continue;
-
-                               MarkMethodsIf (argument_definition.Methods, ctor => !ctor.IsStatic && !ctor.HasParameters);
-                       }
-               }
-
-               IGenericParameterProvider GetGenericProviderFromInstance (IGenericInstance instance)
-               {
-                       var method = instance as GenericInstanceMethod;
-                       if (method != null)
-                               return ResolveMethodDefinition (method.ElementMethod);
-
-                       var type = instance as GenericInstanceType;
-                       if (type != null)
-                               return ResolveTypeDefinition (type.ElementType);
-
-                       return null;
-               }
-
-               void ApplyPreserveInfo (TypeDefinition type)
-               {
-                       ApplyPreserveMethods (type);
-
-                       if (!Annotations.IsPreserved (type))
-                               return;
-
-                       switch (Annotations.GetPreserve (type)) {
-                       case TypePreserve.All:
-                               MarkFields (type, true);
-                               MarkMethods (type);
-                               break;
-                       case TypePreserve.Fields:
-                               MarkFields (type, true);
-                               break;
-                       case TypePreserve.Methods:
-                               MarkMethods (type);
-                               break;
-                       }
-               }
-
-               void ApplyPreserveMethods (TypeDefinition type)
-               {
-                       var list = Annotations.GetPreservedMethods (type);
-                       if (list == null)
-                               return;
-
-                       MarkMethodCollection (list);
-               }
-
-               void ApplyPreserveMethods (MethodDefinition method)
-               {
-                       var list = Annotations.GetPreservedMethods (method);
-                       if (list == null)
-                               return;
-
-                       MarkMethodCollection (list);
-               }
-
-               protected void MarkFields (TypeDefinition type, bool includeStatic)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!includeStatic && field.IsStatic)
-                                       continue;
-                               MarkField (field);
-                       }
-               }
-
-               protected virtual void MarkMethods (TypeDefinition type)
-               {
-                       if (type.HasMethods)
-                               MarkMethodCollection (type.Methods);
-               }
-
-               void MarkMethodCollection (IEnumerable methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               MarkMethod (method);
-               }
-
-               protected virtual MethodDefinition MarkMethod (MethodReference reference)
-               {
-                       reference = GetOriginalMethod (reference);
-
-                       if (reference.DeclaringType is ArrayType)
-                               return null;
-
-                       Annotations.Push (reference);
-                       if (reference.DeclaringType is GenericInstanceType)
-                               MarkType (reference.DeclaringType);
-
-//                     if (IgnoreScope (reference.DeclaringType.Scope))
-//                             return;
-
-                       MethodDefinition method = ResolveMethodDefinition (reference);
-
-                       if (method == null) {
-                               Annotations.Pop ();
-                               throw new ResolutionException (reference);
-                       }
-
-                       if (Annotations.GetAction (method) == MethodAction.Nothing)
-                               Annotations.SetAction (method, MethodAction.Parse);
-
-                       EnqueueMethod (method);
-
-                       Annotations.Pop ();
-                       Annotations.AddDependency (method);
-
-                       return method;
-               }
-
-               AssemblyDefinition ResolveAssembly (IMetadataScope scope)
-               {
-                       AssemblyDefinition assembly = _context.Resolve (scope);
-                       MarkAssembly (assembly);
-                       return assembly;
-               }
-
-               protected MethodReference GetOriginalMethod (MethodReference method)
-               {
-                       while (method is MethodSpecification) {
-                               GenericInstanceMethod gim = method as GenericInstanceMethod;
-                               if (gim != null)
-                                       MarkGenericArguments (gim);
-
-                               method = ((MethodSpecification) method).ElementMethod;
-                       }
-
-                       return method;
-               }
-
-               MethodDefinition ResolveMethodDefinition (MethodReference method)
-               {
-                       MethodDefinition md = method as MethodDefinition;
-                       if (md == null)
-                               md = method.Resolve ();
-
-                       return md;
-               }
-
-               protected virtual void ProcessMethod (MethodDefinition method)
-               {
-                       if (CheckProcessed (method))
-                               return;
-
-                       Annotations.Push (method);
-                       MarkType (method.DeclaringType);
-                       MarkCustomAttributes (method);
-                       MarkSecurityDeclarations (method);
-
-                       MarkGenericParameterProvider (method);
-
-                       if (IsPropertyMethod (method))
-                               MarkProperty (GetProperty (method));
-                       else if (IsEventMethod (method))
-                               MarkEvent (GetEvent (method));
-
-                       if (method.HasParameters) {
-                               foreach (ParameterDefinition pd in method.Parameters) {
-                                       MarkType (pd.ParameterType);
-                                       MarkCustomAttributes (pd);
-                                       MarkMarshalSpec (pd);
-                               }
-                       }
-
-                       if (method.HasOverrides) {
-                               foreach (MethodReference ov in method.Overrides)
-                                       MarkMethod (ov);
-                       }
-
-                       MarkMethodSpecialCustomAttributes (method);
-
-                       if (method.IsVirtual)
-                               _virtual_methods.Add (method);
-
-                       MarkBaseMethods (method);
-
-                       MarkType (method.ReturnType);
-                       MarkCustomAttributes (method.MethodReturnType);
-                       MarkMarshalSpec (method.MethodReturnType);
-
-                       if (ShouldParseMethodBody (method))
-                               MarkMethodBody (method.Body);
-
-                       DoAdditionalMethodProcessing (method);
-
-                       Annotations.Mark (method);
-
-                       ApplyPreserveMethods (method);
-                       Annotations.Pop ();
-               }
-
-               // Allow subclassers to mark additional things when marking a method
-               protected virtual void DoAdditionalMethodProcessing (MethodDefinition method)
-               {
-               }
-
-               void MarkBaseMethods (MethodDefinition method)
-               {
-                       IList base_methods = Annotations.GetBaseMethods (method);
-                       if (base_methods == null)
-                               return;
-
-                       foreach (MethodDefinition base_method in base_methods) {
-                               if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface)
-                                       continue;
-
-                               MarkMethod (base_method);
-                               MarkBaseMethods (base_method);
-                       }
-               }
-
-               bool ShouldParseMethodBody (MethodDefinition method)
-               {
-                       if (!method.HasBody)
-                               return false;
-
-                       AssemblyDefinition assembly = ResolveAssembly (method.DeclaringType.Scope);
-                       return (Annotations.GetAction (method) == MethodAction.ForceParse ||
-                               (Annotations.GetAction (assembly) == AssemblyAction.Link && Annotations.GetAction (method) == MethodAction.Parse));
-               }
-
-               static internal bool IsPropertyMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
-               }
-
-               static bool IsEventMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.AddOn) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Fire) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.RemoveOn) != 0;
-               }
-
-               static internal PropertyDefinition GetProperty (MethodDefinition md)
-               {
-                       TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
-                       foreach (PropertyDefinition prop in declaringType.Properties)
-                               if (prop.GetMethod == md || prop.SetMethod == md)
-                                       return prop;
-
-                       return null;
-               }
-
-               static EventDefinition GetEvent (MethodDefinition md)
-               {
-                       TypeDefinition declaringType = (TypeDefinition) md.DeclaringType;
-                       foreach (EventDefinition evt in declaringType.Events)
-                               if (evt.AddMethod == md || evt.InvokeMethod == md || evt.RemoveMethod == md)
-                                       return evt;
-
-                       return null;
-               }
-
-               protected void MarkProperty (PropertyDefinition prop)
-               {
-                       MarkCustomAttributes (prop);
-               }
-
-               protected void MarkEvent (EventDefinition evt)
-               {
-                       MarkCustomAttributes (evt);
-                       MarkMethodIfNotNull (evt.AddMethod);
-                       MarkMethodIfNotNull (evt.InvokeMethod);
-                       MarkMethodIfNotNull (evt.RemoveMethod);
-               }
-
-               void MarkMethodIfNotNull (MethodReference method)
-               {
-                       if (method == null)
-                               return;
-
-                       MarkMethod (method);
-               }
-
-               protected virtual void MarkMethodBody (MethodBody body)
-               {
-                       foreach (VariableDefinition var in body.Variables)
-                               MarkType (var.VariableType);
-
-                       foreach (ExceptionHandler eh in body.ExceptionHandlers)
-                               if (eh.HandlerType == ExceptionHandlerType.Catch)
-                                       MarkType (eh.CatchType);
-
-                       foreach (Instruction instruction in body.Instructions)
-                               MarkInstruction (instruction);
-               }
-
-               protected virtual void MarkInstruction (Instruction instruction)
-               {
-                       switch (instruction.OpCode.OperandType) {
-                       case OperandType.InlineField:
-                               MarkField ((FieldReference) instruction.Operand);
-                               break;
-                       case OperandType.InlineMethod:
-                               MarkMethod ((MethodReference) instruction.Operand);
-                               break;
-                       case OperandType.InlineTok:
-                               object token = instruction.Operand;
-                               if (token is TypeReference)
-                                       MarkType ((TypeReference) token);
-                               else if (token is MethodReference)
-                                       MarkMethod ((MethodReference) token);
-                               else
-                                       MarkField ((FieldReference) token);
-                               break;
-                       case OperandType.InlineType:
-                               MarkType ((TypeReference) instruction.Operand);
-                               break;
-                       default:
-                               break;
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs b/mcs/tools/linker/Mono.Linker.Steps/OutputStep.cs
deleted file mode 100644 (file)
index 0ae94de..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// OutputStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker.Steps {
-
-       public class OutputStep : BaseStep {
-
-               protected override void Process ()
-               {
-                       CheckOutputDirectory ();
-                       Annotations.SaveDependencies ();
-               }
-
-               void CheckOutputDirectory ()
-               {
-                       if (Directory.Exists (Context.OutputDirectory))
-                               return;
-
-                       Directory.CreateDirectory (Context.OutputDirectory);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       OutputAssembly (assembly);
-               }
-
-               void OutputAssembly (AssemblyDefinition assembly)
-               {
-                       string directory = Context.OutputDirectory;
-
-                       CopyConfigFileIfNeeded (assembly, directory);
-
-                       switch (Annotations.GetAction (assembly)) {
-                       case AssemblyAction.Save:
-                       case AssemblyAction.Link:
-                               Context.Annotations.AddDependency (assembly);
-                               assembly.Write (GetAssemblyFileName (assembly, directory), SaveSymbols (assembly));
-                               break;
-                       case AssemblyAction.Copy:
-                               Context.Annotations.AddDependency (assembly);
-                               CloseSymbols (assembly);
-                               CopyAssembly (GetOriginalAssemblyFileInfo (assembly), directory, Context.LinkSymbols);
-                               break;
-                       case AssemblyAction.Delete:
-                               CloseSymbols (assembly);
-                               var target = GetAssemblyFileName (assembly, directory);
-                               if (File.Exists (target)) {
-                                       File.Delete (target);
-                                       File.Delete (target + ".mdb");
-                                       File.Delete (GetConfigFile (target));
-                               }
-                               break;
-                       default:
-                               CloseSymbols (assembly);
-                               break;
-                       }
-               }
-
-               void CloseSymbols (AssemblyDefinition assembly)
-               {
-                       Annotations.CloseSymbolReader (assembly);
-               }
-
-               WriterParameters SaveSymbols (AssemblyDefinition assembly)
-               {
-                       var parameters = new WriterParameters ();
-                       if (!Context.LinkSymbols)
-                               return parameters;
-
-                       if (!assembly.MainModule.HasSymbols)
-                               return parameters;
-
-                       if (Context.SymbolWriterProvider != null)
-                               parameters.SymbolWriterProvider = Context.SymbolWriterProvider;
-                       else
-                               parameters.WriteSymbols = true;
-                       return parameters;
-               }
-
-               static void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory)
-               {
-                       string config = GetConfigFile (GetOriginalAssemblyFileInfo (assembly).FullName);
-                       if (!File.Exists (config))
-                               return;
-
-                       string target = Path.GetFullPath (GetConfigFile (GetAssemblyFileName (assembly, directory)));
-
-                       if (config == target)
-                               return;
-
-                       File.Copy (config, GetConfigFile (GetAssemblyFileName (assembly, directory)), true);
-               }
-
-               static string GetConfigFile (string assembly)
-               {
-                       return assembly + ".config";
-               }
-
-               static FileInfo GetOriginalAssemblyFileInfo (AssemblyDefinition assembly)
-               {
-                       return new FileInfo (assembly.MainModule.FileName);
-               }
-
-               static void CopyAssembly (FileInfo fi, string directory, bool symbols)
-               {
-                       string target = Path.GetFullPath (Path.Combine (directory, fi.Name));
-                       string source = fi.FullName;
-                       if (source == target)
-                               return;
-
-                       File.Copy (source, target, true);
-
-                       if (!symbols)
-                               return;
-
-                       source += ".mdb";
-                       if (!File.Exists (source))
-                               return;
-                       File.Copy (source, target + ".mdb", true);
-               }
-
-               static string GetAssemblyFileName (AssemblyDefinition assembly, string directory)
-               {
-                       string file = assembly.Name.Name + (assembly.MainModule.Kind == ModuleKind.Dll ? ".dll" : ".exe");
-                       return Path.Combine (directory, file);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs b/mcs/tools/linker/Mono.Linker.Steps/RegenerateGuidStep.cs
deleted file mode 100644 (file)
index 6b2558e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// CleanStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2008 Novell, Inc. (http://www.novell.com)
-//
-// 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 Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class RegenerateGuidStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) == AssemblyAction.Link)
-                               RegenerateGuid (assembly);
-               }
-
-               static void RegenerateGuid (AssemblyDefinition asm)
-               {
-                       asm.MainModule.Mvid = Guid.NewGuid ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
deleted file mode 100644 (file)
index 6219bc9..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// ResolveFromAssemblyStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Collections;
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class ResolveFromAssemblyStep : ResolveStep {
-
-               AssemblyDefinition _assembly;
-               string _file;
-
-               public ResolveFromAssemblyStep (string assembly)
-               {
-                       _file = assembly;
-               }
-
-               public ResolveFromAssemblyStep (AssemblyDefinition assembly)
-               {
-                       _assembly = assembly;
-               }
-
-               protected override void Process ()
-               {
-                       if (_assembly != null)
-                               Context.Resolver.CacheAssembly (_assembly);
-
-                       AssemblyDefinition assembly = _assembly ?? Context.Resolve (_file);
-
-                       switch (assembly.MainModule.Kind) {
-                       case ModuleKind.Dll:
-                               ProcessLibrary (Context, assembly);
-                               break;
-                       default:
-                               ProcessExecutable (assembly);
-                               break;
-                       }
-               }
-
-               static void SetAction (LinkContext context, AssemblyDefinition assembly, AssemblyAction action)
-               {
-                       TryReadSymbols (context, assembly);
-
-                       context.Annotations.SetAction (assembly, action);
-               }
-
-               static void TryReadSymbols (LinkContext context, AssemblyDefinition assembly)
-               {
-                       context.SafeReadSymbols (assembly);
-               }
-
-               public static void ProcessLibrary (LinkContext context, AssemblyDefinition assembly)
-               {
-                       SetAction (context, assembly, AssemblyAction.Copy);
-
-                       context.Annotations.Push (assembly);
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               MarkType (context, type);
-
-                       context.Annotations.Pop ();
-               }
-
-               static void MarkType (LinkContext context, TypeDefinition type)
-               {
-                       context.Annotations.Mark (type);
-
-                       context.Annotations.Push (type);
-
-                       if (type.HasFields)
-                               MarkFields (context, type.Fields);
-                       if (type.HasMethods)
-                               MarkMethods (context, type.Methods);
-                       if (type.HasNestedTypes)
-                               foreach (var nested in type.NestedTypes)
-                                       MarkType (context, nested);
-
-                       context.Annotations.Pop ();
-               }
-
-               void ProcessExecutable (AssemblyDefinition assembly)
-               {
-                       SetAction (Context, assembly, AssemblyAction.Link);
-
-                       Annotations.Push (assembly);
-
-                       Annotations.Mark (assembly.EntryPoint.DeclaringType);
-                       MarkMethod (Context, assembly.EntryPoint, MethodAction.Parse);
-
-                       Annotations.Pop ();
-               }
-
-               static void MarkFields (LinkContext context, ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               context.Annotations.Mark (field);
-               }
-
-               static void MarkMethods (LinkContext context, ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               MarkMethod (context, method, MethodAction.ForceParse);
-               }
-
-               static void MarkMethod (LinkContext context, MethodDefinition method, MethodAction action)
-               {
-                       context.Annotations.Mark (method);
-                       context.Annotations.SetAction (method, action);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs
deleted file mode 100644 (file)
index c4ce86d..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// ResolveFromXApiStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Xml.XPath;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class ResolveFromXApiStep : ResolveStep, IXApiVisitor {
-
-               static readonly string _name = "name";
-               static readonly string _ns = string.Empty;
-
-               XPathDocument _document;
-
-               public ResolveFromXApiStep (XPathDocument document)
-               {
-                       _document = document;
-               }
-
-               protected override void Process ()
-               {
-                       XApiReader reader = new XApiReader (_document, this);
-                       reader.Process (Context);
-               }
-
-               public void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly)
-               {
-               }
-
-               public void OnAttribute (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-
-                       TypeDefinition type = Context.GetType (name);
-                       if (type != null)
-                               MarkType (type);
-               }
-
-               public void OnClass (XPathNavigator nav, TypeDefinition type)
-               {
-                       MarkType (type);
-               }
-
-               public void OnInterface (XPathNavigator nav, TypeDefinition type)
-               {
-                       MarkType (type);
-               }
-
-               public void OnField (XPathNavigator nav, FieldDefinition field)
-               {
-                       MarkField (field);
-               }
-
-               public void OnMethod (XPathNavigator nav, MethodDefinition method)
-               {
-                       MarkMethod (method);
-               }
-
-               public void OnConstructor (XPathNavigator nav, MethodDefinition method)
-               {
-                       MarkMethod (method);
-               }
-
-               public void OnProperty (XPathNavigator nav, PropertyDefinition property)
-               {
-               }
-
-               public void OnEvent (XPathNavigator nav, EventDefinition evt)
-               {
-                       if (evt.AddMethod != null)
-                               MarkMethod (evt.AddMethod);
-                       if (evt.InvokeMethod != null)
-                               MarkMethod (evt.InvokeMethod);
-                       if (evt.RemoveMethod != null)
-                               MarkMethod (evt.RemoveMethod);
-               }
-
-               static string GetName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _name);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-
-               void MarkType (TypeDefinition type)
-               {
-                       InternalMark (type);
-               }
-
-               void MarkField (FieldDefinition field)
-               {
-                       InternalMark (field);
-               }
-
-               void InternalMark (IMetadataTokenProvider provider)
-               {
-                       Annotations.Mark (provider);
-                       Annotations.SetPublic (provider);
-               }
-
-               void MarkMethod (MethodDefinition method)
-               {
-                       InternalMark (method);
-                       Annotations.SetAction (method, MethodAction.Parse);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
deleted file mode 100644 (file)
index aa4f6af..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-//
-// ResolveFromXmlStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-// Copyright 2013 Xamarin Inc.
-//
-// 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 SR = System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class XmlResolutionException : Exception {
-               public XmlResolutionException (string message, Exception innerException)
-                       : base (message, innerException)
-               {
-               }
-       }
-
-       public class ResolveFromXmlStep : ResolveStep {
-
-               static readonly string _signature = "signature";
-               static readonly string _fullname = "fullname";
-               static readonly string _required = "required";
-               static readonly string _preserve = "preserve";
-               static readonly string _ns = string.Empty;
-
-               XPathDocument _document;
-               string _xmlDocumentLocation;
-
-               public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "<unspecified>")
-               {
-                       _document = document;
-                       _xmlDocumentLocation = xmlDocumentLocation;
-               }
-
-               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")
-                               return;
-
-                       try {
-                               ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
-                       } catch (Exception ex) {
-                               throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex);
-                       }
-               }
-
-               void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               AssemblyDefinition assembly = GetAssembly (context, GetFullName (iterator.Current));
-                               ProcessTypes (assembly, iterator.Current.SelectChildren ("type", _ns));
-                               ProcessNamespaces (assembly, iterator.Current.SelectChildren ("namespace", _ns));
-                       }
-               }
-
-               void ProcessNamespaces (AssemblyDefinition assembly, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               string fullname = GetFullName (iterator.Current);
-                               foreach (TypeDefinition type in assembly.MainModule.Types) {
-                                       if (type.Namespace != fullname)
-                                               continue;
-
-                                       MarkAndPreserveAll (type);
-                               }
-                       }
-               }
-
-               void MarkAndPreserveAll (TypeDefinition type)
-               {
-                       Annotations.Mark (type);
-                       Annotations.SetPreserve (type, TypePreserve.All);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (TypeDefinition nested in type.NestedTypes)
-                               MarkAndPreserveAll (nested);
-               }
-
-               void ProcessTypes (AssemblyDefinition assembly, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               XPathNavigator nav = iterator.Current;
-                               string fullname = GetFullName (nav);
-
-                               if (IsTypePattern (fullname)) {
-                                       ProcessTypePattern (fullname, assembly, nav);
-                                       continue;
-                               }
-
-                               TypeDefinition type = assembly.MainModule.GetType (fullname);
-                               if (type == null)
-                                       continue;
-
-                               ProcessType (type, nav);
-                       }
-               }
-
-               static bool IsTypePattern (string fullname)
-               {
-                       return fullname.IndexOf ("*") != -1;
-               }
-
-               static Regex CreateRegexFromPattern (string pattern)
-               {
-                       return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
-               }
-
-               void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
-               {
-                       if (regex.Match (type.FullName).Success)
-                               ProcessType (type, nav);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (var nt in type.NestedTypes)
-                               MatchType (nt, regex, nav);
-               }
-
-               void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
-               {
-                       Regex regex = CreateRegexFromPattern (fullname);
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               MatchType (type, regex, nav);
-                       }
-               }
-
-               void ProcessType (TypeDefinition type, XPathNavigator nav)
-               {
-                       TypePreserve preserve = GetTypePreserve (nav);
-
-                       if (!IsRequired (nav)) {
-                               Annotations.SetPreserve (type, preserve);
-                               return;
-                       }
-
-                       Annotations.Mark (type);
-
-                       if (type.IsNested) {
-                               var parent = type;
-                               while (parent.IsNested) {
-                                       parent = parent.DeclaringType;
-                                       Annotations.Mark (parent);
-                               }
-                       }
-
-                       switch (preserve) {
-                       case TypePreserve.Nothing:
-                               if (!nav.HasChildren)
-                                       Annotations.SetPreserve (type, TypePreserve.All);
-                               break;
-                       default:
-                               Annotations.SetPreserve (type, preserve);
-                               break;
-                       }
-
-                       if (nav.HasChildren) {
-                               MarkSelectedFields (nav, type);
-                               MarkSelectedMethods (nav, type);
-                       }
-               }
-
-               void MarkSelectedFields (XPathNavigator nav, TypeDefinition type)
-               {
-                       XPathNodeIterator fields = nav.SelectChildren ("field", _ns);
-                       if (fields.Count == 0)
-                               return;
-
-                       ProcessFields (type, fields);
-               }
-
-               void MarkSelectedMethods (XPathNavigator nav, TypeDefinition type)
-               {
-                       XPathNodeIterator methods = nav.SelectChildren ("method", _ns);
-                       if (methods.Count == 0)
-                               return;
-
-                       ProcessMethods (type, methods);
-               }
-
-               static TypePreserve GetTypePreserve (XPathNavigator nav)
-               {
-                       string attribute = GetAttribute (nav, _preserve);
-                       if (attribute == null || attribute.Length == 0)
-                               return TypePreserve.Nothing;
-
-                       try {
-                               return (TypePreserve) Enum.Parse (typeof (TypePreserve), attribute, true);
-                       } catch {
-                               return TypePreserve.Nothing;
-                       }
-               }
-
-               void ProcessFields (TypeDefinition type, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext ()) {
-                               string value = GetSignature (iterator.Current);
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessFieldSignature (type, value);
-
-                               value = GetAttribute (iterator.Current, "name");
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessFieldName (type, value);
-                       }
-               }
-
-               void ProcessFieldSignature (TypeDefinition type, string signature)
-               {
-                       FieldDefinition field = GetField (type, signature);
-                       MarkField (type, field, signature);
-               }
-
-               void MarkField (TypeDefinition type, FieldDefinition field, string signature)
-               {
-                       if (field != null)
-                               Annotations.Mark (field);
-                       else
-                               AddUnresolveMarker (string.Format ("T: {0}; F: {1}", type, signature));
-               }
-
-               void ProcessFieldName (TypeDefinition type, string name)
-               {
-                       if (!type.HasFields)
-                               return;
-
-                       foreach (FieldDefinition field in type.Fields)
-                               if (field.Name == name)
-                                       MarkField (type, field, name);
-               }
-
-               static FieldDefinition GetField (TypeDefinition type, string signature)
-               {
-                       if (!type.HasFields)
-                               return null;
-
-                       foreach (FieldDefinition field in type.Fields)
-                               if (signature == GetFieldSignature (field))
-                                       return field;
-
-                       return null;
-               }
-
-               static string GetFieldSignature (FieldDefinition field)
-               {
-                       return field.FieldType.FullName + " " + field.Name;
-               }
-
-               void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator)
-               {
-                       while (iterator.MoveNext()) {
-                               string value = GetSignature (iterator.Current);
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessMethodSignature (type, value);
-
-                               value = GetAttribute (iterator.Current, "name");
-                               if (!String.IsNullOrEmpty (value))
-                                       ProcessMethodName (type, value);
-                       }
-               }
-
-               void ProcessMethodSignature (TypeDefinition type, string signature)
-               {
-                       MethodDefinition meth = GetMethod (type, signature);
-                       MarkMethod (type, meth, signature);
-               }
-
-               void MarkMethod (TypeDefinition type, MethodDefinition method, string signature)
-               {
-                       if (method != null) {
-                               Annotations.Mark (method);
-                               Annotations.SetAction (method, MethodAction.Parse);
-                       } else
-                               AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature));
-               }
-
-               void ProcessMethodName (TypeDefinition type, string name)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods)
-                               if (name == method.Name)
-                                       MarkMethod (type, method, name);
-               }
-
-               static MethodDefinition GetMethod (TypeDefinition type, string signature)
-               {
-                       if (type.HasMethods)
-                               foreach (MethodDefinition meth in type.Methods)
-                                       if (signature == GetMethodSignature (meth))
-                                               return meth;
-
-                       return null;
-               }
-
-               static string GetMethodSignature (MethodDefinition meth)
-               {
-                       StringBuilder sb = new StringBuilder ();
-                       sb.Append (meth.ReturnType.FullName);
-                       sb.Append (" ");
-                       sb.Append (meth.Name);
-                       sb.Append ("(");
-                       if (meth.HasParameters) {
-                               for (int i = 0; i < meth.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               sb.Append (",");
-
-                                       sb.Append (meth.Parameters [i].ParameterType.FullName);
-                               }
-                       }
-                       sb.Append (")");
-                       return sb.ToString ();
-               }
-
-               static AssemblyDefinition GetAssembly (LinkContext context, string assemblyName)
-               {
-                       AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
-                       AssemblyDefinition assembly;
-
-                       assembly = context.Resolve (reference);
-
-                       ProcessReferences (assembly, context);
-                       return assembly;
-               }
-
-               static void ProcessReferences (AssemblyDefinition assembly, LinkContext context)
-               {
-                       foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
-                               context.Resolve (name);
-               }
-
-               static bool IsRequired (XPathNavigator nav)
-               {
-                       string attribute = GetAttribute (nav, _required);
-                       if (attribute == null || attribute.Length == 0)
-                               return true;
-
-                       return TryParseBool (attribute);
-               }
-
-               static bool TryParseBool (string s)
-               {
-                       try {
-                               return bool.Parse (s);
-                       } catch {
-                               return false;
-                       }
-               }
-
-               static string GetSignature (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _signature);
-               }
-
-               static string GetFullName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _fullname);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs b/mcs/tools/linker/Mono.Linker.Steps/ResolveStep.cs
deleted file mode 100644 (file)
index b17bf5c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// ResolveStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Steps {
-
-       using System.Collections;
-
-       public abstract class ResolveStep : BaseStep {
-
-               ArrayList _unResolved;
-
-               internal ResolveStep ()
-               {
-                       _unResolved = new ArrayList ();
-               }
-
-               public bool AllMarkerResolved
-               {
-                       get { return _unResolved.Count == 0; }
-               }
-
-               public string [] GetUnresolvedMarkers ()
-               {
-                       return _unResolved.ToArray (typeof (string)) as string [];
-               }
-
-               protected void AddUnresolveMarker (string signature)
-               {
-                       _unResolved.Add (signature);
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs b/mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
deleted file mode 100644 (file)
index 73c89cc..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-//
-// SweepStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-// (C) 2007 Novell, Inc.
-//
-// 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.Collections;
-using System.Collections.Generic;
-using Mono.Cecil;
-using Mono.Collections.Generic;
-
-namespace Mono.Linker.Steps {
-
-       public class SweepStep : BaseStep {
-
-               AssemblyDefinition [] assemblies;
-               HashSet<AssemblyDefinition> resolvedTypeReferences;
-
-               protected override void Process ()
-               {
-                       assemblies = Context.GetAssemblies ();
-                       foreach (var assembly in assemblies) {
-                               SweepAssembly (assembly);
-                               if (Annotations.GetAction (assembly) == AssemblyAction.Copy) {
-                                       // Copy assemblies can still contain Type references with
-                                       // type forwarders from Delete assemblies
-                                       // thus try to resolve all the type references and see
-                                       // if some changed the scope. if yes change the action to Save
-                                       if (ResolveAllTypeReferences (assembly))
-                                               Annotations.SetAction (assembly, AssemblyAction.Save);
-                               }
-                       }
-               }
-
-               void SweepAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       if (!IsMarkedAssembly (assembly)) {
-                               RemoveAssembly (assembly);
-                               return;
-                       }
-
-                       var types = new List<TypeDefinition> ();
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               if (Annotations.IsMarked (type)) {
-                                       SweepType (type);
-                                       types.Add (type);
-                                       continue;
-                               }
-
-                               if (type.Name == "<Module>")
-                                       types.Add (type);
-                       }
-
-                       assembly.MainModule.Types.Clear ();
-                       foreach (TypeDefinition type in types)
-                               assembly.MainModule.Types.Add (type);
-               }
-
-               bool IsMarkedAssembly (AssemblyDefinition assembly)
-               {
-                       return Annotations.IsMarked (assembly.MainModule);
-               }
-
-               void RemoveAssembly (AssemblyDefinition assembly)
-               {
-                       Annotations.SetAction (assembly, AssemblyAction.Delete);
-
-                       SweepReferences (assembly);
-               }
-
-               void SweepReferences (AssemblyDefinition target)
-               {
-                       foreach (var assembly in assemblies)
-                               SweepReferences (assembly, target);
-               }
-
-               void SweepReferences (AssemblyDefinition assembly, AssemblyDefinition target)
-               {
-                       if (assembly == target)
-                               return;
-
-                       var references = assembly.MainModule.AssemblyReferences;
-                       for (int i = 0; i < references.Count; i++) {
-                               var reference = references [i];
-                               var r = Context.Resolver.Resolve (reference);
-                               if (!AreSameReference (r.Name, target.Name))
-                                       continue;
-
-                               references.RemoveAt (i);
-                               // Removing the reference does not mean it will be saved back to disk!
-                               // That depends on the AssemblyAction set for the `assembly`
-                               switch (Annotations.GetAction (assembly)) {
-                               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);
-                                       ResolveAllTypeReferences (assembly);
-                                       break;
-
-                               case AssemblyAction.Save:
-                               case AssemblyAction.Link:
-                                       ResolveAllTypeReferences (assembly);
-                                       break;
-                               }
-                               return;
-                       }
-               }
-
-               bool ResolveAllTypeReferences (AssemblyDefinition assembly)
-               {
-                       if (resolvedTypeReferences == null)
-                               resolvedTypeReferences = new HashSet<AssemblyDefinition> ();
-                       if (resolvedTypeReferences.Contains (assembly))
-                               return false;
-                       resolvedTypeReferences.Add (assembly);
-
-                       var hash = new Dictionary<TypeReference,IMetadataScope> ();
-                       bool changes = false;
-
-                       foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
-                               if (hash.ContainsKey (tr))
-                                       continue;
-                               var td = tr.Resolve ();
-                               IMetadataScope scope = tr.Scope;
-                               // at this stage reference might include things that can't be resolved
-                               // and if it is (resolved) it needs to be kept only if marked (#16213)
-                               if ((td != null) && Annotations.IsMarked (td)) {
-                                       scope = assembly.MainModule.ImportReference (td).Scope;
-                                       if (tr.Scope != scope)
-                                               changes = true;
-                                       hash.Add (tr, scope);
-                               }
-                       }
-                       if (assembly.MainModule.HasExportedTypes) {
-                               foreach (var et in assembly.MainModule.ExportedTypes) {
-                                       var td = et.Resolve ();
-                                       IMetadataScope scope = et.Scope;
-                                       if ((td != null) && Annotations.IsMarked (td)) {
-                                               scope = assembly.MainModule.ImportReference (td).Scope;
-                                               hash.Add (td, scope);
-                                       }
-                               }
-                       }
-
-                       // Resolve everything first before updating scopes.
-                       // If we set the scope to null, then calling Resolve() on any of its
-                       // nested types would crash.
-
-                       foreach (var e in hash) {
-                               e.Key.Scope = e.Value;
-                       }
-
-                       return changes;
-               }
-
-               void SweepType (TypeDefinition type)
-               {
-                       if (type.HasFields)
-                               SweepCollection (type.Fields);
-
-                       if (type.HasMethods)
-                               SweepCollection (type.Methods);
-
-                       if (type.HasNestedTypes)
-                               SweepNestedTypes (type);
-               }
-
-               void SweepNestedTypes (TypeDefinition type)
-               {
-                       for (int i = 0; i < type.NestedTypes.Count; i++) {
-                               var nested = type.NestedTypes [i];
-                               if (Annotations.IsMarked (nested)) {
-                                       SweepType (nested);
-                               } else {
-                                       type.NestedTypes.RemoveAt (i--);
-                               }
-                       }
-               }
-
-               void SweepCollection (IList list)
-               {
-                       for (int i = 0; i < list.Count; i++)
-                               if (!Annotations.IsMarked ((IMetadataTokenProvider) list [i]))
-                                       list.RemoveAt (i--);
-               }
-
-               static bool AreSameReference (AssemblyNameReference a, AssemblyNameReference b)
-               {
-                       if (a == b)
-                               return true;
-
-                       if (a.Name != b.Name)
-                               return false;
-
-                       if (a.Version > b.Version)
-                               return false;
-
-                       return true;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs b/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs
deleted file mode 100644 (file)
index 3fe12ae..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-//
-// TypeMapStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Linker.Steps {
-
-       public class TypeMapStep : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               MapType (type);
-               }
-
-               protected virtual void MapType (TypeDefinition type)
-               {
-                       MapVirtualMethods (type);
-                       MapInterfaceMethodsInTypeHierarchy (type);
-
-                       if (!type.HasNestedTypes)
-                               return;
-
-                       foreach (var nested in type.NestedTypes)
-                               MapType (nested);
-               }
-
-               void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type)
-               {
-                       if (!type.HasInterfaces)
-                               return;
-
-                       foreach (var @interface in type.Interfaces) {
-                               var iface = @interface.InterfaceType.Resolve ();
-                               if (iface == null || !iface.HasMethods)
-                                       continue;
-
-                               foreach (MethodDefinition method in iface.Methods) {
-                                       if (TryMatchMethod (type, method) != null)
-                                               continue;
-
-                                       var @base = GetBaseMethodInTypeHierarchy (type, method);
-                                       if (@base == null)
-                                               continue;
-
-                                       Annotations.AddPreservedMethod (type, @base);
-                               }
-                       }
-               }
-
-               void MapVirtualMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               MapVirtualMethod (method);
-
-                               if (method.HasOverrides)
-                                       MapOverrides (method);
-                       }
-               }
-
-               void MapVirtualMethod (MethodDefinition method)
-               {
-                       MapVirtualBaseMethod (method);
-                       MapVirtualInterfaceMethod (method);
-               }
-
-               void MapVirtualBaseMethod (MethodDefinition method)
-               {
-                       MethodDefinition @base = GetBaseMethodInTypeHierarchy (method);
-                       if (@base == null)
-                               return;
-
-                       AnnotateMethods (@base, method);
-               }
-
-               void MapVirtualInterfaceMethod (MethodDefinition method)
-               {
-                       foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (method))
-                               AnnotateMethods (@base, method);
-               }
-
-               void MapOverrides (MethodDefinition method)
-               {
-                       foreach (MethodReference override_ref in method.Overrides) {
-                               MethodDefinition @override = override_ref.Resolve ();
-                               if (@override == null)
-                                       continue;
-
-                               AnnotateMethods (@override, method);
-                       }
-               }
-
-               void AnnotateMethods (MethodDefinition @base, MethodDefinition @override)
-               {
-                       Annotations.AddBaseMethod (@override, @base);
-                       Annotations.AddOverride (@base, @override);
-               }
-
-               static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method)
-               {
-                       return GetBaseMethodInTypeHierarchy (method.DeclaringType, method);
-               }
-
-               static MethodDefinition GetBaseMethodInTypeHierarchy (TypeDefinition type, MethodDefinition method)
-               {
-                       TypeDefinition @base = GetBaseType (type);
-                       while (@base != null) {
-                               MethodDefinition base_method = TryMatchMethod (@base, method);
-                               if (base_method != null)
-                                       return base_method;
-
-                               @base = GetBaseType (@base);
-                       }
-
-                       return null;
-               }
-
-               static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (MethodDefinition method)
-               {
-                       return GetBaseMethodsInInterfaceHierarchy (method.DeclaringType, method);
-               }
-
-               static IEnumerable<MethodDefinition> GetBaseMethodsInInterfaceHierarchy (TypeDefinition type, MethodDefinition method)
-               {
-                       if (!type.HasInterfaces)
-                               yield break;
-
-                       foreach (var interface_ref in type.Interfaces) {
-                               TypeDefinition @interface = interface_ref.InterfaceType.Resolve ();
-                               if (@interface == null)
-                                       continue;
-
-                               MethodDefinition base_method = TryMatchMethod (@interface, method);
-                               if (base_method != null)
-                                       yield return base_method;
-
-                               foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (@interface, method))
-                                       yield return @base;
-                       }
-               }
-
-               static MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       if (!type.HasMethods)
-                               return null;
-
-                       Dictionary<string,string> gp = null;
-                       foreach (MethodDefinition candidate in type.Methods) {
-                               if (MethodMatch (candidate, method, ref gp))
-                                       return candidate;
-                               if (gp != null)
-                                       gp.Clear ();
-                       }
-
-                       return null;
-               }
-
-               static bool MethodMatch (MethodDefinition candidate, MethodDefinition method, ref Dictionary<string,string> genericParameters)
-               {
-                       if (!candidate.IsVirtual)
-                               return false;
-
-                       if (candidate.HasParameters != method.HasParameters)
-                               return false;
-
-                       if (candidate.Name != method.Name)
-                               return false;
-
-                       if (candidate.HasGenericParameters != method.HasGenericParameters)
-                               return false;
-
-                       // we need to track what the generic parameter represent - as we cannot allow it to
-                       // differ between the return type or any parameter
-                       if (!TypeMatch (candidate.ReturnType, method.ReturnType, ref genericParameters))
-                               return false;
-
-                       if (!candidate.HasParameters)
-                               return true;
-
-                       var cp = candidate.Parameters;
-                       var mp = method.Parameters;
-                       if (cp.Count != mp.Count)
-                               return false;
-
-                       for (int i = 0; i < cp.Count; i++) {
-                               if (!TypeMatch (cp [i].ParameterType, mp [i].ParameterType, ref genericParameters))
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static bool TypeMatch (IModifierType a, IModifierType b, ref Dictionary<string,string> gp)
-               {
-                       if (!TypeMatch (a.ModifierType, b.ModifierType, ref gp))
-                               return false;
-
-                       return TypeMatch (a.ElementType, b.ElementType, ref gp);
-               }
-
-               static bool TypeMatch (TypeSpecification a, TypeSpecification b, ref Dictionary<string,string> gp)
-               {
-                       var gita = a as GenericInstanceType;
-                       if (gita != null)
-                               return TypeMatch (gita, (GenericInstanceType) b, ref gp);
-
-                       var mta = a as IModifierType;
-                       if (mta != null)
-                               return TypeMatch (mta, (IModifierType) b, ref gp);
-
-                       return TypeMatch (a.ElementType, b.ElementType, ref gp);
-               }
-
-               static bool TypeMatch (GenericInstanceType a, GenericInstanceType b, ref Dictionary<string,string> gp)
-               {
-                       if (!TypeMatch (a.ElementType, b.ElementType, ref gp))
-                               return false;
-
-                       if (a.HasGenericArguments != b.HasGenericArguments)
-                               return false;
-
-                       if (!a.HasGenericArguments)
-                               return true;
-
-                       var gaa = a.GenericArguments;
-                       var gab = b.GenericArguments;
-                       if (gaa.Count != gab.Count)
-                               return false;
-
-                       for (int i = 0; i < gaa.Count; i++) {
-                               if (!TypeMatch (gaa [i], gab [i], ref gp))
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static bool TypeMatch (TypeReference a, TypeReference b, ref Dictionary<string,string> gp)
-               {
-                       var gpa = a as GenericParameter;
-                       if (gpa != null) {
-                               if (gp == null)
-                                       gp = new Dictionary<string, string> ();
-                               string match;
-                               if (!gp.TryGetValue (gpa.FullName, out match)) {
-                                       // first use, we assume it will always be used this way
-                                       gp.Add (gpa.FullName, b.ToString ());
-                                       return true;
-                               }
-                               // re-use, it should match the previous usage
-                               return match == b.ToString ();
-                       }
-
-                       if (a is TypeSpecification || b is TypeSpecification) {
-                               if (a.GetType () != b.GetType ())
-                                       return false;
-
-                               return TypeMatch ((TypeSpecification) a, (TypeSpecification) b, ref gp);
-                       }
-
-                       return a.FullName == b.FullName;
-               }
-
-               static TypeDefinition GetBaseType (TypeDefinition type)
-               {
-                       if (type == null || type.BaseType == null)
-                               return null;
-
-                       return type.BaseType.Resolve ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker.csproj b/mcs/tools/linker/Mono.Linker.csproj
deleted file mode 100644 (file)
index 98f0737..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Linker</RootNamespace>
-    <AssemblyName>monolinker</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>True</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <!-- 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">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Linker.Steps\BaseStep.cs" />
-    <Compile Include="Mono.Linker.Steps\BlacklistStep.cs" />
-    <Compile Include="Mono.Linker.Steps\CleanStep.cs" />
-    <Compile Include="Mono.Linker.Steps\RegenerateGuidStep.cs" />
-    <Compile Include="Mono.Linker.Steps\LoadI18nAssemblies.cs" />
-    <Compile Include="Mono.Linker\IXApiVisitor.cs" />
-    <Compile Include="Mono.Linker\I18nAssemblies.cs" />
-    <Compile Include="Mono.Linker.Steps\IStep.cs" />
-    <Compile Include="Mono.Linker.Steps\LoadReferencesStep.cs" />
-    <Compile Include="Mono.Linker.Steps\MarkStep.cs" />
-    <Compile Include="Mono.Linker.Steps\OutputStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromXApiStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromAssemblyStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveFromXmlStep.cs" />
-    <Compile Include="Mono.Linker.Steps\ResolveStep.cs" />
-    <Compile Include="Mono.Linker.Steps\SweepStep.cs" />
-    <Compile Include="Mono.Linker\Annotations.cs" />
-    <Compile Include="Mono.Linker\AssemblyAction.cs" />
-    <Compile Include="Mono.Linker\AssemblyInfo.cs" />
-    <Compile Include="Mono.Linker\AssemblyResolver.cs" />
-    <Compile Include="Mono.Linker\Driver.cs" />
-    <Compile Include="Mono.Linker\LinkContext.cs" />
-    <Compile Include="Mono.Linker\MethodAction.cs" />
-    <Compile Include="Mono.Linker\Pipeline.cs" />
-    <Compile Include="Mono.Linker\TypePreserve.cs" />
-    <Compile Include="Mono.Linker\XApiReader.cs" />
-    <Compile Include="Mono.Linker.Steps\TypeMapStep.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="Descriptors\mscorlib.xml">
-      <LogicalName>mscorlib.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Web.xml">
-      <LogicalName>System.web.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.xml">
-      <LogicalName>System.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\Mono.Posix.xml">
-      <LogicalName>Mono.Posix.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Drawing.xml">
-      <LogicalName>System.Drawing.xml</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Descriptors\System.Core.xml">
-      <LogicalName>System.Core.xml</LogicalName>
-    </EmbeddedResource>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Makefile" />
-    <None Include="README" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
-      <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/linker/Mono.Linker/Annotations.cs b/mcs/tools/linker/Mono.Linker/Annotations.cs
deleted file mode 100644 (file)
index 72c59ba..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-//
-// Annotations.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
-       public class AnnotationStore {
-
-               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> ();
-
-               readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
-
-               Stack<object> dependency_stack;
-               System.Xml.XmlWriter writer;
-               GZipStream zipStream;
-
-               public void PrepareDependenciesDump ()
-               {
-                       PrepareDependenciesDump ("linker-dependencies.xml.gz");
-               }
-
-               public void PrepareDependenciesDump (string filename)
-               {
-                       dependency_stack = new Stack<object> ();
-                       System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
-                       settings.Indent = true;
-                       settings.IndentChars = "\t";
-                       var depsFile = File.OpenWrite (filename);
-                       zipStream = new GZipStream (depsFile, CompressionMode.Compress);
-
-                       writer = System.Xml.XmlWriter.Create (zipStream, settings);
-                       writer.WriteStartDocument ();
-                       writer.WriteStartElement ("dependencies");
-                       writer.WriteStartAttribute ("version");
-                       writer.WriteString ("1.0");
-                       writer.WriteEndAttribute ();
-               }
-
-               public AssemblyAction GetAction (AssemblyDefinition assembly)
-               {
-                       AssemblyAction action;
-                       if (assembly_actions.TryGetValue (assembly, out action))
-                               return action;
-
-                       throw new NotSupportedException ();
-               }
-
-               public MethodAction GetAction (MethodDefinition method)
-               {
-                       MethodAction action;
-                       if (method_actions.TryGetValue (method, out action))
-                               return action;
-
-                       return MethodAction.Nothing;
-               }
-
-               public void SetAction (AssemblyDefinition assembly, AssemblyAction action)
-               {
-                       assembly_actions [assembly] = action;
-               }
-
-               public bool HasAction (AssemblyDefinition assembly)
-               {
-                       return assembly_actions.ContainsKey (assembly);
-               }
-
-               public void SetAction (MethodDefinition method, MethodAction action)
-               {
-                       method_actions [method] = action;
-               }
-
-               public void Mark (IMetadataTokenProvider provider)
-               {
-                       marked.Add (provider);
-                       AddDependency (provider);
-               }
-
-               public bool IsMarked (IMetadataTokenProvider provider)
-               {
-                       return marked.Contains (provider);
-               }
-
-               public void Processed (IMetadataTokenProvider provider)
-               {
-                       processed.Add (provider);
-               }
-
-               public bool IsProcessed (IMetadataTokenProvider provider)
-               {
-                       return processed.Contains (provider);
-               }
-
-               public bool IsPreserved (TypeDefinition type)
-               {
-                       return preserved_types.ContainsKey (type);
-               }
-
-               public void SetPreserve (TypeDefinition type, TypePreserve preserve)
-               {
-                       preserved_types [type] = preserve;
-               }
-
-               public TypePreserve GetPreserve (TypeDefinition type)
-               {
-                       TypePreserve preserve;
-                       if (preserved_types.TryGetValue (type, out preserve))
-                               return preserve;
-
-                       throw new NotSupportedException ();
-               }
-
-               public void SetPublic (IMetadataTokenProvider provider)
-               {
-                       public_api.Add (provider);
-               }
-
-               public bool IsPublic (IMetadataTokenProvider provider)
-               {
-                       return public_api.Contains (provider);
-               }
-
-               public void AddOverride (MethodDefinition @base, MethodDefinition @override)
-               {
-                       var methods = GetOverrides (@base);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               override_methods [@base] = methods;
-                       }
-
-                       methods.Add (@override);
-               }
-
-               public List<MethodDefinition> GetOverrides (MethodDefinition method)
-               {
-                       List<MethodDefinition> overrides;
-                       if (override_methods.TryGetValue (method, out overrides))
-                               return overrides;
-
-                       return null;
-               }
-
-               public void AddBaseMethod (MethodDefinition method, MethodDefinition @base)
-               {
-                       var methods = GetBaseMethods (method);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               base_methods [method] = methods;
-                       }
-
-                       methods.Add (@base);
-               }
-
-               public List<MethodDefinition> GetBaseMethods (MethodDefinition method)
-               {
-                       List<MethodDefinition> bases;
-                       if (base_methods.TryGetValue (method, out bases))
-                               return bases;
-
-                       return null;
-               }
-
-               public List<MethodDefinition> GetPreservedMethods (TypeDefinition type)
-               {
-                       return GetPreservedMethods (type as IMemberDefinition);
-               }
-
-               public void AddPreservedMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       AddPreservedMethod (type as IMemberDefinition, method);
-               }
-
-               public List<MethodDefinition> GetPreservedMethods (MethodDefinition method)
-               {
-                       return GetPreservedMethods (method as IMemberDefinition);
-               }
-
-               public void AddPreservedMethod (MethodDefinition key, MethodDefinition method)
-               {
-                       AddPreservedMethod (key as IMemberDefinition, method);
-               }
-
-               List<MethodDefinition> GetPreservedMethods (IMemberDefinition definition)
-               {
-                       List<MethodDefinition> preserved;
-                       if (preserved_methods.TryGetValue (definition, out preserved))
-                               return preserved;
-
-                       return null;
-               }
-
-               void AddPreservedMethod (IMemberDefinition definition, MethodDefinition method)
-               {
-                       var methods = GetPreservedMethods (definition);
-                       if (methods == null) {
-                               methods = new List<MethodDefinition> ();
-                               preserved_methods [definition] = methods;
-                       }
-
-                       methods.Add (method);
-               }
-
-               public void AddSymbolReader (AssemblyDefinition assembly, ISymbolReader symbolReader)
-               {
-                       symbol_readers [assembly] = symbolReader;
-               }
-
-               public void CloseSymbolReader (AssemblyDefinition assembly)
-               {
-                       ISymbolReader symbolReader;
-                       if (!symbol_readers.TryGetValue (assembly, out symbolReader))
-                               return;
-
-                       symbol_readers.Remove (assembly);
-                       symbolReader.Dispose ();
-               }
-
-               public Dictionary<IMetadataTokenProvider, object> GetCustomAnnotations (object key)
-               {
-                       Dictionary<IMetadataTokenProvider, object> slots;
-                       if (custom_annotations.TryGetValue (key, out slots))
-                               return slots;
-
-                       slots = new Dictionary<IMetadataTokenProvider, object> ();
-                       custom_annotations.Add (key, slots);
-                       return slots;
-               }
-
-               public void AddDependency (object o)
-               {
-                       if (writer == null)
-                               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 ();
-               }
-
-               public void Push (object o)
-               {
-                       if (writer == null)
-                               return;
-
-                       if (dependency_stack.Count > 0)
-                               AddDependency (o);
-                       dependency_stack.Push (o);
-               }
-
-               public void Pop ()
-               {
-                       if (writer == null)
-                               return;
-
-                       dependency_stack.Pop ();
-               }
-
-               string TokenString (object o)
-               {
-                       if (o == null)
-                               return "N:null";
-
-                       if (o is IMetadataTokenProvider)
-                               return (o as IMetadataTokenProvider).MetadataToken.TokenType + ":" + o;
-
-                       return "Other:" + o;
-               }
-
-               public void SaveDependencies ()
-               {
-                       if (writer == null)
-                               return;
-
-                       writer.WriteEndElement ();
-                       writer.WriteEndDocument ();
-                       writer.Flush ();
-                       writer.Close ();
-                       zipStream.Close ();
-
-                       writer.Dispose ();
-                       zipStream.Dispose ();
-                       writer = null;
-                       zipStream = null;
-                       dependency_stack = null;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyAction.cs b/mcs/tools/linker/Mono.Linker/AssemblyAction.cs
deleted file mode 100644 (file)
index 14282b3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// AssemblyAction.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum AssemblyAction {
-               // 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
-               Copy,
-               // Link the assembly
-               Link,
-               // Remove the assembly from the output
-               Delete,
-               // Save the assembly/symbols in memory without linking it. 
-               // E.g. useful to remove unneeded assembly references (as done in SweepStep), 
-               //  resolving [TypeForwardedTo] attributes (like PCL) to their final location
-               Save
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyInfo.cs b/mcs/tools/linker/Mono.Linker/AssemblyInfo.cs
deleted file mode 100644 (file)
index 348e29b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker")]
-[assembly: AssemblyDescription ("Mono CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
-[assembly: AssemblyVersion ("0.2.0.0")]
diff --git a/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs b/mcs/tools/linker/Mono.Linker/AssemblyResolver.cs
deleted file mode 100644 (file)
index cb0646c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// AssemblyResolver.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.IO;
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public class AssemblyResolver : BaseAssemblyResolver {
-
-               IDictionary _assemblies;
-
-               public IDictionary AssemblyCache {
-                       get { return _assemblies; }
-               }
-
-               public AssemblyResolver ()
-                       : this (new Hashtable ())
-               {
-               }
-
-               public AssemblyResolver (IDictionary assembly_cache)
-               {
-                       _assemblies = assembly_cache;
-               }
-
-               public override AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters)
-               {
-                       AssemblyDefinition asm = (AssemblyDefinition) _assemblies [name.Name];
-                       if (asm == null) {
-                               asm = base.Resolve (name, parameters);
-                               _assemblies [name.Name] = asm;
-                       }
-
-                       return asm;
-               }
-
-               public void CacheAssembly (AssemblyDefinition assembly)
-               {
-                       _assemblies [assembly.Name.Name] = assembly;
-                       base.AddSearchDirectory (Path.GetDirectoryName (assembly.MainModule.FileName));
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/Driver.cs b/mcs/tools/linker/Mono.Linker/Driver.cs
deleted file mode 100644 (file)
index 7d1963c..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-//
-// Driver.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.IO;
-using SR = System.Reflection;
-using System.Xml.XPath;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
-       public class Driver {
-
-               static readonly string _linker = "Mono CIL Linker";
-
-               public static int Main (string [] args)
-               {
-                       if (args.Length == 0)
-                               Usage ("No parameters specified");
-
-                       try {
-
-                               Driver driver = new Driver (args);
-                               driver.Run ();
-
-                       } catch (Exception e) {
-                               Console.WriteLine ("Fatal error in {0}", _linker);
-                               Console.WriteLine (e);
-                               return 1;
-                       }
-
-                       return 0;
-               }
-
-               Queue _queue;
-
-               public Driver (string [] args)
-               {
-                       _queue = new Queue (args);
-               }
-
-               bool HaveMoreTokens ()
-               {
-                       return _queue.Count > 0;
-               }
-
-               void Run ()
-               {
-                       Pipeline p = GetStandardPipeline ();
-                       LinkContext context = GetDefaultContext (p);
-                       I18nAssemblies assemblies = I18nAssemblies.All;
-                       ArrayList custom_steps = new ArrayList ();
-
-                       bool resolver = false;
-                       while (HaveMoreTokens ()) {
-                               string token = GetParam ();
-                               if (token.Length < 2)
-                                       Usage ("Option is too short");
-
-                               if (! (token [0] == '-' || token [1] == '/'))
-                                       Usage ("Expecting an option, got instead: " + token);
-
-                               if (token [0] == '-' && token [1] == '-') {
-
-                                       if (token.Length < 3)
-                                               Usage ("Option is too short");
-
-                                       switch (token [2]) {
-                                       case 'v':
-                                               Version ();
-                                               break;
-                                       case 'a':
-                                               About ();
-                                               break;
-                                       default:
-                                               Usage (null);
-                                               break;
-                                       }
-                               }
-
-                               switch (token [1]) {
-                               case 'd': {
-                                       DirectoryInfo info = new DirectoryInfo (GetParam ());
-                                       context.Resolver.AddSearchDirectory (info.FullName);
-                                       break;
-                               }
-                               case 'o':
-                                       context.OutputDirectory = GetParam ();
-                                       break;
-                               case 'c':
-                                       context.CoreAction = ParseAssemblyAction (GetParam ());
-                                       break;
-                               case 'p':
-                                       AssemblyAction action = ParseAssemblyAction (GetParam ());
-                                       context.Actions [GetParam ()] = action;
-                                       break;
-                               case 's':
-                                       custom_steps.Add (GetParam ());
-                                       break;
-                               case 'x':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromXmlStep (new XPathDocument (file)));
-                                       resolver = true;
-                                       break;
-                               case 'a':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromAssemblyStep (file));
-                                       resolver = true;
-                                       break;
-                               case 'i':
-                                       foreach (string file in GetFiles (GetParam ()))
-                                               p.PrependStep (new ResolveFromXApiStep (new XPathDocument (file)));
-                                       resolver = true;
-                                       break;
-                               case 'l':
-                                       assemblies = ParseI18n (GetParam ());
-                                       break;
-                               case 'm':
-                                       context.SetParameter (GetParam (), GetParam ());
-                                       break;
-                               case 'b':
-                                       context.LinkSymbols = bool.Parse (GetParam ());
-                                       break;
-                               case 'g':
-                                       if (!bool.Parse (GetParam ()))
-                                               p.RemoveStep (typeof (RegenerateGuidStep));
-                                       break;
-                               default:
-                                       Usage ("Unknown option: `" + token [1] + "'");
-                                       break;
-                               }
-                       }
-
-                       if (!resolver)
-                               Usage ("No resolver was created (use -x, -a or -i)");
-
-                       foreach (string custom_step in custom_steps)
-                               AddCustomStep (p, custom_step);
-
-                       p.AddStepAfter (typeof (LoadReferencesStep), new LoadI18nAssemblies (assemblies));
-
-                       p.Process (context);
-               }
-
-               static void AddCustomStep (Pipeline pipeline, string arg)
-               {
-                       int pos = arg.IndexOf (":");
-                       if (pos == -1) {
-                               pipeline.AppendStep (ResolveStep (arg));
-                               return;
-                       }
-
-                       string [] parts = arg.Split (':');
-                       if (parts.Length != 2)
-                               Usage ("Step is specified as TYPE:STEP");
-
-                       if (parts [0].IndexOf (",") > -1)
-                               pipeline.AddStepBefore (FindStep (pipeline, parts [1]), ResolveStep (parts [0]));
-                       else if (parts [1].IndexOf (",") > -1)
-                               pipeline.AddStepAfter (FindStep (pipeline, parts [0]), ResolveStep (parts [1]));
-                       else
-                               Usage ("No comma separator in TYPE or STEP");
-               }
-
-               static Type FindStep (Pipeline pipeline, string name)
-               {
-                       foreach (IStep step in pipeline.GetSteps ()) {
-                               Type t = step.GetType ();
-                               if (t.Name == name)
-                                       return t;
-                       }
-
-                       return null;
-               }
-
-               static IStep ResolveStep (string type)
-               {
-                       Type step = Type.GetType (type, false);
-                       if (step == null)
-                               Usage (String.Format ("Step type '{0}' not found.", type));
-                       if (!typeof (IStep).IsAssignableFrom (step))
-                               Usage (String.Format ("Step type '{0}' does not implement IStep interface.", type));
-                       return (IStep) Activator.CreateInstance (step);
-               }
-
-               static string [] GetFiles (string param)
-               {
-                       if (param.Length < 1 || param [0] != '@')
-                               return new string [] {param};
-
-                       string file = param.Substring (1);
-                       return ReadLines (file);
-               }
-
-               static string [] ReadLines (string file)
-               {
-                       ArrayList lines = new ArrayList ();
-                       using (StreamReader reader = new StreamReader (file)) {
-                               string line;
-                               while ((line = reader.ReadLine ()) != null)
-                                       lines.Add (line);
-                       }
-                       return (string []) lines.ToArray (typeof (string));
-               }
-
-               static I18nAssemblies ParseI18n (string str)
-               {
-                       I18nAssemblies assemblies = I18nAssemblies.None;
-                       string [] parts = str.Split (',');
-                       foreach (string part in parts)
-                               assemblies |= (I18nAssemblies) Enum.Parse (typeof (I18nAssemblies), part.Trim (), true);
-
-                       return assemblies;
-               }
-
-               static AssemblyAction ParseAssemblyAction (string s)
-               {
-                       return (AssemblyAction) Enum.Parse (typeof (AssemblyAction), s, true);
-               }
-
-               string GetParam ()
-               {
-                       if (_queue.Count == 0)
-                               Usage ("Expecting a parameter");
-
-                       return (string) _queue.Dequeue ();
-               }
-
-               static LinkContext GetDefaultContext (Pipeline pipeline)
-               {
-                       LinkContext context = new LinkContext (pipeline);
-                       context.CoreAction = AssemblyAction.Skip;
-                       context.OutputDirectory = "output";
-                       return context;
-               }
-
-               static void Usage (string msg)
-               {
-                       Console.WriteLine (_linker);
-                       if (msg != null)
-                               Console.WriteLine ("Error: " + msg);
-                       Console.WriteLine ("monolinker [options] -x|-a|-i file");
-
-                       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 ("   -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 ("   -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 ("   -i          Link from an mono-api-info descriptor");
-                       Console.WriteLine ("");
-
-                       Environment.Exit (1);
-               }
-
-               static void Version ()
-               {
-                       Console.WriteLine ("{0} Version {1}",
-                               _linker,
-                           System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version);
-
-                       Environment.Exit(1);
-               }
-
-               static void About ()
-               {
-                       Console.WriteLine ("For more information, visit the project Web site");
-                       Console.WriteLine ("   http://www.mono-project.com/");
-
-                       Environment.Exit(1);
-               }
-
-               static Pipeline GetStandardPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new RegenerateGuidStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/I18nAssemblies.cs b/mcs/tools/linker/Mono.Linker/I18nAssemblies.cs
deleted file mode 100644 (file)
index a14c58f..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// I18nAssemblies.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-namespace Mono.Linker {
-
-       [Flags]
-       public enum I18nAssemblies {
-
-               None = 0,
-
-               CJK = 1,
-               MidEast = 2,
-               Other = 4,
-               Rare = 8,
-               West = 16,
-
-               All = CJK | MidEast | Other | Rare | West,
-               Base
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/IXApiVisitor.cs b/mcs/tools/linker/Mono.Linker/IXApiVisitor.cs
deleted file mode 100644 (file)
index 204d699..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// XApiVisitor.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public interface IXApiVisitor {
-
-               void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly);
-               void OnAttribute (XPathNavigator nav);
-               void OnClass (XPathNavigator nav, TypeDefinition type);
-               void OnInterface (XPathNavigator nav, TypeDefinition type);
-               void OnField (XPathNavigator nav, FieldDefinition field);
-               void OnMethod (XPathNavigator nav, MethodDefinition method);
-               void OnConstructor (XPathNavigator nav, MethodDefinition method);
-               void OnProperty (XPathNavigator nav, PropertyDefinition property);
-               void OnEvent (XPathNavigator nav, EventDefinition evt);
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/LinkContext.cs b/mcs/tools/linker/Mono.Linker/LinkContext.cs
deleted file mode 100644 (file)
index 7d7908f..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-//
-// LinkContext.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.IO;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Linker {
-
-       public class LinkContext {
-
-               Pipeline _pipeline;
-               AssemblyAction _coreAction;
-               Hashtable _actions;
-               string _outputDirectory;
-               Hashtable _parameters;
-               bool _linkSymbols;
-
-               AssemblyResolver _resolver;
-
-               ReaderParameters _readerParameters;
-               ISymbolReaderProvider _symbolReaderProvider;
-               ISymbolWriterProvider _symbolWriterProvider;
-
-               AnnotationStore _annotations;
-
-               public Pipeline Pipeline {
-                       get { return _pipeline; }
-               }
-
-               public AnnotationStore Annotations {
-                       get { return _annotations; }
-               }
-
-               public string OutputDirectory {
-                       get { return _outputDirectory; }
-                       set { _outputDirectory = value; }
-               }
-
-               public AssemblyAction CoreAction {
-                       get { return _coreAction; }
-                       set { _coreAction = value; }
-               }
-
-               public bool LinkSymbols {
-                       get { return _linkSymbols; }
-                       set { _linkSymbols = value; }
-               }
-
-               public IDictionary Actions {
-                       get { return _actions; }
-               }
-
-               public AssemblyResolver Resolver {
-                       get { return _resolver; }
-               }
-
-               public ISymbolReaderProvider SymbolReaderProvider {
-                       get { return _symbolReaderProvider; }
-                       set { _symbolReaderProvider = value; }
-               }
-
-               public ISymbolWriterProvider SymbolWriterProvider {
-                       get { return _symbolWriterProvider; }
-                       set { _symbolWriterProvider = value; }
-               }
-
-               public bool LogInternalExceptions { get; set; } = false;
-
-               public LinkContext (Pipeline pipeline)
-                       : this (pipeline, new AssemblyResolver ())
-               {
-               }
-
-               public LinkContext (Pipeline pipeline, AssemblyResolver resolver)
-               {
-                       _pipeline = pipeline;
-                       _resolver = resolver;
-                       _actions = new Hashtable ();
-                       _parameters = new Hashtable ();
-                       _annotations = new AnnotationStore ();
-                       _readerParameters = new ReaderParameters {
-                               AssemblyResolver = _resolver,
-                       };
-               }
-
-               public TypeDefinition GetType (string fullName)
-               {
-                       int pos = fullName.IndexOf (",");
-                       fullName = fullName.Replace ("+", "/");
-                       if (pos == -1) {
-                               foreach (AssemblyDefinition asm in GetAssemblies ()) {
-                                       var type = asm.MainModule.GetType (fullName);
-                                       if (type != null)
-                                               return type;
-                               }
-
-                               return null;
-                       }
-
-                       string asmname = fullName.Substring (pos + 1);
-                       fullName = fullName.Substring (0, pos);
-                       AssemblyDefinition assembly = Resolve (AssemblyNameReference.Parse (asmname));
-                       return assembly.MainModule.GetType (fullName);
-               }
-
-               public AssemblyDefinition Resolve (string name)
-               {
-                       if (File.Exists (name)) {
-                               AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (name, _readerParameters);
-                               _resolver.CacheAssembly (assembly);
-                               return assembly;
-                       }
-
-                       return Resolve (new AssemblyNameReference (name, new Version ()));
-               }
-
-               public AssemblyDefinition Resolve (IMetadataScope scope)
-               {
-                       AssemblyNameReference reference = GetReference (scope);
-                       try {
-                               AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
-
-                               if (SeenFirstTime (assembly)) {
-                                       SafeReadSymbols (assembly);
-                                       SetAction (assembly);
-                               }
-
-                               return assembly;
-                       }
-                       catch {
-                               throw new AssemblyResolutionException (reference);
-                       }
-               }
-
-               bool SeenFirstTime (AssemblyDefinition assembly)
-               {
-                       return !_annotations.HasAction (assembly);
-               }
-
-               public void SafeReadSymbols (AssemblyDefinition assembly)
-               {
-                       if (!_linkSymbols)
-                               return;
-
-                       if (assembly.MainModule.HasSymbols)
-                               return;
-
-                       try {
-                               if (_symbolReaderProvider != null) {
-                                       var symbolReader = _symbolReaderProvider.GetSymbolReader (
-                                               assembly.MainModule,
-                                               assembly.MainModule.FileName);
-
-                                       _annotations.AddSymbolReader (assembly, symbolReader);
-                                       assembly.MainModule.ReadSymbols (symbolReader);
-                               } else
-                                       assembly.MainModule.ReadSymbols ();
-                       } catch {}
-               }
-
-               static AssemblyNameReference GetReference (IMetadataScope scope)
-               {
-                       AssemblyNameReference reference;
-                       if (scope is ModuleDefinition) {
-                               AssemblyDefinition asm = ((ModuleDefinition) scope).Assembly;
-                               reference = asm.Name;
-                       } else
-                               reference = (AssemblyNameReference) scope;
-
-                       return reference;
-               }
-
-               void SetAction (AssemblyDefinition assembly)
-               {
-                       AssemblyAction action = AssemblyAction.Link;
-
-                       AssemblyNameDefinition name = assembly.Name;
-
-                       if (_actions.Contains (name.Name))
-                               action = (AssemblyAction) _actions [name.Name];
-                       else if (IsCore (name))
-                               action = _coreAction;
-
-                       _annotations.SetAction (assembly, action);
-               }
-
-               static bool IsCore (AssemblyNameReference name)
-               {
-                       switch (name.Name) {
-                       case "mscorlib":
-                       case "Accessibility":
-                       case "Mono.Security":
-                               // WPF
-                       case "PresentationFramework":
-                       case "PresentationCore":
-                       case "WindowsBase":
-                       case "UIAutomationProvider":
-                       case "UIAutomationTypes":
-                       case "PresentationUI":
-                       case "ReachFramework":
-                               return true;
-                       default:
-                               return name.Name.StartsWith ("System")
-                                       || name.Name.StartsWith ("Microsoft");
-                       }
-               }
-
-               public AssemblyDefinition [] GetAssemblies ()
-               {
-                       IDictionary cache = _resolver.AssemblyCache;
-                       AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count];
-                       cache.Values.CopyTo (asms, 0);
-                       return asms;
-               }
-
-               public void SetParameter (string key, string value)
-               {
-                       _parameters [key] = value;
-               }
-
-               public bool HasParameter (string key)
-               {
-                       return _parameters.Contains (key);
-               }
-
-               public string GetParameter (string key)
-               {
-                       return (string) _parameters [key];
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/MethodAction.cs b/mcs/tools/linker/Mono.Linker/MethodAction.cs
deleted file mode 100644 (file)
index f51587e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// MethodAction.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum MethodAction {
-               Nothing,
-               Parse,
-               ForceParse
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/Pipeline.cs b/mcs/tools/linker/Mono.Linker/Pipeline.cs
deleted file mode 100644 (file)
index 7ae07d2..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// Pipeline.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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;
-using System.Diagnostics;
-
-using Mono.Linker.Steps;
-
-namespace Mono.Linker {
-
-       public class Pipeline {
-
-               ArrayList _steps;
-
-               public Pipeline ()
-               {
-                       _steps = new ArrayList();
-               }
-
-               public void PrependStep (IStep step)
-               {
-                       _steps.Insert (0, step);
-               }
-
-               public void AppendStep (IStep step)
-               {
-                       _steps.Add (step);
-               }
-
-               public void AddStepBefore (Type target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (target.IsInstanceOfType (_steps [i])) {
-                                       _steps.Insert (i, step);
-                                       return;
-                               }
-                       }
-                       string msg = String.Format ("Step {0} could not be inserted before (not found) {1}", step, target);
-                       throw new InvalidOperationException (msg);
-               }
-
-               public void ReplaceStep (Type target, IStep step)
-               {
-                       AddStepBefore (target, step);
-                       RemoveStep (target);
-               }
-
-               public void AddStepAfter (Type target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (target.IsInstanceOfType (_steps [i])) {
-                                       if (i == _steps.Count - 1)
-                                               _steps.Add (step);
-                                       else
-                                               _steps.Insert (i + 1, step);
-                                       return;
-                               }
-                       }
-                       string msg = String.Format ("Step {0} could not be inserted after (not found) {1}", step, target);
-                       throw new InvalidOperationException (msg);
-               }
-
-               public void AddStepAfter (IStep target, IStep step)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (_steps [i] == target) {
-                                       if (i == _steps.Count - 1)
-                                               _steps.Add (step);
-                                       else
-                                               _steps.Insert (i + 1, step);
-                                       return;
-                               }
-                       }
-               }
-
-               public void RemoveStep (Type target)
-               {
-                       for (int i = 0; i < _steps.Count; i++) {
-                               if (_steps [i].GetType () != target)
-                                       continue;
-
-                               _steps.RemoveAt (i);
-                               break;
-                       }
-               }
-
-               public void Process (LinkContext context)
-               {
-                       while (_steps.Count > 0) {
-                               IStep step = (IStep) _steps [0];
-                               context.Annotations.Push (step);
-                               step.Process (context);
-                               context.Annotations.Pop ();
-                               _steps.Remove (step);
-                       }
-               }
-
-               public IStep [] GetSteps ()
-               {
-                       return (IStep []) _steps.ToArray (typeof (IStep));
-               }
-
-               public bool ContainsStep (Type type)
-               {
-                       foreach (IStep step in _steps)
-                               if (step.GetType () == type)
-                                       return true;
-
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/TypePreserve.cs b/mcs/tools/linker/Mono.Linker/TypePreserve.cs
deleted file mode 100644 (file)
index 08e7b96..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// TypePreserve.cs
-//
-// Author:
-//   Jb Evain (jb@nurv.fr)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.
-//
-
-namespace Mono.Linker {
-
-       public enum TypePreserve {
-               Nothing,
-               All,
-               Fields,
-               Methods,
-       }
-}
diff --git a/mcs/tools/linker/Mono.Linker/XApiReader.cs b/mcs/tools/linker/Mono.Linker/XApiReader.cs
deleted file mode 100644 (file)
index bb16e21..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-//
-// XApiReader.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Linq;
-using System.Text;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-
-namespace Mono.Linker {
-
-       public class XApiReader {
-
-               static readonly string _name = "name";
-               static readonly string _ns = string.Empty;
-
-               LinkContext _context;
-               XPathDocument _document;
-               IXApiVisitor _visitor;
-
-               AssemblyDefinition _assembly;
-               string _namespace;
-               Stack _types = new Stack ();
-               StringBuilder _signature;
-
-               public XApiReader (XPathDocument document, IXApiVisitor visitor)
-               {
-                       _document = document;
-                       _visitor = visitor;
-               }
-
-               public void Process (LinkContext context)
-               {
-                       _context = context;
-                       ProcessAssemblies (_document.CreateNavigator ());
-               }
-
-               void OnAssembly (XPathNavigator nav)
-               {
-                       _assembly = GetAssembly (nav);
-
-                       _visitor.OnAssembly (nav, _assembly);
-
-                       ProcessAttributes (nav);
-                       ProcessNamespaces (nav);
-               }
-
-               AssemblyDefinition GetAssembly (XPathNavigator nav)
-               {
-                       AssemblyNameReference name = new AssemblyNameReference (
-                               GetName (nav),
-                               new Version (GetAttribute (nav, "version")));
-
-                       AssemblyDefinition assembly = _context.Resolve (name);
-                       ProcessReferences (assembly);
-                       return assembly;
-               }
-
-               void ProcessReferences (AssemblyDefinition assembly)
-               {
-                       foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
-                               _context.Resolve (name);
-               }
-
-               void OnAttribute (XPathNavigator nav)
-               {
-                       _visitor.OnAttribute (nav);
-               }
-
-               void PushType (TypeDefinition type)
-               {
-                       _types.Push (type);
-               }
-
-               TypeDefinition PeekType ()
-               {
-                       return (TypeDefinition) _types.Peek ();
-               }
-
-               TypeDefinition PopType ()
-               {
-                       return (TypeDefinition) _types.Pop ();
-               }
-
-               void OnNamespace (XPathNavigator nav)
-               {
-                       _namespace = GetName (nav);
-
-                       ProcessClasses (nav);
-               }
-
-               void OnClass (XPathNavigator nav)
-               {
-                       string name = GetClassName (nav);
-
-                       TypeDefinition type = _assembly.MainModule.GetType (name);
-                       if (type == null)
-                               return;
-
-                       _visitor.OnClass (nav, type);
-
-                       PushType (type);
-
-                       ProcessAttributes (nav);
-                       ProcessInterfaces (nav);
-                       ProcessFields (nav);
-                       ProcessMethods (nav);
-                       ProcessConstructors (nav);
-                       ProcessProperties (nav);
-                       ProcessEvents (nav);
-                       ProcessClasses (nav);
-
-                       PopType ();
-               }
-
-               string GetClassName (XPathNavigator nav)
-               {
-                       if (IsNestedClass ())
-                               return PeekType ().FullName + "/" + GetName (nav);
-
-                       return _namespace + "." + GetName (nav);
-               }
-
-               bool IsNestedClass ()
-               {
-                       return _types.Count > 0;
-               }
-
-               void OnField (XPathNavigator nav)
-               {
-                       TypeDefinition declaring = PeekType ();
-
-                       FieldDefinition field = declaring.Fields.FirstOrDefault (f => f.Name == GetName (nav));
-                       if (field != null)
-                               _visitor.OnField (nav, field);
-
-                       ProcessAttributes (nav);
-               }
-
-               void OnInterface (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-
-                       TypeDefinition type = _context.GetType (GetTypeName (name));
-                       if (type != null)
-                               _visitor.OnInterface (nav, type);
-               }
-
-               void OnMethod (XPathNavigator nav)
-               {
-                       InitMethodSignature (nav);
-
-                       ProcessParameters (nav);
-
-                       string signature = GetMethodSignature ();
-
-                       MethodDefinition method = GetMethod (signature);
-                       if (method != null)
-                               _visitor.OnMethod (nav, method);
-
-                       ProcessAttributes (nav);
-               }
-
-               MethodDefinition GetMethod (string signature)
-               {
-                       return GetMethod (PeekType ().Methods, signature);
-               }
-
-               static MethodDefinition GetMethod (ICollection methods, string signature)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (signature == GetSignature (method))
-                                       return method;
-
-                       return null;
-               }
-
-               static string GetSignature (MethodDefinition method)
-               {
-                       return method.ToString ().Replace ("<", "[").Replace (">", "]");
-               }
-
-               string GetMethodSignature ()
-               {
-                       _signature.Append (")");
-                       return _signature.ToString ();
-               }
-
-               void InitMethodSignature (XPathNavigator nav)
-               {
-                       _signature = new StringBuilder ();
-
-                       string returntype = GetAttribute (nav, "returntype");
-                       if (returntype == null || returntype.Length == 0)
-                               returntype = "System.Void";
-
-                       _signature.Append (NormalizeTypeName (returntype));
-                       _signature.Append (" ");
-                       _signature.Append (PeekType ().FullName);
-                       _signature.Append ("::");
-
-                       string name = GetName (nav);
-                       _signature.Append (GetMethodName (name));
-
-                       _signature.Append ("(");
-               }
-
-               static string GetMethodName (string name)
-               {
-                       return GetStringBefore (name, "(");
-               }
-
-               static string NormalizeTypeName (string name)
-               {
-                       return name.Replace ("+", "/").Replace ("<", "[").Replace (">", "]");
-               }
-
-               static string GetTypeName (string name)
-               {
-                       return GetStringBefore (NormalizeTypeName (name), "[");
-               }
-
-               static string GetStringBefore (string str, string marker)
-               {
-                       int pos = str.IndexOf (marker);
-                       if (pos == -1)
-                               return str;
-
-                       return str.Substring (0, pos);
-               }
-
-               void OnParameter (XPathNavigator nav)
-               {
-                       string type = GetAttribute (nav, "type");
-                       int pos = int.Parse (GetAttribute (nav, "position"));
-
-                       if (pos > 0)
-                               _signature.Append (",");
-                       _signature.Append (NormalizeTypeName (type));
-               }
-
-               void OnConstructor (XPathNavigator nav)
-               {
-                       InitMethodSignature (nav);
-
-                       ProcessParameters (nav);
-
-                       string signature = GetMethodSignature ();
-
-                       MethodDefinition ctor = GetMethod (signature);
-                       if (ctor != null)
-                               _visitor.OnConstructor (nav, ctor);
-
-                       ProcessAttributes (nav);
-               }
-
-               void OnProperty (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-                       TypeDefinition type = PeekType ();
-
-                       var property = type.Properties.FirstOrDefault (p => p.Name == name);
-                       if (property != null)
-                               _visitor.OnProperty (nav, property);
-
-                       ProcessAttributes (nav);
-                       ProcessMethods (nav);
-               }
-
-               void OnEvent (XPathNavigator nav)
-               {
-                       string name = GetName (nav);
-                       TypeDefinition type = PeekType ();
-
-                       EventDefinition evt = type.Events.FirstOrDefault (e => e.Name == name);
-                       if (evt != null)
-                               _visitor.OnEvent (nav, evt);
-
-                       ProcessAttributes (nav);
-               }
-
-               void ProcessAssemblies (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "assemblies//assembly", new OnChildren (OnAssembly));
-               }
-
-               void ProcessAttributes (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "attributes//attribute", new OnChildren (OnAttribute));
-               }
-
-               void ProcessNamespaces (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "namespaces//namespace", new OnChildren (OnNamespace));
-               }
-
-               void ProcessClasses (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "classes//class", new OnChildren (OnClass));
-               }
-
-               void ProcessInterfaces (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "intefaces//interface", new OnChildren (OnInterface));
-               }
-
-               void ProcessFields (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "fields//field", new OnChildren (OnField));
-               }
-
-               void ProcessMethods (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "methods//method", new OnChildren (OnMethod));
-               }
-
-               void ProcessConstructors (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "constructors//constructor", new OnChildren (OnConstructor));
-               }
-
-               void ProcessParameters (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "parameters//parameter", new OnChildren (OnParameter));
-               }
-
-               void ProcessProperties (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "properties//property", new OnChildren (OnProperty));
-               }
-
-               void ProcessEvents (XPathNavigator nav)
-               {
-                       ProcessChildren (nav, "events//event", new OnChildren (OnEvent));
-               }
-
-               static void ProcessChildren (XPathNavigator nav, string children, OnChildren action)
-               {
-                       XPathNodeIterator iterator = nav.Select (children);
-                       while (iterator.MoveNext ())
-                               action (iterator.Current);
-               }
-
-               delegate void OnChildren (XPathNavigator nav);
-
-               static string GetName (XPathNavigator nav)
-               {
-                       return GetAttribute (nav, _name);
-               }
-
-               static string GetAttribute (XPathNavigator nav, string attribute)
-               {
-                       return nav.GetAttribute (attribute, _ns);
-               }
-       }
-}
diff --git a/mcs/tools/linker/README b/mcs/tools/linker/README
deleted file mode 100644 (file)
index 95b8a92..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-monolinker
-====
-
-monolinker is the Mono CIL Linker.
-
-The linker is a tool one can use to only ship the minimal possible set of
-functions that a set of programs might require to run as opposed to the full
-libraries.
-
-* How does the linker work?
-
-The linker analyses the intermediate code (CIL) produced by every compiler
-targeting the Mono platform like mcs, gmcs, vbnc, booc or others. It will walk
-through all the code that it is given to it, and basically, perform a mark and
-sweep operations on all the code that it is referenced, to only keep what is
-necessary for the source program to run.
-
-* Usage
-
-1) Linking from a source assembly
-
-The command:
-
-monolinker -a Program.exe
-
-will use the assembly Program.exe as a source. That means that the linker will
-walk through all the methods of Program.exe to generate only what is necessary
-for this assembly to run.
-
-2) Linking from an xml descriptor
-
-The command:
-
-monolinker -x desc.xml
-
-will use the XML descriptor as a source. That means that the linker will
-use this file to decide what to link in a set of assemblies. The format of the
-descriptors is described further on in this document.
-
-3) Linking from an api info file
-
-The command:
-
-monolinker -i assembly.info
-
-will use a file produced by mono-api-info as a source. The linker will use
-this file to link only what is necessary to match the public API defined in
-the info file.
-
-4) Actions on the assemblies
-
-You can specify what the linker should do exactly per assembly.
-
-The linker can do 3 things:
-
-       - skip them, and do nothing with them,
-       - copy them to the output directory,
-       - link them, to reduce their size.
-
-You can specify an action per assembly like this:
-
-monolinker -p link Foo
-
-or
-
-monolinker -p skip System.Windows.Forms
-
-Or you can specify what to do for the core assemblies.
-
-Core assemblies are the assemblies that belongs to the base class library,
-like mscorlib.dll, System.dll or System.Windows.Forms.dll.
-
-You can specify what action to do on the core assemblies with the option:
-
--c skip|copy|link
-
-5) The output directory
-
-By default, the linker will create an `output' directory in the current
-directory where it will emit the linked files, to avoid erasing source
-assemblies. You can specify the output directory with the option:
-
--o output_directory
-
-If you specify the directory `.', please ensure that you won't write over
-important assemblies of yours.
-
-* Syntax of a xml descriptor
-
-Here is an example that shows all the possibilities of this format:
-
----
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-               <type fullname="Bar" preserve="nothing" required="false" />
-               <type fullname="Baz" preserve="fields" required="false" />
-               <type fullname="Gazonk">
-                       <method signature="System.Void .ctor(System.String)" />
-                       <field signature="System.String _blah" />
-               </type>
-       </assembly>
-</linker>
----
-
-In this example, the linker will link the types Foo, Bar, Baz and Gazonk.
-
-The fullname attribute specifies the fullname of the type in the format
-specified by ECMA-335. This is in Mono and certain cases not the same
-as the one reported by Type.FullName (nested classes e.g.).
-
-The preserve attribute ensures that all the fields of the type Baz will be
-always be linked, not matter if they are used or not, but that neither the
-fields or the methods of Bar will be linked if they are not used. Not
-specifying a preserve attribute implies that we are preserving everything in
-the specified type.
-
-The required attribute specifies that if the type is not marked, during the
-mark operation, it will not be linked.
-
-The type Gazonk will be linked, as well as its constructor taking a string as a
-parameter, and it's _blah field.
-
-You can have multiple assembly nodes.
-
-6) The i18n Assemblies
-
-Mono have a few assemblies which contains everything region specific:
-
-    I18N.CJK.dll
-    I18N.MidEast.dll
-    I18N.Other.dll
-    I18N.Rare.dll
-    I18N.West.dll
-
-By default, they will all be copied to the output directory. But you can
-specify which one you want using the command:
-
-monolinker -l choice
-
-Where choice can either be: none, all, cjk, mideast, other, rare or west. You can
-combine the values with a comma.
-
-Example:
-
-monolinker -a assembly -l mideast,cjk
-
-7) Specifying directories where the linker should look for assemblies
-
-By default, the linker will first look for assemblies in the directories `.'
-and `bin'. You can specify
-
-Example:
-
-monolinker -d ../../libs -a program.exe
-
-8) Adding custom steps to the linker.
-
-You can write custom steps for the linker and tell the linker to use them.
-Let's take a simple example:
-
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-namespace Foo {
-
-       public class FooStep : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       foreach (IStep step in context.Pipeline.GetSteps ()) {
-                               Console.WriteLine (step.GetType ().Name);
-                       }
-               }
-       }
-}
-
-
-That is compiled against the linker to a Foo.dll assembly.
-
-You can ask the linker to add it at the end of the pipeline:
-
-monolinker -s Foo.FooStep,Foo -a program.exe
-
-Or you can ask the linker to add it after a specific step:
-
-monolinker -s MarkStep:Foo.FooStep,Foo -a program.exe
-
-Or before a specific step:
-
-monolinker -s Foo.FooStep,Foo:MarkStep
-
-* Inside the linker
-
-The linker is a quite small piece of code, and it pretty simple to address.
-Its only dependency is Mono.Cecil, that is used to read, modify and write back
-the assemblies.
-
-Everything is located in the namespace Mono.Linker, or in sub namespaces.
-Being a command line utility, its entry point function is in the class Driver.
-
-This class is in charge of analyzing the command line, and to instantiate two
-important objects, a LinkContext, and a Pipeline.
-
-The LinkContext contains all the informations that will be used during the
-linking process, such as the assemblies involved, the output directory and
-probably other useful stuff.
-
-The Pipeline is simply a queue of actions (steps), to be applied to the current
-context. The whole process of linking is split into those differents steps
-that are all located in the Mono.Linker.Steps namespace.
-
-Here are the current steps that are implemented, in the order they are used:
-
-1) ResolveFromAssembly or ResolveFromXml
-
-Those steps are used to initialize the context, and pre-mark the root code
-that will be used as a source for the linker.
-
-Resolving from an assembly or resolving from a xml descriptor is a decision
-taken in the command line parsing.
-
-2) LoadReferences
-
-This step will load all the references of all the assemblies involved in the
-current context.
-
-3) Blacklist
-
-This step is used if and only if you have specified that the core should be
-linked. It will load a bunch of resources from the assemblies, that are
-actually a few XML descriptors, that will ensure that some types and methods
-that are used from inside the runtime are properly linked and not removed.
-
-It is doing so by inserting a ResolveFromXml step per blacklist in the
-pipeline.
-
-4) Mark
-
-This is the most complex step. The linker will get from the context the list
-of types, fields and methods that have been pre-marked in the resolve steps,
-and walk through all of them. For every method, it will analyse the CIL stream,
-to find references to other fields, types, or methods.
-
-When it encounters such a reference, it will resolve the original definition of
-this reference, and add this to the queue of items to be processed. For
-instance, if have in a source assembly a call to Console.WriteLine, the linker
-will resolve the appropriate method WriteLine in the Console type from the
-mscorlib assembly, and add it to the queue. When this WriteLine method will be
-dequeued, and processed, the linker will go through everything that is used in
-it, and add it to the queue, if they have not been processed already.
-
-To know if something have been marked to be linked, or processed, the linker
-is using a functionality of Cecil called annotations. Almost everything in
-Cecil can be annotated. Concretely, it means that almost everything own an
-Hashtable in which you can add what you want, using the keys and the values you
-want.
-
-So the linker will annotate assemblies, types, methods and fields to know
-what should be linked or not, and what have been processed, and how it should
-process them.
-
-This is really useful as we don't have to recreate a full hierarchy of classes
-to encapsulate the different Cecil types to add the few informations we want.
-
-5) Sweep
-
-This simple step will walk through all the elements of an assembly, and based
-on their annotations, remove them or keep them.
-
-6) Clean
-
-This step will clean parts of the assemblies, like properties. If a proprety
-used to have a getter and a setter, and that after the mark & sweep steps,
-only the getter is linked, it will update the property to reflect that.
-
-There is a few things to keep clean like properties has we've seen, events,
-nested classes, and probably a few others.
-
-7) Output
-
-For each assembly in the context, this step will act on the action associated
-to the assembly. If the assembly is marked as skip, it won't do anything,
-if it's marked as copy, it will copy the assembly to the output directory,
-and if it's link, it will save the modified assembly to the output directory.
-
-* Reporting a bug
-
-If you face a bug in the linker, please report it to:
-
-http://bugzilla.ximian.com
-
-Product: Mono tools, Component: linker.
-
-* Mailing lists
-
-You can ask questions about the linker of the cecil Google Group:
-
-http://groups.google.com/group/mono-cecil
-
---
-Jb Evain <jbevain@novell.com>
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll b/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll
deleted file mode 100755 (executable)
index f112e23..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit-console-runner.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console.exe b/mcs/tools/linker/Tests/Libs/nunit-console.exe
deleted file mode 100755 (executable)
index 32ca802..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit-console.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit-console.exe.config b/mcs/tools/linker/Tests/Libs/nunit-console.exe.config
deleted file mode 100755 (executable)
index 4926127..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<configuration>
-    <!--
-     Application settings for NUnit-console.exe. Do NOT put settings
-        for use by your tests here.
-       -->
-  <appSettings>
-
-       <!--
-        Specify the location to be used by .NET for the cache
-       -->
-    <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
-
-  </appSettings>
-
-    <!--
-     The startup section may be used to specify the runtime versions
-     supported in the order that they will be used if more than one
-     is present. As supplied, this section is commented out, which
-     causes nunit-console to use the version of the framework with
-     which it was built.
-
-        Since .NET 1.0 does not recognize the <supportedRuntime> elements,
-        a <requiredRuntime> element is used in case it is the only version
-        of the framework that is installed.
-    -->
-    <!--
-  <startup>
-         <supportedRuntime version="v2.0.50727" />
-         <supportedRuntime version="v2.0.50215" />
-         <supportedRuntime version="v2.0.40607" />
-         <supportedRuntime version="v1.1.4322" />
-         <supportedRuntime version="v1.0.3705" />
-
-         <requiredRuntime version="v1.0.3705" />
-  </startup>
-  -->
-
-   <!--
-    The following <runtime> section allows running nunit under
-    .NET 1.0 by redirecting assemblies. The appliesTo attribute
-    causes the section to be ignored except under .NET 1.0version 1
-    on a machine with only the .NET version 1.0 runtime installed.
-    If application and its tests were built for .NET 1.1 you will
-    also need to redirect system assemblies in the test config file.
-   -->
-
- <runtime>
-
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
-                       appliesTo="v1.0.3705">
-
-      <dependentAssembly>
-        <assemblyIdentity name="System"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Data"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Drawing"
-                          publicKeyToken="b03f5f7f11d50a3a"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Windows.Forms"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-      <dependentAssembly>
-        <assemblyIdentity name="System.Xml"
-                          publicKeyToken="b77a5c561934e089"
-                          culture="neutral"/>
-        <bindingRedirect  oldVersion="1.0.5000.0"
-                          newVersion="1.0.3300.0"/>
-      </dependentAssembly>
-
-    </assemblyBinding>
-
-  </runtime>
-
-</configuration>
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/Libs/nunit.core.dll b/mcs/tools/linker/Tests/Libs/nunit.core.dll
deleted file mode 100755 (executable)
index df7f905..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.core.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit.framework.dll b/mcs/tools/linker/Tests/Libs/nunit.framework.dll
deleted file mode 100755 (executable)
index 5316687..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.framework.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Libs/nunit.util.dll b/mcs/tools/linker/Tests/Libs/nunit.util.dll
deleted file mode 100755 (executable)
index e9e479e..0000000
Binary files a/mcs/tools/linker/Tests/Libs/nunit.util.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/Makefile b/mcs/tools/linker/Tests/Makefile
deleted file mode 100644 (file)
index 769a38a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-MCS = mcs
-
-all: Mono.Linker.Tests.dll
-
-Mono.Cecil.dll:
-       cp ../Mono.Cecil.dll .
-
-monolinker.exe:
-       cp ../monolinker.exe .
-
-Mono.Linker.Tests.dll.sources:
-       find Mono.Linker.Tests -name "*.cs" > Mono.Linker.Tests.dll.sources
-
-Mono.Linker.Tests.dll: Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources
-       $(MCS) /target:library /out:Mono.Linker.Tests.dll /r:nunitlite.dll /r:Mono.Cecil.dll /r:monolinker.exe @Mono.Linker.Tests.dll.sources
-
-clean:
-       rm -rf Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources Mono.Linker.Tests.dll
-
-run-test: all
-       nunit-console Mono.Linker.Tests.dll
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests.csproj b/mcs/tools/linker/Tests/Mono.Linker.Tests.csproj
deleted file mode 100644 (file)
index a83021f..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Linker.Tests</RootNamespace>
-    <AssemblyName>Mono.Linker.Tests</AssemblyName>
-    <StartupObject>
-    </StartupObject>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <!-- 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">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Libs\nunit.framework.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\class\Mono.Cecil\Mono.Cecil.csproj">
-      <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\Mono.Linker.csproj">
-      <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
-      <Name>Mono.Linker</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Linker.Tests\AbstractLinkingTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AbstractTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AssemblyLinkingTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\AssemblyInfo.cs" />
-    <Compile Include="Mono.Linker.Tests\IntegrationTestFixture.cs" />
-    <Compile Include="Mono.Linker.Tests\XmlLinkingTestFixture.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Properties\" />
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs
deleted file mode 100644 (file)
index 58dc1a5..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-//
-// AbstractLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-using Mono.Cecil;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       public abstract class AbstractLinkingTestFixture : AbstractTestFixture {
-
-               [SetUp]
-               public override void SetUp ()
-               {
-                       base.SetUp ();
-
-                       TestCasesRoot = "Linker";
-               }
-
-               [TearDown]
-               public override void TearDown ()
-               {
-                       base.TearDown ();
-
-                       string output = GetOutputPath ();
-                       if (Directory.Exists (output))
-                               Directory.Delete (output, true);
-               }
-
-               protected override Pipeline GetPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-
-                       Prepare ();
-               }
-
-               void Prepare ()
-               {
-                       Context = GetContext ();
-                       string output = GetOutputPath ();
-                       if (Directory.Exists (output))
-                               Directory.Delete (output, true);
-                       Directory.CreateDirectory (output);
-               }
-
-               protected override void Run ()
-               {
-                       base.Run ();
-                       Compare ();
-               }
-
-               void Compare ()
-               {
-                       foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) {
-                               if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                                       continue;
-
-                               string fileName = GetAssemblyFileName (assembly);
-
-                               CompareAssemblies (
-                                       AssemblyFactory.GetAssembly (
-                                               Path.Combine (GetTestCasePath (), fileName)),
-                                       AssemblyFactory.GetAssembly (
-                                               Path.Combine (GetOutputPath (), fileName)));
-                       }
-               }
-
-               static void CompareAssemblies (AssemblyDefinition original, AssemblyDefinition linked)
-               {
-                       foreach (TypeDefinition originalType in original.MainModule.Types) {
-                               TypeDefinition linkedType = linked.MainModule.Types [originalType.FullName];
-                               if (NotLinked (originalType)) {
-                                       Assert.IsNull (linkedType, string.Format ("Type `{0}' should not have been linked", originalType));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedType, string.Format ("Type `{0}' should have been linked", originalType));
-                               CompareTypes (originalType, linkedType);
-                       }
-               }
-
-               static void CompareTypes (TypeDefinition type, TypeDefinition linkedType)
-               {
-                       foreach (FieldDefinition originalField in type.Fields) {
-                               FieldDefinition linkedField = linkedType.Fields.GetField (originalField.Name);// TODO: also get with the type!
-                               if (NotLinked (originalField)) {
-                                       Assert.IsNull (linkedField, string.Format ("Field `{0}' should not have been linked", originalField));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedField, string.Format ("Field `{0}' should have been linked", originalField));
-                       }
-
-                       foreach (MethodDefinition originalCtor in type.Constructors) {
-                               MethodDefinition linkedCtor = linkedType.Constructors.GetConstructor (originalCtor.IsStatic, originalCtor.Parameters);
-                               if (NotLinked (originalCtor)) {
-                                       Assert.IsNull (linkedCtor, string.Format ("Constructor `{0}' should not have been linked", originalCtor));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedCtor, string.Format ("Constructor `{0}' should have been linked", originalCtor));
-                       }
-
-                       foreach (MethodDefinition originalMethod in type.Methods) {
-                               MethodDefinition linkedMethod = linkedType.Methods.GetMethod (originalMethod.Name, originalMethod.Parameters);
-                               if (NotLinked (originalMethod)) {
-                                       Assert.IsNull (linkedMethod, string.Format ("Method `{0}' should not have been linked", originalMethod));
-                                       continue;
-                               }
-
-                               Assert.IsNotNull (linkedMethod, string.Format ("Method `{0}' should have been linked", originalMethod));
-                       }
-               }
-
-               static bool NotLinked(ICustomAttributeProvider provider)
-               {
-                       foreach (CustomAttribute ca in provider.CustomAttributes)
-                               if (ca.Constructor.DeclaringType.Name == "NotLinkedAttribute")
-                                       return true;
-
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs
deleted file mode 100644 (file)
index f4ac2d5..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// AbstractTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.
-//
-
-namespace Mono.Linker.Tests {
-
-       using System;
-       using System.IO;
-
-       using Mono.Cecil;
-
-       using NUnit.Framework;
-
-       public abstract class AbstractTestFixture {
-
-               string _testCasesRoot;
-               string _testCase;
-               LinkContext _context;
-               Pipeline _pipeline;
-
-               protected LinkContext Context {
-                       get { return _context; }
-                       set { _context = value; }
-               }
-
-               protected Pipeline Pipeline {
-                       get { return _pipeline; }
-                       set { _pipeline = value; }
-               }
-
-               public string TestCasesRoot {
-                       get { return _testCasesRoot; }
-                       set { _testCasesRoot = value; }
-               }
-
-               public string TestCase {
-                       get { return _testCase; }
-                       set { _testCase = value; }
-               }
-
-               [SetUp]
-               public virtual void SetUp ()
-               {
-                       _pipeline = GetPipeline ();
-               }
-
-               [TearDown]
-               public virtual void TearDown ()
-               {
-               }
-
-               protected virtual Pipeline GetPipeline ()
-               {
-                       return new Pipeline ();
-               }
-
-               protected virtual LinkContext GetContext ()
-               {
-                       LinkContext context = new LinkContext (_pipeline);
-                       context.OutputDirectory = GetOutputPath ();
-                       context.CoreAction = AssemblyAction.Copy;
-                       return context;
-               }
-
-               protected string GetOutputPath ()
-               {
-                       return Path.Combine (
-                               Path.GetTempPath (),
-                               _testCase);
-               }
-
-               protected string GetTestCasePath ()
-               {
-                       return Path.Combine (
-                               Path.Combine (
-#if DEBUG
-                                       Path.Combine (Environment.CurrentDirectory,
-                                               Path.Combine ("..", "..")),
-#else
-                                       Environment.CurrentDirectory,
-#endif
-                                       "TestCases"),
-                               Path.Combine (
-                                       _testCasesRoot,
-                                       _testCase));
-               }
-
-               protected virtual void RunTest (string testCase)
-               {
-                       _testCase = testCase;
-                       _context = GetContext ();
-               }
-
-               protected virtual void Run ()
-               {
-                       string cd = Environment.CurrentDirectory;
-                       Environment.CurrentDirectory = GetTestCasePath ();
-                       try {
-                               _pipeline.Process (_context);
-                       } finally {
-                               Environment.CurrentDirectory = cd;
-                       }
-               }
-
-               protected static string GetAssemblyFileName (AssemblyDefinition asm)
-               {
-                       return asm.Name.Name + (asm.Kind == AssemblyKind.Dll ? ".dll" : ".exe");
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyInfo.cs
deleted file mode 100644 (file)
index 0c169fd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("Mono.Linker.Tests")]
-[assembly: AssemblyDescription ("NUnit tests for Mono's CIL Linker")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("(C) 2006, Jb Evain")]
-[assembly: AssemblyCulture ("")]
-
-[assembly: CLSCompliant (false)]
-[assembly: ComVisible (false)]
-
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs
deleted file mode 100644 (file)
index 4810cd1..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// AssemblyLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class AssemblyLinkingTestFixture : AbstractLinkingTestFixture {
-
-               [Test]
-               public void TestSimple ()
-               {
-                       RunTest ("Simple");
-               }
-
-               [Test]
-               public void TestVirtualCall ()
-               {
-                       RunTest ("VirtualCall");
-               }
-
-               [Test]
-               public void TestMultipleReferences ()
-               {
-                       RunTest ("MultipleReferences");
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-                       Pipeline.PrependStep (
-                               new ResolveFromAssemblyStep (
-                                       Path.Combine (GetTestCasePath (), "Program.exe")));
-
-                       Run ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/IntegrationTestFixture.cs
deleted file mode 100644 (file)
index f455f65..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// IntegrationTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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.Diagnostics;
-using System.IO;
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class IntegrationTestFixture : AbstractTestFixture {
-
-               [SetUp]
-               public override void SetUp ()
-               {
-                       base.SetUp ();
-
-                       TestCasesRoot = "Integration";
-               }
-
-               [Test]
-               public void TestHelloWorld ()
-               {
-                       RunTest ("HelloWorld");
-               }
-
-               [Test]
-               public void TestCrypto ()
-               {
-                       RunTest ("Crypto");
-               }
-
-               protected override LinkContext GetContext()
-               {
-                       LinkContext context = base.GetContext ();
-                       context.CoreAction = AssemblyAction.Link;
-                       return context;
-               }
-
-               protected override Pipeline GetPipeline ()
-               {
-                       Pipeline p = new Pipeline ();
-                       p.AppendStep (new LoadReferencesStep ());
-                       p.AppendStep (new BlacklistStep ());
-                       p.AppendStep (new TypeMapStep ());
-                       p.AppendStep (new MarkStep ());
-                       p.AppendStep (new SweepStep ());
-                       p.AppendStep (new CleanStep ());
-                       p.AppendStep (new OutputStep ());
-                       return p;
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       if (!OnMono ())
-                               Assert.Ignore ("Integration tests are only runnable on Mono");
-
-                       base.RunTest (testCase);
-                       string test = Path.Combine (GetTestCasePath (), "Test.exe");
-
-                       string original = Execute (GetTestCasePath (), "Test.exe");
-
-                       Pipeline.PrependStep (
-                               new ResolveFromAssemblyStep (
-                                       test));
-
-                       Run ();
-
-                       string linked = Execute (Context.OutputDirectory, "Test.exe");
-
-                       Assert.AreEqual (original, linked);
-               }
-
-               static bool OnMono ()
-               {
-                       return Type.GetType ("System.MonoType") != null;
-               }
-
-               static string Execute (string directory, string file)
-               {
-                       Process p = new Process ();
-                       p.StartInfo.EnvironmentVariables ["MONO_PATH"] = directory;
-                       p.StartInfo.CreateNoWindow = true;
-                       p.StartInfo.WorkingDirectory = directory;
-                       p.StartInfo.FileName = "mono";
-                       p.StartInfo.Arguments = file;
-                       p.StartInfo.RedirectStandardOutput = true;
-                       p.StartInfo.UseShellExecute = false;
-
-                       p.Start ();
-                       p.WaitForExit ();
-
-                       return p.StandardOutput.ReadToEnd ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs b/mcs/tools/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
deleted file mode 100644 (file)
index 1e89290..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// XmlLinkingTestFixture.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// (C) 2006 Jb Evain
-//
-// 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.IO;
-using System.Xml.XPath;
-
-using Mono.Linker.Steps;
-using NUnit.Framework;
-
-
-namespace Mono.Linker.Tests {
-
-       [TestFixture]
-       public class XmlLinkingTestFixture : AbstractLinkingTestFixture {
-
-               [Test]
-               public void TestSimpleXml ()
-               {
-                       RunTest ("SimpleXml");
-               }
-
-               [Test]
-               public void TestInterface ()
-               {
-                       RunTest ("Interface");
-               }
-
-               [Test]
-               public void TestReferenceInVirtualMethod ()
-               {
-                       RunTest ("ReferenceInVirtualMethod");
-               }
-
-               [Test]
-               public void TestGenerics ()
-               {
-                       RunTest ("Generics");
-               }
-
-               [Test]
-               public void TestNestedNested ()
-               {
-                       RunTest ("NestedNested");
-               }
-
-               [Test]
-               public void TestPreserveFieldsRequired ()
-               {
-                       RunTest ("PreserveFieldsRequired");
-               }
-
-               [Test]
-               public void TestReferenceInAttributes ()
-               {
-                       RunTest ("ReferenceInAttributes");
-               }
-
-               [Test]
-               public void TestXmlPattern ()
-               {
-                       RunTest ("XmlPattern");
-               }
-
-               protected override void RunTest (string testCase)
-               {
-                       base.RunTest (testCase);
-                       Pipeline.PrependStep (
-                               new ResolveFromXmlStep (
-                                       new XPathDocument (Path.Combine (GetTestCasePath (), "desc.xml"))));
-
-                       Run ();
-               }
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs b/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.cs
deleted file mode 100644 (file)
index 8c38f92..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Security.Cryptography;
-using System.Text;
-
-class Test {
-
-       static void Main ()
-       {
-               byte [] foo = Encoding.UTF8.GetBytes ("foobared");
-
-               HashAlgorithm ha = MD5.Create ();
-               byte [] hash = ha.ComputeHash (foo);
-
-               Console.WriteLine (Encoding.UTF8.GetString (hash));
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe b/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe
deleted file mode 100755 (executable)
index 2decc49..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Integration/Crypto/Test.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs b/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.cs
deleted file mode 100644 (file)
index 4a65b44..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-class Test {
-
-       static void Main ()
-       {
-               Console.WriteLine ("Hello world!");
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe b/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe
deleted file mode 100755 (executable)
index 2f4f4c9..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Integration/HelloWorld/Test.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.cs
deleted file mode 100644 (file)
index 75fe1ed..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-
-public class Foo {
-
-       void Bar ()
-       {
-               int i = 42;
-               string s = "hey";
-
-               Baz<int> bi = new Baz<int> (i);
-               bi.Gazonk ();
-               bi.Bat<string>(i, s);
-
-               Baz<string> bs = new Baz<string> (s);
-               bs.Gazonk ();
-               bs.Bat<int>(s, i);
-               bs.BiroBiro ();
-
-               bs.Blam<Bang> ();
-       }
-}
-
-public class Baz<T> {
-
-       T _t;
-
-       public Baz (T t)
-       {
-               _t = t;
-       }
-
-       public void Gazonk ()
-       {
-               Console.WriteLine (_t);
-       }
-
-       public void Bat<M> (T t, M m)
-       {
-               Console.WriteLine ("{0}{1}", t, m);
-       }
-
-       public void Blam<M> ()
-       {
-       }
-
-       public T [] BiroBiro ()
-       {
-               return new T [0];
-       }
-}
-
-class Bang {
-
-       [NotLinked] public Bang ()
-       {
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll
deleted file mode 100644 (file)
index fe5cab1..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Generics/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/Generics/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.cs
deleted file mode 100644 (file)
index 7aa9394..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-
-public class Foo : IFoo {
-
-       public void Gazonk ()
-       {
-       }
-}
-
-public interface IFoo : IBar {
-}
-
-public interface IBar {
-
-       void Gazonk ();
-}
-
-[NotLinked] public class Baz : IBaz {
-}
-
-[NotLinked] public interface IBaz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll
deleted file mode 100644 (file)
index 2ae8b92..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Interface/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/Interface/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs
deleted file mode 100644 (file)
index c2f0df4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-public class Bar {
-
-       string bang = "bang !";
-
-       public Bar ()
-       {
-       }
-
-       public void Bang ()
-       {
-               Console.WriteLine (bang);
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll
deleted file mode 100644 (file)
index 159106d..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs
deleted file mode 100644 (file)
index ab5241c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-public class Baz {
-
-       public void Chain (Foo f)
-       {
-               f.b.Bang ();
-       }
-
-       [NotLinked] public void Lurman ()
-       {
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll
deleted file mode 100644 (file)
index 977b20f..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs
deleted file mode 100644 (file)
index 746a2b2..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-
-public class Foo {
-
-       public Bar b;
-
-       public Foo (Bar b)
-       {
-               this.b = b;
-       }
-
-       public void UseBar ()
-       {
-               b.Bang ();
-       }
-
-       [NotLinked] public void Blam ()
-       {
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll
deleted file mode 100644 (file)
index 54e10fe..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Makefile
deleted file mode 100644 (file)
index 9f56e6e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library NotLinkedAttribute.cs
-       MCS /t:library Bar.cs
-       MCS /t:library /r:Bar.dll /r:NotLinkedAttribute.dll Foo.cs
-       MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
-       MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
-       MCS /r:Foo.dll /r:Bar.dll /r:Baz.dll /r:NotLinkedAttribute Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs
deleted file mode 100644 (file)
index 5290344..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-using System;
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll
deleted file mode 100644 (file)
index 06929d0..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs
deleted file mode 100644 (file)
index 4e1debd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               p.Run ();
-
-               return 0;
-       }
-
-       void Run ()
-       {
-               Foo f = new Foo (new Bar ());
-               f.UseBar ();
-
-               Baz b = new Baz ();
-               b.Chain (f);
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe
deleted file mode 100644 (file)
index c8e7597..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.cs
deleted file mode 100644 (file)
index 1391162..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-public class Foo {
-}
-
-[NotLinked] public class Bar {
-
-       [NotLinked] public class Baz {
-
-               [NotLinked] public class Gazonk {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll
deleted file mode 100644 (file)
index 49151f1..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/NestedNested/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs
deleted file mode 100644 (file)
index 63a5ee7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-
-public class Foo {
-
-       public Foo ()
-       {
-               new NotRequiredButUsedNotPreserved ();
-               new NotRequiredButUsedAndFieldsPreserved ();
-       }
-}
-
-public class NotRequiredButUsedNotPreserved {
-
-       [NotLinked] public int foo;
-       [NotLinked] public int bar;
-}
-
-public class NotRequiredButUsedAndFieldsPreserved {
-
-       public int foo;
-       public int bar;
-
-       [NotLinked] public int FooBar ()
-       {
-               return foo + bar;
-       }
-}
-
-[NotLinked] public class NotRequiredAndNotUsed {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll
deleted file mode 100755 (executable)
index 941d6c3..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml
deleted file mode 100644 (file)
index 979d4e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-               <type fullname="NotRequiredButUsedNotPreserved" preserve="nothing" required="false" />
-               <type fullname="NotRequiredButUsedAndFieldsPreserved" preserve="fields" required="false" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs
deleted file mode 100644 (file)
index 6ca5a7f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace LibLib {
-
-       public class LibLibAttribute : Attribute {
-
-               public Type LibLibType {
-                       [NotLinked] get { return null; }
-                       set {}
-               }
-       }
-
-       public class BilBil {
-
-               [NotLinked] public BilBil ()
-               {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll
deleted file mode 100755 (executable)
index 2f1e457..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs
deleted file mode 100644 (file)
index cb3903f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using LibLib;
-
-public class BarAttribute : Attribute {
-
-       public BarAttribute ()
-       {
-       }
-
-       public BarAttribute (Type type)
-       {
-       }
-
-       public Type FieldType;
-
-       public Type PropertyType {
-               [NotLinked] get { return null; }
-               set {}
-       }
-}
-
-[Bar (typeof (Guy_A))]
-public class Foo {
-
-       [Bar (FieldType = typeof (Guy_B))]
-       public Foo a;
-
-       [Bar (PropertyType = typeof (Guy_C))]
-       public Foo b;
-
-       [LibLib (LibLibType = typeof (BilBil))]
-       public Foo c;
-
-       [LibLib (LibLibType = typeof (Guy_D))]
-       public Foo d;
-}
-
-public class Guy_A {
-
-       [NotLinked] public Guy_A ()
-       {
-       }
-}
-
-public class Guy_B {
-
-       [NotLinked] public Guy_B ()
-       {
-       }
-}
-
-public class Guy_C {
-
-       [NotLinked] public Guy_C ()
-       {
-       }
-}
-
-public class Guy_D {
-
-       [NotLinked] public Guy_D ()
-       {
-       }
-}
-
-[NotLinked] public class Baz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll
deleted file mode 100755 (executable)
index 7c5b997..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs
deleted file mode 100644 (file)
index 8b840b4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-using System;
-
-public class Foo {
-
-       public void Do ()
-       {
-               Bar b = new Baz ();
-               b.Bang ();
-       }
-}
-
-public class Bar {
-
-       public virtual void Bang ()
-       {
-       }
-}
-
-public class Baz : Bar {
-
-       private string _hey;
-
-       public string Hey {
-               [NotLinked] get { return _hey; }
-               [NotLinked] set { _hey = value; }
-       }
-
-       public override void Bang ()
-       {
-               Console.WriteLine (_hey);
-       }
-}
-
-[NotLinked] public class NotLinkedAttribute : Attribute {}
\ No newline at end of file
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll
deleted file mode 100644 (file)
index b56fa60..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml
deleted file mode 100644 (file)
index 0dd61b9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.cs
deleted file mode 100644 (file)
index 538205a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-
-public class Library {
-
-       private int _pouet;
-       [NotLinked] private int _hey;
-
-       public Library ()
-       {
-               _pouet = 1;
-       }
-
-       [NotLinked] public Library (int pouet)
-       {
-               _pouet = pouet;
-       }
-
-       public int Hello ()
-       {
-               Console.WriteLine ("Hello");
-               return _pouet;
-       }
-
-       [NotLinked] public void Hey (int hey)
-       {
-               _hey = hey;
-               Console.WriteLine (_hey);
-       }
-}
-
-
-[NotLinked] public class Toy {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll
deleted file mode 100644 (file)
index 5225e88..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Makefile
deleted file mode 100644 (file)
index 356b529..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
-       MCS /r:Library.dll Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.cs
deleted file mode 100644 (file)
index 6d3adb7..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               return p.Run ();
-       }
-
-       int Run ()
-       {
-               Library lib = new Library ();
-               return lib.Hello ();
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe
deleted file mode 100644 (file)
index 1605ce0..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/Simple/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.cs
deleted file mode 100644 (file)
index 4e81b42..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-
-public class Foo {
-
-       int _baz;
-       [NotLinked] int _shebang;
-
-       public Foo ()
-       {
-               _baz = 42;
-       }
-
-       public int Baz ()
-       {
-               return _baz;
-       }
-
-       [NotLinked] public int Shebang (int bang)
-       {
-               return _shebang = bang * 2;
-       }
-}
-
-public class Bar {
-
-       int _truc;
-
-       public Bar ()
-       {
-               _truc = 12;
-       }
-
-       public int Truc ()
-       {
-               return _truc;
-       }
-}
-
-[NotLinked] public class Gazonk {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll
deleted file mode 100644 (file)
index c37c059..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/Makefile
deleted file mode 100644 (file)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/SimpleXml/desc.xml
deleted file mode 100644 (file)
index 2a20ed3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo">
-                       <field signature="System.Int32 _baz" />
-                       <method signature="System.Void .ctor()" />
-                       <method signature="System.Int32 Baz()" />
-               </type>
-               <type fullname="Bar" />
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.cs
deleted file mode 100644 (file)
index b9c3f02..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-
-public class Library {
-
-       public Library ()
-       {
-       }
-
-       public int Shebang ()
-       {
-               return Bang ();
-       }
-
-       protected virtual int Bang ()
-       {
-               return 1;
-       }
-}
-
-
-public class PowerFulLibrary : Library {
-
-       protected override int Bang ()
-       {
-               return 0;
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll
deleted file mode 100644 (file)
index 0f2ff3f..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Makefile
deleted file mode 100644 (file)
index 356b529..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
-       MCS /r:Library.dll Program.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.cs
deleted file mode 100644 (file)
index 1d4a64d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-public class Program {
-
-       public static int Main ()
-       {
-               Program p = new Program ();
-               return p.Run ();
-       }
-
-       int Run ()
-       {
-               Library lib = new PowerFulLibrary ();
-               return lib.Shebang ();
-       }
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe b/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe
deleted file mode 100644 (file)
index f5a9bec..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/VirtualCall/Program.exe and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.cs
deleted file mode 100755 (executable)
index 7f14865..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-namespace Foo {
-
-       [NotLinked] public class BarBar {
-       }
-
-       public class FooBaz {
-
-               public FooBaz ()
-               {
-               }
-
-               [NotLinked] public void BarBaz ()
-               {
-               }
-       }
-
-       public class TrucBaz {
-
-               public TrucBaz ()
-               {
-               }
-       }
-
-       public class BazBaz {
-
-               public BazBaz ()
-               {
-               }
-       }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll
deleted file mode 100755 (executable)
index 80e7ef3..0000000
Binary files a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Library.dll and /dev/null differ
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/Makefile
deleted file mode 100755 (executable)
index 2e5bf5b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
-       MCS /t:library Library.cs
diff --git a/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml b/mcs/tools/linker/Tests/TestCases/Linker/XmlPattern/desc.xml
deleted file mode 100755 (executable)
index c8e1e23..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
-       <assembly fullname="Library">
-               <type fullname="Foo.*Baz">
-                       <method signature="System.Void .ctor()" />
-               </type>
-       </assembly>
-</linker>
diff --git a/mcs/tools/linker/Tests/TestCases/config.make b/mcs/tools/linker/Tests/TestCases/config.make
deleted file mode 100644 (file)
index 8323eb2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-MCS = mcs
-
diff --git a/mcs/tools/linker/configure b/mcs/tools/linker/configure
deleted file mode 100755 (executable)
index 2598cb6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-VERSION=0.1
-prefix=/usr/local
-while test x$1 != x; do
-        case $1 in
-                --prefix=*)
-                        prefix=`echo $1 | sed 's/--prefix=//'`
-                        ;;
-                --prefix)
-                        echo --prefix needs an argument: --prefix=directory >&2
-                        ;;
-                *)
-                        echo Unknown argument $1 >&2
-        esac
-        shift
-done
-
-echo "prefix=$prefix" > config.make
-echo "RUNTIME=mono" >> config.make
-echo "ASSEMBLY_VERSION=$VERSION.0.0" >> config.make
-echo "VERSION=$VERSION" >> config.make
-
-echo "monolinker has been configure to be installed in $prefix"
index 90b8ae0f7de28eb9055f40cbc8ac28d12ca99567..66410e5fe69bddfb2af8f759616b3291a8797308 100644 (file)
@@ -1,27 +1,27 @@
-./Mono.Linker/Pipeline.cs
-./Mono.Linker/AssemblyInfo.cs
-./Mono.Linker/AssemblyResolver.cs
-./Mono.Linker/TypePreserve.cs
-./Mono.Linker/Annotations.cs
-./Mono.Linker/LinkContext.cs
-./Mono.Linker/AssemblyAction.cs
-./Mono.Linker/Driver.cs
-./Mono.Linker/I18nAssemblies.cs
-./Mono.Linker/MethodAction.cs
-./Mono.Linker/XApiReader.cs
-./Mono.Linker/IXApiVisitor.cs
-./Mono.Linker.Steps/BaseStep.cs
-./Mono.Linker.Steps/LoadReferencesStep.cs
-./Mono.Linker.Steps/LoadI18nAssemblies.cs
-./Mono.Linker.Steps/ResolveFromXmlStep.cs
-./Mono.Linker.Steps/SweepStep.cs
-./Mono.Linker.Steps/RegenerateGuidStep.cs
-./Mono.Linker.Steps/ResolveFromXApiStep.cs
-./Mono.Linker.Steps/ResolveFromAssemblyStep.cs
-./Mono.Linker.Steps/ResolveStep.cs
-./Mono.Linker.Steps/CleanStep.cs
-./Mono.Linker.Steps/MarkStep.cs
-./Mono.Linker.Steps/BlacklistStep.cs
-./Mono.Linker.Steps/OutputStep.cs
-./Mono.Linker.Steps/TypeMapStep.cs
-./Mono.Linker.Steps/IStep.cs
+../../../external/linker/linker/Mono.Linker/Pipeline.cs
+../../../external/linker/linker/Mono.Linker/AssemblyInfo.cs
+../../../external/linker/linker/Mono.Linker/AssemblyResolver.cs
+../../../external/linker/linker/Mono.Linker/TypePreserve.cs
+../../../external/linker/linker/Mono.Linker/Annotations.cs
+../../../external/linker/linker/Mono.Linker/LinkContext.cs
+../../../external/linker/linker/Mono.Linker/AssemblyAction.cs
+../../../external/linker/linker/Mono.Linker/Driver.cs
+../../../external/linker/linker/Mono.Linker/I18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker/MethodAction.cs
+../../../external/linker/linker/Mono.Linker/XApiReader.cs
+../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
+../../../external/linker/linker/Mono.Linker.Steps/BaseStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadReferencesStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/LoadI18nAssemblies.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/SweepStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/RegenerateGuidStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromXApiStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveFromAssemblyStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/ResolveStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/CleanStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/MarkStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/BlacklistStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/OutputStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/TypeMapStep.cs
+../../../external/linker/linker/Mono.Linker.Steps/IStep.cs
diff --git a/mcs/tools/linker/monolinker.in b/mcs/tools/linker/monolinker.in
deleted file mode 100644 (file)
index 55e24cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mono $MONO_EXTRA_ARGS @prefix@/lib/mink/mink.exe "$@"
diff --git a/mcs/tools/linker/profiler/Makefile b/mcs/tools/linker/profiler/Makefile
deleted file mode 100644 (file)
index 6a9702b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-SRC = link.c
-OBJ = libmono-profiler-link.so
-
-all:
-       gcc -g -Wall -shared -o $(OBJ) $(SRC) `pkg-config --cflags --libs mono`
-
-clean:
-       rm -f $(OBJ)
diff --git a/mcs/tools/linker/profiler/link.c b/mcs/tools/linker/profiler/link.c
deleted file mode 100644 (file)
index f81e251..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * link.c: a profiler to help the static linker
- *
- * Authors:
- *   Jb Evain (jbevain@novell.com)
- *
- * (C) 2007 Novell, Inc. http://www.novell.com
- *
- */
-#include <glib.h>
-#include <string.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/class.h>
-#include <mono/metadata/image.h>
-#include <mono/metadata/metadata.h>
-#include <mono/metadata/profiler.h>
-
-struct _MonoProfiler {
-       const char *output_file;
-       GHashTable *images;
-};
-
-typedef struct _LinkedImage {
-       MonoImage *image;
-       GHashTable *types;
-} LinkedImage;
-
-typedef struct _LinkedType {
-       MonoClass *klass;
-       GHashTable *methods;
-} LinkedType;
-
-typedef struct _LinkedMethod {
-       MonoMethod *method;
-} LinkedMethod;
-
-static void
-link_append_class_name (GString *res, MonoClass *klass, gboolean include_namespace)
-{
-       if (!klass) {
-               g_string_append (res, "**unknown**");
-               return;
-       }
-
-       if (mono_class_get_nesting_type (klass)) {
-               link_append_class_name (res, mono_class_get_nesting_type (klass), include_namespace);
-               g_string_append_c (res, '/');
-       }
-
-       if (include_namespace && *(mono_class_get_namespace (klass)))
-               g_string_sprintfa (res, "%s.", mono_class_get_namespace (klass));
-
-       g_string_sprintfa (res, "%s", mono_class_get_name (klass));
-}
-
-static MonoType *
-link_get_element_type (MonoType *type)
-{
-       return mono_class_get_type (mono_class_get_element_class (mono_class_from_mono_type (type)));
-}
-
-static void
-link_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) {
-       switch (mono_type_get_type (type)) {
-       case MONO_TYPE_VOID:
-               g_string_append (res, "System.Void"); break;
-       case MONO_TYPE_CHAR:
-               g_string_append (res, "System.Char"); break;
-       case MONO_TYPE_BOOLEAN:
-               g_string_append (res, "System.Boolean"); break;
-       case MONO_TYPE_U1:
-               g_string_append (res, "System.Byte"); break;
-       case MONO_TYPE_I1:
-               g_string_append (res, "System.SByte"); break;
-       case MONO_TYPE_U2:
-               g_string_append (res, "System.UInt16"); break;
-       case MONO_TYPE_I2:
-               g_string_append (res, "System.Int16"); break;
-       case MONO_TYPE_U4:
-               g_string_append (res, "System.UInt32"); break;
-       case MONO_TYPE_I4:
-               g_string_append (res, "System.Int32"); break;
-       case MONO_TYPE_U8:
-               g_string_append (res, "System.UInt64"); break;
-       case MONO_TYPE_I8:
-               g_string_append (res, "System.Int64"); break;
-       case MONO_TYPE_FNPTR:
-               g_string_append (res, "*()"); break;
-       case MONO_TYPE_U:
-               g_string_append (res, "System.UIntPtr"); break;
-       case MONO_TYPE_I:
-               g_string_append (res, "System.IntPtr"); break;
-       case MONO_TYPE_R4:
-               g_string_append (res, "System.Single"); break;
-       case MONO_TYPE_R8:
-               g_string_append (res, "System.Double"); break;
-       case MONO_TYPE_STRING:
-               g_string_append (res, "System.String"); break;
-       case MONO_TYPE_OBJECT:
-               g_string_append (res, "System.Object"); break;
-       case MONO_TYPE_PTR:
-               link_type_get_desc (res, mono_type_get_ptr_type (type), include_namespace);
-               g_string_append_c (res, '*');
-               break;
-       case MONO_TYPE_ARRAY: {
-               MonoClass *eklass = mono_class_get_element_class (mono_class_from_mono_type (type));
-               link_type_get_desc (res, mono_class_get_type (eklass), include_namespace);
-               g_string_sprintfa (res, "[%d]", mono_class_get_rank (eklass));
-               break;
-       }
-       case MONO_TYPE_SZARRAY:
-               link_type_get_desc (res, link_get_element_type (type), include_namespace);
-               g_string_append (res, "[]");
-               break;
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_VALUETYPE:
-               link_append_class_name (res, mono_type_get_class (type), include_namespace);
-               break;
-       case MONO_TYPE_GENERICINST:
-               //link_type_get_desc (res, &type->data.generic_class->container_class->byval_arg, include_namespace);  /* ? */
-               break;
-       case MONO_TYPE_VAR:
-       case MONO_TYPE_MVAR:
-               //g_string_append (res, type->data.generic_param->name);  /* ? */
-               break;
-       default:
-               break;
-       }
-       if (mono_type_is_byref (type))
-               g_string_append (res, "&amp;");
-}
-
-static char *
-link_type_full_name (MonoType *type)
-{
-       GString *str;
-       char *res;
-
-       str = g_string_new ("");
-       link_type_get_desc (str, type, TRUE);
-
-       res = g_strdup (str->str);
-       g_string_free (str, TRUE);
-       return res;
-}
-
-static char *
-link_class_full_name (MonoClass *klass)
-{
-       return link_type_full_name (mono_class_get_type (klass));
-}
-
-static char *
-link_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace)
-{
-       int i;
-       char *result;
-       GString *res = g_string_new ("");
-
-       for (i = 0; i < sig->param_count; ++i) {
-               if (i > 0)
-                       g_string_append_c (res, ',');
-               link_type_get_desc (res, sig->params [i], include_namespace);
-       }
-       result = res->str;
-       g_string_free (res, FALSE);
-       return result;
-}
-
-static char *
-link_method_signature (MonoMethod *method)
-{
-       MonoMethodSignature *sig;
-       char *res;
-
-       sig = mono_method_signature (method);
-       char *tmpsig = link_signature_get_desc (sig, TRUE);
-       res = g_strdup_printf ("%s %s(%s)",
-               link_type_full_name (mono_signature_get_return_type (sig)),
-               mono_method_get_name (method), tmpsig);
-       g_free (tmpsig);
-
-       return res;
-}
-
-static char *
-link_image_fullname (MonoImage *image)
-{
-       MonoAssemblyName *name;
-       char *res;
-
-       name = g_new0 (MonoAssemblyName, 1);
-       mono_assembly_fill_assembly_name (image, name);
-       res = mono_stringify_assembly_name (name);
-       g_free (name);
-       return res;
-}
-
-static LinkedType *
-link_get_linked_type (LinkedImage *limage, MonoClass *klass)
-{
-       LinkedType *ltype;
-
-       ltype = (LinkedType *) g_hash_table_lookup (limage->types, klass);
-
-       if (ltype)
-               return ltype;
-
-       ltype = g_new0 (LinkedType, 1);
-       ltype->klass = klass;
-       ltype->methods = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (limage->types, klass, ltype);
-       return ltype;
-}
-
-static LinkedImage *
-link_get_linked_image (MonoProfiler *prof, MonoImage *image)
-{
-       LinkedImage *limage;
-
-       limage = (LinkedImage *) g_hash_table_lookup (prof->images, image);
-
-       if (limage)
-               return limage;
-
-       limage = g_new0 (LinkedImage, 1);
-       limage->image = image;
-       limage->types = g_hash_table_new (NULL, NULL);
-       g_hash_table_insert (prof->images, image, limage);
-       return limage;
-}
-
-static void
-link_method_leave (MonoProfiler *prof, MonoMethod *method)
-{
-       MonoClass *klass;
-       MonoImage *image;
-
-       LinkedType *ltype;
-       LinkedImage *limage;
-       LinkedMethod *lmethod;
-
-       klass = mono_method_get_class (method);
-       image = mono_class_get_image (klass);
-
-       limage = link_get_linked_image (prof, image);
-       ltype = link_get_linked_type (limage, klass);
-
-       lmethod = (LinkedMethod *) g_hash_table_lookup (ltype->methods, method);
-       if (lmethod)
-               return;
-
-       lmethod = g_new0 (LinkedMethod, 1);
-       lmethod->method = method;
-       g_hash_table_insert (ltype->methods, method, lmethod);
-}
-
-static void
-link_free_member (gpointer key, gpointer value, gpointer data)
-{
-       g_free (value);
-}
-
-static void
-link_free_type (gpointer key, gpointer value, gpointer data)
-{
-       LinkedType *type = (LinkedType *) value;
-
-       g_hash_table_foreach (type->methods, link_free_member, NULL);
-       g_free (type);
-}
-
-static void
-link_free_image (gpointer key, gpointer value, gpointer data)
-{
-       LinkedImage *image = (LinkedImage *) value;
-
-       g_hash_table_foreach (image->types, link_free_type, NULL);
-       g_free (image);
-}
-
-static void
-link_print_method (gpointer key, gpointer value, gpointer data)
-{
-       LinkedMethod *lmethod = (LinkedMethod *) value;
-       FILE *output = (FILE *) data;
-       char *signature;
-
-       signature = link_method_signature (lmethod->method);
-       fprintf (output, "\t\t\t<method signature=\"%s\" />\n", signature);
-       g_free (signature);
-}
-
-static void
-link_print_type (gpointer key, gpointer value, gpointer data)
-{
-       LinkedType *ltype = (LinkedType *) value;
-       FILE *output = (FILE *) data;
-       char *fullname;
-
-       fullname = link_class_full_name (ltype->klass);
-       fprintf (output, "\t\t<type fullname=\"%s\">\n", fullname);
-       g_free (fullname);
-
-       g_hash_table_foreach (ltype->methods, link_print_method, output);
-       fprintf (output, "\t\t</type>\n");
-}
-
-static void
-link_print_image (gpointer key, gpointer value, gpointer data)
-{
-       LinkedImage *limage = (LinkedImage *) value;
-       FILE *output = (FILE *) data;
-       char *fullname;
-
-       fullname = link_image_fullname (limage->image);
-       fprintf (output, "\t<assembly fullname=\"%s\">\n", fullname);
-       g_free (fullname);
-       g_hash_table_foreach (limage->types, link_print_type, output);
-       fprintf (output, "\t</assembly>\n");
-}
-
-static void
-link_print_tree (MonoProfiler *prof)
-{
-       FILE *output;
-
-       output = fopen (prof->output_file, "w");
-       fprintf (output, "<linker>\n");
-       g_hash_table_foreach (prof->images, link_print_image, output);
-       fprintf (output, "</linker>\n");
-       fclose (output);
-}
-
-static void
-link_shutdown (MonoProfiler *prof)
-{
-       link_print_tree (prof);
-       g_hash_table_foreach (prof->images, link_free_image, NULL);
-       g_free (prof);
-}
-
-void
-mono_profiler_startup (const char *desc)
-{
-       MonoProfiler *prof;
-
-       prof = g_new0 (MonoProfiler, 1);
-
-       if (strncmp ("link:", desc, 5) == 0 && desc [5])
-               prof->output_file = g_strdup (desc + 5);
-       else
-               prof->output_file = "link.xml";
-
-       prof->images = g_hash_table_new (NULL, NULL);
-
-       mono_profiler_install (prof, link_shutdown);
-
-       mono_profiler_install_enter_leave (NULL, link_method_leave);
-
-       mono_profiler_set_events (MONO_PROFILE_ENTER_LEAVE);
-}
diff --git a/mcs/tools/linker/standalone.make b/mcs/tools/linker/standalone.make
deleted file mode 100644 (file)
index f444215..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-
-MCS = mcs
-KEY_FILE = ../../class/mono.snk
-MONO.CECIL.DLL = Mono.Cecil.dll
-MCS_FLAGS = -debug -keyfile:$(KEY_FILE) -r:$(MONO.CECIL.DLL) -resource:Descriptors/mscorlib.xml -resource:Descriptors/System.xml -resource:Descriptors/System.Web.xml -resource:Descriptors/Mono.Posix.xml -resource:Descriptors/System.Drawing.xml
-LINKER = monolinker.exe
-
-all: config.make monolinker.exe monolinker
-
-monolinker: monolinker.in Makefile
-       sed "s,@prefix@,$(prefix)," < monolinker.in > monolinker
-       chmod +x monolinker
-
-monolinker.exe: Mono.Cecil.dll
-       $(MCS) $(MCS_FLAGS) @$(LINKER).sources /out:$(LINKER)
-
-Mono.Cecil.dll:
-       if pkg-config --atleast-version=0.5 mono-cecil; then \
-               cp `pkg-config --variable=Libraries mono-cecil` .; \
-       else \
-               echo You must install Mono.Cecil first; \
-               exit 1; \
-       fi
-
-clean:
-       rm -f $(LINKER) $(MONO.CECIL.DLL) monolinker
-
-install: all
-       mkdir -p $(prefix)/bin
-       mkdir -p $(prefix)/lib/monolinker
-       cp $(LINKER) $(MONO.CECIL.DLL) $(prefix)/lib/monolinker
-       cp monolinker $(prefix)/bin
-       cp man/monolinker.1 $(prefix)/share/man/man1
-
-config.make:
-       echo You must run configure first
-       exit 1
-
-include config.make
-
-run-test: all
-       cd ./Tests; \
-       make clean run-test; \
-       cd ..;
diff --git a/mcs/tools/tuner/Makefile b/mcs/tools/tuner/Makefile
deleted file mode 100644 (file)
index c364223..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-thisdir = tools/tuner
-SUBDIRS =
-DEP_DIRS = linker
-include ../../build/rules.make
-
-LOCAL_MCS_FLAGS = -r:$(topdir)/class/lib/$(PROFILE)/monolinker.exe
-LIB_REFS = System System.Core System.Xml Mono.Cecil
-
-LIBRARY = Mono.Tuner.dll
-
-NO_INSTALL = yes
-NO_TEST = yes
-NO_SIGN_ASSEMBLY = yes
-
-include ../../build/library.make
diff --git a/mcs/tools/tuner/Mono.Tuner-net_4_x.csproj b/mcs/tools/tuner/Mono.Tuner-net_4_x.csproj
deleted file mode 100644 (file)
index a681051..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{8CCE7044-3466-4599-B09E-9F8E0C2F4614}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>Mono.Tuner</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-  \r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="Mono.Tuner\AdjustVisibility.cs" />\r
-    <Compile Include="Mono.Tuner\CheckVisibility.cs" />\r
-    <Compile Include="Mono.Tuner\FilterAttributes.cs" />\r
-    <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />\r
-    <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />\r
-    <Compile Include="Mono.Tuner\PrintStatus.cs" />\r
-    <Compile Include="Mono.Tuner\RemoveSerialization.cs" />\r
-    <Compile Include="Mono.Tuner\TunerAnnotations.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../linker/monolinker-net_4_x.csproj">\r
-      <Project>{FA920637-C202-4E75-AC0F-1A8DBD631DF1}</Project>\r
-      <Name>monolinker-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System.Core/System.Core-net_4_x.csproj">\r
-      <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
-      <Name>System.Core-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System.XML/System.Xml-net_4_x.csproj">\r
-      <Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>\r
-      <Name>System.Xml-net_4_x</Name>\r
-    </ProjectReference>\r
-    <Reference Include="./../../class/lib/net_4_x/Mono.Cecil.dll">\r
-      <SpecificVersion>False</SpecificVersion>\r
-      <HintPath>./../../class/lib/net_4_x/Mono.Cecil.dll</HintPath>\r
-      <Private>False</Private>\r
-    </Reference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/tools/tuner/Mono.Tuner.csproj b/mcs/tools/tuner/Mono.Tuner.csproj
deleted file mode 100644 (file)
index fd5e22d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{E97429BA-279A-4C1D-AE8A-8BD878C661D1}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Tuner</RootNamespace>
-    <AssemblyName>Mono.Tuner</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>True</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>False</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>True</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Tuner\AdjustVisibility.cs" />
-    <Compile Include="Mono.Tuner\CheckVisibility.cs" />
-    <Compile Include="Mono.Tuner\PrintStatus.cs" />
-    <Compile Include="Mono.Tuner\RemoveSerialization.cs" />
-    <Compile Include="Mono.Tuner\TunerAnnotations.cs" />
-    <Compile Include="Mono.Tuner\InjectSecurityAttributes.cs" />
-    <Compile Include="Mono.Tuner\MoonlightAssemblyStep.cs" />
-    <Compile Include="Mono.Tuner\FilterAttributes.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yProcessor.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yAssemblyStep.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yUsageInspectionStep.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yDescriptorGenerator.cs" />
-    <Compile Include="Mono.Tuner\MoonlightA11yApiMarker.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <!-- 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">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <None Include="Makefile" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\linker\Mono.Linker.csproj">
-      <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
-      <Name>Mono.Linker</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\..\..\external\cecil\Mono.Cecil.csproj">
-      <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
-      <Name>Mono.Cecil</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/mcs/tools/tuner/Mono.Tuner.dll.sources b/mcs/tools/tuner/Mono.Tuner.dll.sources
deleted file mode 100644 (file)
index cca968b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Mono.Tuner/TunerAnnotations.cs
-Mono.Tuner/PrintStatus.cs
-Mono.Tuner/RemoveSerialization.cs
-Mono.Tuner/AdjustVisibility.cs
-Mono.Tuner/CheckVisibility.cs
-Mono.Tuner/InjectSecurityAttributes.cs
-Mono.Tuner/MoonlightA11yApiMarker.cs
-Mono.Tuner/MoonlightA11yAssemblyStep.cs
-Mono.Tuner/MoonlightA11yDescriptorGenerator.cs
-Mono.Tuner/MoonlightA11yProcessor.cs
-Mono.Tuner/MoonlightA11yUsageInspectionStep.cs
-Mono.Tuner/MoonlightAssemblyStep.cs
-Mono.Tuner/FilterAttributes.cs
diff --git a/mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs b/mcs/tools/tuner/Mono.Tuner/AdjustVisibility.cs
deleted file mode 100644 (file)
index 6b684b6..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// AdjustVisibilityStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class AdjustVisibility : BaseStep {
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       ProcessTypes (assembly.MainModule.Types);
-               }
-
-               void ProcessTypes (ICollection types)
-               {
-                       foreach (TypeDefinition type in types)
-                               ProcessType (type);
-               }
-
-               void ProcessType (TypeDefinition type)
-               {
-                       if (!IsPublic (type))
-                               return;
-
-                       if (!IsMarkedAsPublic (type)) {
-                               SetInternalVisibility (type);
-                               return;
-                       }
-
-                       if (type.IsEnum)
-                               return;
-
-                       ProcessFields (type.Fields);
-                       ProcessMethods (type.Methods);
-               }
-
-               static bool IsPublic (TypeDefinition type)
-               {
-                       return type.DeclaringType == null ? type.IsPublic : type.IsNestedPublic;
-               }
-
-               void SetInternalVisibility (TypeDefinition type)
-               {
-                       type.Attributes &= ~TypeAttributes.VisibilityMask;
-                       if (type.DeclaringType == null)
-                               type.Attributes |= TypeAttributes.NotPublic;
-                       else
-                               type.Attributes |= TypeAttributes.NestedAssembly;
-
-                       MarkInternalized (type);
-               }
-
-               void ProcessMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               ProcessMethod (method);
-               }
-
-               void ProcessMethod (MethodDefinition method)
-               {
-                       if (IsMarkedAsPublic (method))
-                               return;
-
-                       if (method.IsPublic)
-                               SetInternalVisibility (method);
-                       else if (method.IsFamily || method.IsFamilyOrAssembly)
-                               SetProtectedAndInternalVisibility (method);
-               }
-
-               void SetInternalVisibility (MethodDefinition method)
-               {
-                       method.Attributes &= ~MethodAttributes.MemberAccessMask;
-                       method.Attributes |= MethodAttributes.Assembly;
-
-                       MarkInternalized (method);
-               }
-
-               void SetProtectedAndInternalVisibility (MethodDefinition method)
-               {
-                       method.Attributes &= ~MethodAttributes.MemberAccessMask;
-                       method.Attributes |= MethodAttributes.FamANDAssem;
-
-                       MarkInternalized (method);
-               }
-
-               bool IsMarkedAsPublic (IMetadataTokenProvider provider)
-               {
-                       return Annotations.IsPublic (provider);
-               }
-
-               void ProcessFields (IEnumerable<FieldDefinition> fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               ProcessField (field);
-               }
-
-               void ProcessField (FieldDefinition field)
-               {
-                       if (IsMarkedAsPublic (field))
-                               return;
-
-                       if (field.IsPublic)
-                               SetInternalVisibility (field);
-                       else if (field.IsFamily || field.IsFamilyOrAssembly)
-                               SetProtectedAndInternalVisibility (field);
-               }
-
-               void SetInternalVisibility (FieldDefinition field)
-               {
-                       field.Attributes &= ~FieldAttributes.FieldAccessMask;
-                       field.Attributes |= FieldAttributes.Assembly;
-
-                       MarkInternalized (field);
-               }
-
-               void SetProtectedAndInternalVisibility (FieldDefinition field)
-               {
-                       field.Attributes &= ~FieldAttributes.FieldAccessMask;
-                       field.Attributes |= FieldAttributes.FamANDAssem;
-
-                       MarkInternalized (field);
-               }
-
-               void MarkInternalized (IMetadataTokenProvider provider)
-               {
-                       TunerAnnotations.Internalized (Context, provider);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs b/mcs/tools/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs
deleted file mode 100644 (file)
index 6a910a9..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class ApplyPreserveAttributeBase : BaseSubStep {
-
-               // set 'removeAttribute' to true if you want the preserved attribute to be removed from the final assembly
-               protected abstract bool IsPreservedAttribute (ICustomAttributeProvider provider, CustomAttribute attribute, out bool removeAttribute);
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Type
-                                       | SubStepTargets.Field
-                                       | SubStepTargets.Method
-                                       | SubStepTargets.Property
-                                       | SubStepTargets.Event;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return !Profile.IsSdkAssembly (assembly) && Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       TryApplyPreserveAttribute (type);
-               }
-
-               public override void ProcessField (FieldDefinition field)
-               {
-                       foreach (var attribute in GetPreserveAttributes (field))
-                               Mark (field, attribute);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       MarkMethodIfPreserved (method);
-               }
-
-               public override void ProcessProperty (PropertyDefinition property)
-               {
-                       foreach (var attribute in GetPreserveAttributes (property)) {
-                               MarkMethod (property.GetMethod, attribute);
-                               MarkMethod (property.SetMethod, attribute);
-                       }
-               }
-
-               public override void ProcessEvent (EventDefinition @event)
-               {
-                       foreach (var attribute in GetPreserveAttributes (@event)) {
-                               MarkMethod (@event.AddMethod, attribute);
-                               MarkMethod (@event.InvokeMethod, attribute);
-                               MarkMethod (@event.RemoveMethod, attribute);
-                       }
-               }
-
-               void MarkMethodIfPreserved (MethodDefinition method)
-               {
-                       foreach (var attribute in GetPreserveAttributes (method)) 
-                               MarkMethod (method, attribute);
-               }
-
-               void MarkMethod (MethodDefinition method, CustomAttribute preserve_attribute)
-               {
-                       if (method == null)
-                               return;
-
-                       Mark (method, preserve_attribute);
-                       Annotations.SetAction (method, MethodAction.Parse);
-               }
-
-               void Mark (IMetadataTokenProvider provider, CustomAttribute preserve_attribute)
-               {
-                       if (IsConditionalAttribute (preserve_attribute)) {
-                               PreserveConditional (provider);
-                               return;
-                       }
-
-                       PreserveUnconditional (provider);
-               }
-
-               void PreserveConditional (IMetadataTokenProvider provider)
-               {
-                       var method = provider as MethodDefinition;
-                       if (method == null) {
-                               // workaround to support (uncommon but valid) conditional fields form [Preserve]
-                               PreserveUnconditional (provider);
-                               return;
-                       }
-
-                       Annotations.AddPreservedMethod (method.DeclaringType, method);
-               }
-
-               static bool IsConditionalAttribute (CustomAttribute attribute)
-               {
-                       if (attribute == null)
-                               return false;
-
-                       foreach (var named_argument in attribute.Fields)
-                               if (named_argument.Name == "Conditional")
-                                       return (bool) named_argument.Argument.Value;
-
-                       return false;
-               }
-
-               void PreserveUnconditional (IMetadataTokenProvider provider)
-               {
-                       Annotations.Mark (provider);
-
-                       var member = provider as IMemberDefinition;
-                       if (member == null || member.DeclaringType == null)
-                               return;
-
-                       Mark (member.DeclaringType, null);
-               }
-
-               void TryApplyPreserveAttribute (TypeDefinition type)
-               {
-                       foreach (var attribute in GetPreserveAttributes (type)) {
-                               Annotations.Mark (type);
-
-                               if (!attribute.HasFields)
-                                       continue;
-                               foreach (var named_argument in attribute.Fields)
-                                       if (named_argument.Name == "AllMembers" && (bool)named_argument.Argument.Value)
-                                               Annotations.SetPreserve (type, TypePreserve.All);
-                       }
-               }
-
-               List<CustomAttribute> GetPreserveAttributes (ICustomAttributeProvider provider)
-               {
-                       List<CustomAttribute> attrs = new List<CustomAttribute> ();
-
-                       if (!provider.HasCustomAttributes)
-                               return attrs;
-
-                       var attributes = provider.CustomAttributes;
-
-                       for (int i = attributes.Count - 1; i >= 0; i--) {
-                               var attribute = attributes [i];
-
-                               bool remote_attribute;
-                               if (!IsPreservedAttribute (provider, attribute, out remote_attribute))
-                                       continue;
-
-                               attrs.Add (attribute);
-                               if (remote_attribute)
-                                       attributes.RemoveAt (i);
-                       }
-
-                       return attrs;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CecilRocks.cs b/mcs/tools/tuner/Mono.Tuner/CecilRocks.cs
deleted file mode 100644 (file)
index 6995859..0000000
+++ /dev/null
@@ -1,519 +0,0 @@
-//
-// MethodBodyRocks.cs
-//
-// Author:
-//   Jb Evain (jbevain@gmail.com)
-//
-// Copyright (c) 2008 - 2011 Jb Evain
-//
-// 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.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public static class MethodBodyRocks {
-
-               public static IEnumerable<TypeDefinition> GetAllTypes (this ModuleDefinition self)
-               {
-                       return self.Types.SelectMany (t => t.GetAllTypes ());
-               }
-
-               static IEnumerable<TypeDefinition> GetAllTypes (this TypeDefinition self)
-               {
-                       yield return self;
-
-                       if (!self.HasNestedTypes)
-                               yield break;
-
-                       foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ()))
-                               yield return type;
-               }
-
-               public static IEnumerable<MethodDefinition> GetMethods (this TypeDefinition self)
-               {
-                       return self.Methods.Where (m => !m.IsConstructor);
-               }
-
-               public static IEnumerable<MethodDefinition> GetConstructors (this TypeDefinition self)
-               {
-                       return self.Methods.Where (m => m.IsConstructor);
-               }
-
-               public static MethodDefinition GetTypeConstructor (this TypeDefinition self)
-               {
-                       return self.GetConstructors ().FirstOrDefault (c => c.IsStatic);
-               }
-
-               public static void SimplifyMacros (this MethodBody self)
-               {
-                       if (self == null)
-                               throw new ArgumentNullException ("self");
-
-                       foreach (var instruction in self.Instructions) {
-                               if (instruction.OpCode.OpCodeType != OpCodeType.Macro)
-                                       continue;
-
-                               switch (instruction.OpCode.Code) {
-                               case Code.Ldarg_0:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (0));
-                                       break;
-                               case Code.Ldarg_1:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (1));
-                                       break;
-                               case Code.Ldarg_2:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (2));
-                                       break;
-                               case Code.Ldarg_3:
-                                       ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (3));
-                                       break;
-                               case Code.Ldloc_0:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [0]);
-                                       break;
-                               case Code.Ldloc_1:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [1]);
-                                       break;
-                               case Code.Ldloc_2:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [2]);
-                                       break;
-                               case Code.Ldloc_3:
-                                       ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [3]);
-                                       break;
-                               case Code.Stloc_0:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [0]);
-                                       break;
-                               case Code.Stloc_1:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [1]);
-                                       break;
-                               case Code.Stloc_2:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [2]);
-                                       break;
-                               case Code.Stloc_3:
-                                       ExpandMacro (instruction, OpCodes.Stloc, self.Variables [3]);
-                                       break;
-                               case Code.Ldarg_S:
-                                       instruction.OpCode = OpCodes.Ldarg;
-                                       break;
-                               case Code.Ldarga_S:
-                                       instruction.OpCode = OpCodes.Ldarga;
-                                       break;
-                               case Code.Starg_S:
-                                       instruction.OpCode = OpCodes.Starg;
-                                       break;
-                               case Code.Ldloc_S:
-                                       instruction.OpCode = OpCodes.Ldloc;
-                                       break;
-                               case Code.Ldloca_S:
-                                       instruction.OpCode = OpCodes.Ldloca;
-                                       break;
-                               case Code.Stloc_S:
-                                       instruction.OpCode = OpCodes.Stloc;
-                                       break;
-                               case Code.Ldc_I4_M1:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, -1);
-                                       break;
-                               case Code.Ldc_I4_0:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 0);
-                                       break;
-                               case Code.Ldc_I4_1:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 1);
-                                       break;
-                               case Code.Ldc_I4_2:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 2);
-                                       break;
-                               case Code.Ldc_I4_3:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 3);
-                                       break;
-                               case Code.Ldc_I4_4:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 4);
-                                       break;
-                               case Code.Ldc_I4_5:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 5);
-                                       break;
-                               case Code.Ldc_I4_6:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 6);
-                                       break;
-                               case Code.Ldc_I4_7:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 7);
-                                       break;
-                               case Code.Ldc_I4_8:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, 8);
-                                       break;
-                               case Code.Ldc_I4_S:
-                                       ExpandMacro (instruction, OpCodes.Ldc_I4, (int) (sbyte) instruction.Operand);
-                                       break;
-                               case Code.Br_S:
-                                       instruction.OpCode = OpCodes.Br;
-                                       break;
-                               case Code.Brfalse_S:
-                                       instruction.OpCode = OpCodes.Brfalse;
-                                       break;
-                               case Code.Brtrue_S:
-                                       instruction.OpCode = OpCodes.Brtrue;
-                                       break;
-                               case Code.Beq_S:
-                                       instruction.OpCode = OpCodes.Beq;
-                                       break;
-                               case Code.Bge_S:
-                                       instruction.OpCode = OpCodes.Bge;
-                                       break;
-                               case Code.Bgt_S:
-                                       instruction.OpCode = OpCodes.Bgt;
-                                       break;
-                               case Code.Ble_S:
-                                       instruction.OpCode = OpCodes.Ble;
-                                       break;
-                               case Code.Blt_S:
-                                       instruction.OpCode = OpCodes.Blt;
-                                       break;
-                               case Code.Bne_Un_S:
-                                       instruction.OpCode = OpCodes.Bne_Un;
-                                       break;
-                               case Code.Bge_Un_S:
-                                       instruction.OpCode = OpCodes.Bge_Un;
-                                       break;
-                               case Code.Bgt_Un_S:
-                                       instruction.OpCode = OpCodes.Bgt_Un;
-                                       break;
-                               case Code.Ble_Un_S:
-                                       instruction.OpCode = OpCodes.Ble_Un;
-                                       break;
-                               case Code.Blt_Un_S:
-                                       instruction.OpCode = OpCodes.Blt_Un;
-                                       break;
-                               case Code.Leave_S:
-                                       instruction.OpCode = OpCodes.Leave;
-                                       break;
-                               }
-                       }
-               }
-
-               static void ExpandMacro (Instruction instruction, OpCode opcode, object operand)
-               {
-                       instruction.OpCode = opcode;
-                       instruction.Operand = operand;
-               }
-
-               static void MakeMacro (Instruction instruction, OpCode opcode)
-               {
-                       instruction.OpCode = opcode;
-                       instruction.Operand = null;
-               }
-
-               public static void OptimizeMacros (this MethodBody self)
-               {
-                       if (self == null)
-                               throw new ArgumentNullException ("self");
-
-                       var method = self.Method;
-
-                       foreach (var instruction in self.Instructions) {
-                               int index;
-                               switch (instruction.OpCode.Code) {
-                               case Code.Ldarg:
-                                       index = ((ParameterDefinition) instruction.Operand).Index;
-                                       if (index == -1 && instruction.Operand == self.ThisParameter)
-                                               index = 0;
-                                       else if (method.HasThis)
-                                               index++;
-
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldarg_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldarg_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldarg_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldarg_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Ldarg_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Ldloc:
-                                       index = ((VariableDefinition) instruction.Operand).Index;
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldloc_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldloc_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldloc_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldloc_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Ldloc_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Stloc:
-                                       index = ((VariableDefinition) instruction.Operand).Index;
-                                       switch (index) {
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Stloc_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Stloc_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Stloc_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Stloc_3);
-                                               break;
-                                       default:
-                                               if (index < 256)
-                                                       ExpandMacro (instruction, OpCodes.Stloc_S, instruction.Operand);
-                                               break;
-                                       }
-                                       break;
-                               case Code.Ldarga:
-                                       index = ((ParameterDefinition) instruction.Operand).Index;
-                                       if (index == -1 && instruction.Operand == self.ThisParameter)
-                                               index = 0;
-                                       else if (method.HasThis)
-                                               index++;
-                                       if (index < 256)
-                                               ExpandMacro (instruction, OpCodes.Ldarga_S, instruction.Operand);
-                                       break;
-                               case Code.Ldloca:
-                                       if (((VariableDefinition) instruction.Operand).Index < 256)
-                                               ExpandMacro (instruction, OpCodes.Ldloca_S, instruction.Operand);
-                                       break;
-                               case Code.Ldc_I4:
-                                       int i = (int) instruction.Operand;
-                                       switch (i) {
-                                       case -1:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_M1);
-                                               break;
-                                       case 0:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_0);
-                                               break;
-                                       case 1:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_1);
-                                               break;
-                                       case 2:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_2);
-                                               break;
-                                       case 3:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_3);
-                                               break;
-                                       case 4:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_4);
-                                               break;
-                                       case 5:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_5);
-                                               break;
-                                       case 6:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_6);
-                                               break;
-                                       case 7:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_7);
-                                               break;
-                                       case 8:
-                                               MakeMacro (instruction, OpCodes.Ldc_I4_8);
-                                               break;
-                                       default:
-                                               if (i >= -128 && i < 128)
-                                                       ExpandMacro (instruction, OpCodes.Ldc_I4_S, (sbyte) i);
-                                               break;
-                                       }
-                                       break;
-                               }
-                       }
-
-                       OptimizeBranches (self);
-               }
-
-               static void OptimizeBranches (MethodBody body)
-               {
-                       ComputeOffsets (body);
-
-                       foreach (var instruction in body.Instructions) {
-                               if (instruction.OpCode.OperandType != OperandType.InlineBrTarget)
-                                       continue;
-
-                               if (OptimizeBranch (instruction))
-                                       ComputeOffsets (body);
-                       }
-               }
-
-               static bool OptimizeBranch (Instruction instruction)
-               {
-                       var offset = ((Instruction) instruction.Operand).Offset - (instruction.Offset + instruction.OpCode.Size + 4);
-                       if (!(offset >= -128 && offset <= 127))
-                               return false;
-
-                       switch (instruction.OpCode.Code) {
-                       case Code.Br:
-                               instruction.OpCode = OpCodes.Br_S;
-                               break;
-                       case Code.Brfalse:
-                               instruction.OpCode = OpCodes.Brfalse_S;
-                               break;
-                       case Code.Brtrue:
-                               instruction.OpCode = OpCodes.Brtrue_S;
-                               break;
-                       case Code.Beq:
-                               instruction.OpCode = OpCodes.Beq_S;
-                               break;
-                       case Code.Bge:
-                               instruction.OpCode = OpCodes.Bge_S;
-                               break;
-                       case Code.Bgt:
-                               instruction.OpCode = OpCodes.Bgt_S;
-                               break;
-                       case Code.Ble:
-                               instruction.OpCode = OpCodes.Ble_S;
-                               break;
-                       case Code.Blt:
-                               instruction.OpCode = OpCodes.Blt_S;
-                               break;
-                       case Code.Bne_Un:
-                               instruction.OpCode = OpCodes.Bne_Un_S;
-                               break;
-                       case Code.Bge_Un:
-                               instruction.OpCode = OpCodes.Bge_Un_S;
-                               break;
-                       case Code.Bgt_Un:
-                               instruction.OpCode = OpCodes.Bgt_Un_S;
-                               break;
-                       case Code.Ble_Un:
-                               instruction.OpCode = OpCodes.Ble_Un_S;
-                               break;
-                       case Code.Blt_Un:
-                               instruction.OpCode = OpCodes.Blt_Un_S;
-                               break;
-                       case Code.Leave:
-                               instruction.OpCode = OpCodes.Leave_S;
-                               break;
-                       }
-
-                       return true;
-               }
-
-               static void ComputeOffsets (MethodBody body)
-               {
-                       var offset = 0;
-                       foreach (var instruction in body.Instructions) {
-                               instruction.Offset = offset;
-                               offset += instruction.GetSize ();
-                       }
-               }
-
-               public static ParameterDefinition GetParameter (this MethodBody self, int index)
-               {
-                       var method = self.Method;
-
-                       if (method.HasThis) {
-                               if (index == 0)
-                                       return self.ThisParameter;
-
-                               index--;
-                       }
-
-                       var parameters = method.Parameters;
-
-                       if (index < 0 || index >= parameters.Count)
-                               return null;
-
-                       return parameters [index];
-               }
-
-               public static bool Implements (this TypeReference self, string interfaceName)
-               {
-                       if (interfaceName == null)
-                               throw new ArgumentNullException ("interfaceName");
-                       if (self == null)
-                               return false;
-
-                       TypeDefinition type = self.Resolve ();
-                       if (type == null)
-                               return false;   // not enough information available
-
-                       // special case, check if we implement ourselves
-                       if (type.IsInterface && (type.FullName == interfaceName))
-                               return true;
-
-                       return Implements (type, interfaceName, (interfaceName.IndexOf ('`') >= 0));
-               }
-
-               public static bool Implements (TypeDefinition type, string interfaceName, bool generic)
-               {
-                       while (type != null) {
-                               // does the type implements it itself
-                               if (type.HasInterfaces) {
-                                       foreach (var iface in type.Interfaces) {
-                                               string fullname = (generic) ? iface.InterfaceType.GetElementType ().FullName : iface.InterfaceType.FullName;
-                                               if (fullname == interfaceName)
-                                                       return true;
-                                               //if not, then maybe one of its parent interfaces does
-                                               if (Implements (iface.InterfaceType.Resolve (), interfaceName, generic))
-                                                       return true;
-                                       }
-                               }
-
-                               type = type.BaseType != null ? type.BaseType.Resolve () : null;
-                       }
-                       return false;
-               }
-
-               public static bool Inherits (this TypeReference self, string @namespace, string name)
-               {
-                       if (@namespace == null)
-                               throw new ArgumentNullException ("namespace");
-                       if (name == null)
-                               throw new ArgumentNullException ("name");
-                       if (self == null)
-                               return false;
-                       
-                       TypeReference current = self.Resolve ();
-                       while (current != null) {
-                               if (current.Is (@namespace, name))
-                                       return true;
-                               if (current.Is ("System", "Object"))
-                                       return false;
-                               
-                               TypeDefinition td = current.Resolve ();
-                               if (td == null)
-                                       return false;           // could not resolve type
-                               current = td.BaseType;
-                       }
-                       return false;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs b/mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs
deleted file mode 100644 (file)
index df553db..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-//
-// CheckVisibility.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class CheckVisibility : BaseStep {
-
-               bool throw_on_error;
-
-               protected override void Process ()
-               {
-                       throw_on_error = GetThrowOnVisibilityErrorParameter ();
-               }
-
-               bool GetThrowOnVisibilityErrorParameter ()
-               {
-                       try {
-                               return bool.Parse (Context.GetParameter ("throw_on_visibility_error"));
-                       } catch {
-                               return false;
-                       }
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "mscorlib" || assembly.Name.Name == "smcs")
-                               return;
-
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Report ("in assembly {0}", assembly.Name);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               foreach (TypeDefinition type in module.Types)
-                                       CheckType (type);
-               }
-
-               void CheckType (TypeDefinition type)
-               {
-                       if (!IsVisibleFrom (type, type.BaseType)) {
-                               ReportError ("Base type `{0}` of type `{1}` is not visible",
-                                       type.BaseType, type);
-                       }
-
-                       CheckInterfaces (type);
-
-                       CheckFields (type);
-                       CheckMethods (type);
-               }
-
-               void CheckInterfaces (TypeDefinition type)
-               {
-                       foreach (var iface in type.Interfaces) {
-                               if (!IsVisibleFrom (type, iface.InterfaceType)) {
-                                       ReportError ("Interface `{0}` implemented by `{1}` is not visible",
-                                               iface, type);
-                               }
-                       }
-               }
-
-               static bool IsPublic (TypeDefinition type)
-               {
-                       return (type.DeclaringType == null && type.IsPublic) || type.IsNestedPublic;
-               }
-
-               static bool AreInDifferentAssemblies (TypeDefinition type, TypeDefinition target)
-               {
-                       if (type.Module.Assembly.Name.FullName == target.Module.Assembly.Name.FullName)
-                               return false;
-
-                       return !IsInternalVisibleTo (target.Module.Assembly, type.Module.Assembly);
-               }
-
-               static bool IsInternalVisibleTo (AssemblyDefinition assembly, AssemblyDefinition candidate)
-               {
-                       foreach (CustomAttribute attribute in assembly.CustomAttributes) {
-                               if (!IsInternalsVisibleToAttribute (attribute))
-                                       continue;
-
-                               if (attribute.ConstructorArguments.Count == 0)
-                                       continue;
-
-                               string signature = (string) attribute.ConstructorArguments [0].Value;
-
-                               if (InternalsVisibleToSignatureMatch (signature, candidate.Name))
-                                       return true;
-                       }
-
-                       return false;
-               }
-
-               static bool InternalsVisibleToSignatureMatch (string signature, AssemblyNameReference reference)
-               {
-                       int pos = signature.IndexOf (",");
-                       if (pos == -1)
-                               return signature == reference.Name;
-
-                       string assembly_name = signature.Substring (0, pos);
-
-                       pos = signature.IndexOf ("=");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string public_key = signature.Substring (pos + 1).ToLower ();
-
-                       return assembly_name == reference.Name && public_key == ToPublicKeyString (reference.PublicKey);
-               }
-
-               static string ToPublicKeyString (byte [] public_key)
-               {
-                       StringBuilder signature = new StringBuilder (public_key.Length);
-                       for (int i = 0; i < public_key.Length; i++)
-                               signature.Append (public_key [i].ToString ("x2"));
-
-                       return signature.ToString ();
-               }
-
-               static bool IsInternalsVisibleToAttribute (CustomAttribute attribute)
-               {
-                       return attribute.Constructor.DeclaringType.FullName == "System.Runtime.CompilerServices.InternalsVisibleToAttribute";
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, TypeReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       if (reference is GenericParameter || reference.GetElementType () is GenericParameter)
-                               return true;
-
-                       TypeDefinition other = reference.Resolve ();
-                       if (other == null)
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, other))
-                               return true;
-
-                       if (IsPublic (other))
-                               return true;
-
-                       return false;
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, MethodReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       MethodDefinition meth = reference.Resolve ();
-                       if (meth == null)
-                               return true;
-
-                       TypeDefinition dec = (TypeDefinition) meth.DeclaringType;
-                       if (!IsVisibleFrom (type, dec))
-                               return false;
-
-                       if (meth.IsPublic)
-                               return true;
-
-                       if (type == dec || IsNestedIn (type, dec))
-                               return true;
-
-                       if (meth.IsFamily && InHierarchy (type, dec))
-                               return true;
-
-                       if (meth.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
-                               return true;
-
-                       if (meth.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, dec) && meth.IsAssembly)
-                               return true;
-
-                       return false;
-               }
-
-               bool IsVisibleFrom (TypeDefinition type, FieldReference reference)
-               {
-                       if (reference == null)
-                               return true;
-
-                       FieldDefinition field = reference.Resolve ();
-                       if (field == null)
-                               return true;
-
-                       TypeDefinition dec = (TypeDefinition) field.DeclaringType;
-                       if (!IsVisibleFrom (type, dec))
-                               return false;
-
-                       if (field.IsPublic)
-                               return true;
-
-                       if (type == dec || IsNestedIn (type, dec))
-                               return true;
-
-                       if (field.IsFamily && InHierarchy (type, dec))
-                               return true;
-
-                       if (field.IsFamilyOrAssembly && (!AreInDifferentAssemblies (type, dec) || InHierarchy (type, dec)))
-                               return true;
-
-                       if (field.IsFamilyAndAssembly && (!AreInDifferentAssemblies (type, dec) && InHierarchy (type, dec)))
-                               return true;
-
-                       if (!AreInDifferentAssemblies (type, dec) && field.IsAssembly)
-                               return true;
-
-                       return false;
-               }
-
-               static bool IsNestedIn (TypeDefinition type, TypeDefinition other)
-               {
-                       TypeDefinition declaring = type.DeclaringType;
-
-                       if (declaring == null)
-                               return false;
-
-                       if (declaring == other)
-                               return true;
-
-                       if (declaring.DeclaringType == null)
-                               return false;
-
-                       return IsNestedIn (declaring, other);
-               }
-
-               static bool InHierarchy (TypeDefinition type, TypeDefinition other)
-               {
-                       if (type.BaseType == null)
-                               return false;
-
-                       TypeDefinition baseType = type.BaseType.Resolve ();
-
-                       if (baseType == other)
-                               return true;
-
-                       return InHierarchy (baseType, other);
-               }
-
-               static void Report (string pattern, params object [] parameters)
-               {
-                       Console.WriteLine ("[check] " + pattern, parameters);
-               }
-
-               void ReportError (string pattern, params object [] parameters)
-               {
-                       Report (pattern, parameters);
-
-                       if (throw_on_error)
-                               throw new VisibilityErrorException (string.Format (pattern, parameters));
-               }
-
-               void CheckFields (TypeDefinition type)
-               {
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!IsVisibleFrom (type, field.FieldType)) {
-                                       ReportError ("Field `{0}` of type `{1}` is not visible from `{2}`",
-                                               field.Name, field.FieldType, type);
-                               }
-                       }
-               }
-
-               void CheckMethods (TypeDefinition type)
-               {
-                       CheckMethods (type, type.Methods);
-               }
-
-               void CheckMethods (TypeDefinition type, ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods) {
-                               if (!IsVisibleFrom (type, method.ReturnType)) {
-                                       ReportError ("Method return type `{0}` in method `{1}` is not visible",
-                                               method.ReturnType, method);
-                               }
-
-                               foreach (ParameterDefinition parameter in method.Parameters) {
-                                       if (!IsVisibleFrom (type, parameter.ParameterType)) {
-                                               ReportError ("Parameter `{0}` of type `{1}` in method `{2}` is not visible.",
-                                                       parameter.Index, parameter.ParameterType, method);
-                                       }
-                               }
-
-                               if (method.HasBody)
-                                       CheckBody (method);
-                       }
-               }
-
-               void CheckBody (MethodDefinition method)
-               {
-                       TypeDefinition type = (TypeDefinition) method.DeclaringType;
-
-                       foreach (VariableDefinition variable in method.Body.Variables) {
-                               if (!IsVisibleFrom ((TypeDefinition) method.DeclaringType, variable.VariableType)) {
-                                       ReportError ("Variable `{0}` of type `{1}` from method `{2}` is not visible",
-                                               variable.Index, variable.VariableType, method);
-                               }
-                       }
-
-                       foreach (Instruction instr in method.Body.Instructions) {
-                               switch (instr.OpCode.OperandType) {
-                               case OperandType.InlineType:
-                               case OperandType.InlineMethod:
-                               case OperandType.InlineField:
-                               case OperandType.InlineTok:
-                                       bool error = false;
-                                       TypeReference type_ref = instr.Operand as TypeReference;
-                                       if (type_ref != null)
-                                               error = !IsVisibleFrom (type, type_ref);
-
-                                       MethodReference meth_ref = instr.Operand as MethodReference;
-                                       if (meth_ref != null)
-                                               error = !IsVisibleFrom (type, meth_ref);
-
-                                       FieldReference field_ref = instr.Operand as FieldReference;
-                                       if (field_ref != null)
-                                               error = !IsVisibleFrom (type, field_ref);
-
-                                       if (error) {
-                                               ReportError ("Operand `{0}` of type {1} at offset 0x{2} in method `{3}` is not visible",
-                                                       instr.Operand, instr.OpCode.OperandType, instr.Offset.ToString ("x4"), method);
-                                       }
-
-                                       break;
-                               default:
-                                       continue;
-                               }
-                       }
-               }
-
-               class VisibilityErrorException : Exception {
-
-                       public VisibilityErrorException (string message)
-                               : base (message)
-                       {
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs b/mcs/tools/tuner/Mono.Tuner/CustomizeActions.cs
deleted file mode 100644 (file)
index 1bb6d6f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class CustomizeActions : BaseStep {
-
-               readonly bool link_sdk_only;
-               readonly HashSet<string> skipped_assemblies;
-
-               public CustomizeActions (bool link_sdk_only, IEnumerable<string> skipped_assemblies)
-               {
-                       this.link_sdk_only = link_sdk_only;
-                       this.skipped_assemblies = new HashSet<string> (skipped_assemblies);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (!IsSkipped (assembly) && IsLinked (assembly)) {
-                               if (!Annotations.HasAction (assembly)) // stray assembly not picked up when resolving references
-                                       Annotations.SetAction (assembly, AssemblyAction.Link);
-                               return;
-                       }
-                       ProcessUserAssembly (assembly);
-               }
-
-               protected virtual bool IsPreservedAttribute (CustomAttribute attribute)
-               {
-                       // [assembly: Preserve (type)] does not preserve all the code in the assembly, in fact it might
-                       // not preserve anything in _this_ assembly, but something in a separate assembly (reference)
-                       if (attribute.HasConstructorArguments)
-                               return false;
-                       return (attribute.AttributeType.Name == "PreserveAttribute");
-               }
-
-               protected virtual bool IsLinkerSafeAttribute (CustomAttribute attribute)
-               {
-                       return (attribute.AttributeType.Name == "LinkerSafeAttribute");
-               }
-
-               const ModuleAttributes Supported = ModuleAttributes.ILOnly | ModuleAttributes.Required32Bit | 
-                       ModuleAttributes.Preferred32Bit | ModuleAttributes.StrongNameSigned;
-
-               protected virtual bool IsSkipped (AssemblyDefinition assembly)
-               {
-                       // Cecil can't save back mixed-mode assemblies - so we can't link them
-                       if ((assembly.MainModule.Attributes & ~Supported) != 0)
-                               return true;
-
-                       if (assembly.HasCustomAttributes) {
-                               foreach (var ca in assembly.CustomAttributes) {
-                                       if (IsPreservedAttribute (ca))
-                                               return true;
-                               }
-                       }
-                       return skipped_assemblies.Contains (assembly.Name.Name);
-               }
-
-               protected virtual bool IsLinked (AssemblyDefinition assembly)
-               {
-                       // LinkAll
-                       if (!link_sdk_only)
-                               return true;
-                       // Link SDK : applies to BCL/SDK and product assembly (e.g. monotouch.dll)
-                       if (Profile.IsSdkAssembly (assembly))
-                               return true;
-                       if (Profile.IsProductAssembly (assembly))
-                           return true;
-                       // the assembly can be marked with [LinkAssembly]
-                       if (assembly.HasCustomAttributes) {
-                               foreach (var ca in assembly.CustomAttributes) {
-                                       if (IsLinkerSafeAttribute (ca))
-                                               return true;
-                               }
-                       }
-                       return false;
-               }
-
-               protected void ProcessUserAssembly (AssemblyDefinition assembly)
-               {
-                       ResolveFromAssemblyStep.ProcessLibrary (Context, assembly);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs b/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs
deleted file mode 100644 (file)
index 9dcf5ee..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       [Flags]
-       public enum SubStepTargets {
-               None = 0,
-
-               Assembly = 1,
-               Type = 2,
-               Field = 4,
-               Method = 8,
-               Property = 16,
-               Event = 32,
-       }
-
-       public interface ISubStep {
-
-               SubStepTargets Targets { get; }
-
-               void Initialize (LinkContext context);
-               bool IsActiveFor (AssemblyDefinition assembly);
-
-               void ProcessAssembly (AssemblyDefinition assembly);
-               void ProcessType (TypeDefinition type);
-               void ProcessField (FieldDefinition field);
-               void ProcessMethod (MethodDefinition method);
-               void ProcessProperty (PropertyDefinition property);
-               void ProcessEvent (EventDefinition @event);
-       }
-
-       public abstract class BaseSubStep : ISubStep {
-
-               protected LinkContext context;
-
-               public AnnotationStore Annotations {
-                       get { return context.Annotations; }
-               }
-
-               public abstract SubStepTargets Targets { get; }
-
-               public virtual void Initialize (LinkContext context)
-               {
-                       this.context = context;
-               }
-
-               public virtual bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return true;
-               }
-
-               public virtual void ProcessAssembly (AssemblyDefinition assembly)
-               {
-               }
-
-               public virtual void ProcessType (TypeDefinition type)
-               {
-               }
-
-               public virtual void ProcessField (FieldDefinition field)
-               {
-               }
-
-               public virtual void ProcessMethod (MethodDefinition method)
-               {
-               }
-
-               public virtual void ProcessProperty (PropertyDefinition property)
-               {
-               }
-
-               public virtual void ProcessEvent (EventDefinition @event)
-               {
-               }
-       }
-
-       public class SubStepDispatcher : IStep, IEnumerable<ISubStep> {
-
-               List<ISubStep> substeps = new List<ISubStep> ();
-
-               List<ISubStep> on_assemblies;
-               List<ISubStep> on_types;
-               List<ISubStep> on_fields;
-               List<ISubStep> on_methods;
-               List<ISubStep> on_properties;
-               List<ISubStep> on_events;
-
-               public void Add (ISubStep substep)
-               {
-                       substeps.Add (substep);
-               }
-
-               public void Process (LinkContext context)
-               {
-                       InitializeSubSteps (context);
-
-                       BrowseAssemblies (context.GetAssemblies ());
-               }
-
-               static bool HasSubSteps (List<ISubStep> substeps)
-               {
-                       return substeps != null && substeps.Count > 0;
-               }
-
-               void BrowseAssemblies (IEnumerable<AssemblyDefinition> assemblies)
-               {
-                       foreach (var assembly in assemblies) {
-                               CategorizeSubSteps (assembly);
-
-                               if (HasSubSteps (on_assemblies))
-                                       DispatchAssembly (assembly);
-
-                               if (!ShouldDispatchTypes ())
-                                       continue;
-
-                               BrowseTypes (assembly.MainModule.Types);
-                       }
-               }
-
-               bool ShouldDispatchTypes ()
-               {
-                       return HasSubSteps (on_types)
-                               || HasSubSteps (on_fields)
-                               || HasSubSteps (on_methods)
-                               || HasSubSteps (on_properties)
-                               || HasSubSteps (on_events);
-               }
-
-               void BrowseTypes (ICollection types)
-               {
-                       foreach (TypeDefinition type in types) {
-                               DispatchType (type);
-
-                               if (type.HasFields && HasSubSteps (on_fields))
-                                       BrowseFields (type.Fields);
-
-                               if (type.HasMethods && HasSubSteps (on_methods))
-                                       BrowseMethods (type.Methods);
-
-                               if (type.HasProperties && HasSubSteps (on_properties))
-                                       BrowseProperties (type.Properties);
-
-                               if (type.HasEvents && HasSubSteps (on_events))
-                                       BrowseEvents (type.Events);
-
-                               if (type.HasNestedTypes)
-                                       BrowseTypes (type.NestedTypes);
-                       }
-               }
-
-               void BrowseFields (ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               DispatchField (field);
-               }
-
-               void BrowseMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               DispatchMethod (method);
-               }
-
-               void BrowseProperties (ICollection properties)
-               {
-                       foreach (PropertyDefinition property in properties)
-                               DispatchProperty (property);
-               }
-
-               void BrowseEvents (ICollection events)
-               {
-                       foreach (EventDefinition @event in events)
-                               DispatchEvent (@event);
-               }
-
-               void DispatchAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (var substep in on_assemblies) {
-                               var bs = substep as BaseSubStep;
-                               if (bs != null)
-                                       bs.Annotations.Push (substep);
-                               substep.ProcessAssembly (assembly);
-                               if (bs != null)
-                                       bs.Annotations.Pop ();
-                       }
-               }
-
-               void DispatchType (TypeDefinition type)
-               {
-                       foreach (var substep in on_types) {
-                               var bs = substep as BaseSubStep;
-                               if (bs != null)
-                                       bs.Annotations.Push (substep);
-                               substep.ProcessType (type);
-                               if (bs != null)
-                                       bs.Annotations.Pop ();
-                       }
-               }
-
-               void DispatchField (FieldDefinition field)
-               {
-                       foreach (var substep in on_fields)
-                               substep.ProcessField (field);
-               }
-
-               void DispatchMethod (MethodDefinition method)
-               {
-                       foreach (var substep in on_methods)
-                               substep.ProcessMethod (method);
-               }
-
-               void DispatchProperty (PropertyDefinition property)
-               {
-                       foreach (var substep in on_properties)
-                               substep.ProcessProperty (property);
-               }
-
-               void DispatchEvent (EventDefinition @event)
-               {
-                       foreach (var substep in on_events)
-                               substep.ProcessEvent (@event);
-               }
-
-               void InitializeSubSteps (LinkContext context)
-               {
-                       foreach (var substep in substeps)
-                               substep.Initialize (context);
-               }
-
-               void CategorizeSubSteps (AssemblyDefinition assembly)
-               {
-                       on_assemblies = null;
-                       on_types = null;
-                       on_fields = null;
-                       on_methods = null;
-                       on_properties = null;
-                       on_events = null;
-
-                       foreach (var substep in substeps)
-                               CategorizeSubStep (substep, assembly);
-               }
-
-               void CategorizeSubStep (ISubStep substep, AssemblyDefinition assembly)
-               {
-                       if (!substep.IsActiveFor (assembly))
-                               return;
-
-                       CategorizeTarget (substep, SubStepTargets.Assembly, ref on_assemblies);
-                       CategorizeTarget (substep, SubStepTargets.Type, ref on_types);
-                       CategorizeTarget (substep, SubStepTargets.Field, ref on_fields);
-                       CategorizeTarget (substep, SubStepTargets.Method, ref on_methods);
-                       CategorizeTarget (substep, SubStepTargets.Property, ref on_properties);
-                       CategorizeTarget (substep, SubStepTargets.Event, ref on_events);
-               }
-
-               static void CategorizeTarget (ISubStep substep, SubStepTargets target, ref List<ISubStep> list)
-               {
-                       if (!Targets (substep, target))
-                               return;
-
-                       if (list == null)
-                               list = new List<ISubStep> ();
-
-                       list.Add (substep);
-               }
-
-               static bool Targets (ISubStep substep, SubStepTargets target)
-               {
-                       return (substep.Targets & target) == target;
-               }
-
-               IEnumerator IEnumerable.GetEnumerator ()
-               {
-                       return GetEnumerator ();
-               }
-
-               public IEnumerator<ISubStep> GetEnumerator ()
-               {
-                       return substeps.GetEnumerator ();
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Extensions.cs b/mcs/tools/tuner/Mono.Tuner/Extensions.cs
deleted file mode 100644 (file)
index 3e3b312..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public static partial class Extensions {
-
-               public static bool TryGetLinkedAssembly (this LinkContext context, string name, out AssemblyDefinition assembly)
-               {
-                       assembly = GetAssembly (context, name);
-                       if (assembly == null)
-                               return false;
-
-                       return context.Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public static AssemblyDefinition GetAssembly (this LinkContext context, string assembly_name)
-               {
-                       foreach (var assembly in context.GetAssemblies ())
-                               if (assembly.Name.Name == assembly_name)
-                                       return assembly;
-
-                       return null;
-               }
-
-               // note: direct check, no inheritance
-               public static bool Is (this TypeReference type, string @namespace, string name)
-               {
-                       return ((type != null) && (type.Name == name) && (type.Namespace == @namespace));
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs b/mcs/tools/tuner/Mono.Tuner/FilterAttributes.cs
deleted file mode 100644 (file)
index 19a334a..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-//
-// FilterAttributes.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class FilterAttributes : BaseStep {
-
-               static Hashtable attributes = new Hashtable ();
-
-               static FilterAttributes ()
-               {
-                       FilterAttribute ("System.Runtime.InteropServices.ComVisibleAttribute");
-               }
-
-               static void FilterAttribute (string fullname)
-               {
-                       attributes.Add (fullname, null);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Filter (assembly);
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               ProcessModule (module);
-               }
-
-               static void ProcessModule (ModuleDefinition module)
-               {
-                       Filter (module);
-
-                       foreach (TypeDefinition type in module.Types)
-                               ProcessType (type);
-               }
-
-               static void ProcessType (TypeDefinition type)
-               {
-                       if (type.HasFields)
-                               ProcessFields (type.Fields);
-
-                       if (type.HasMethods)
-                               ProcessMethods (type.Methods);
-
-                       if (type.HasEvents)
-                               ProcessEvents (type.Events);
-
-                       if (type.HasProperties)
-                               ProcessProperties (type.Properties);
-
-                       ProcessGenericParameters (type);
-               }
-
-               static void ProcessFields (ICollection fields)
-               {
-                       foreach (FieldDefinition field in fields)
-                               Filter (field);
-               }
-
-               static void ProcessMethods (ICollection methods)
-               {
-                       foreach (MethodDefinition method in methods)
-                               ProcessMethod (method);
-               }
-
-               static void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessGenericParameters (method);
-
-                       Filter (method.MethodReturnType);
-
-                       if (method.HasParameters)
-                               ProcessParameters (method.Parameters);
-               }
-
-               static void ProcessParameters (ICollection parameters)
-               {
-                       foreach (ParameterDefinition parameter in parameters)
-                               Filter (parameter);
-               }
-
-               static void ProcessGenericParameters (IGenericParameterProvider provider)
-               {
-                       if (!provider.HasGenericParameters)
-                               return;
-
-                       foreach (GenericParameter parameter in provider.GenericParameters)
-                               Filter (parameter);
-               }
-
-               static void ProcessEvents (ICollection events)
-               {
-                       foreach (EventDefinition @event in events)
-                               Filter (@event);
-               }
-
-               static void ProcessProperties (ICollection properties)
-               {
-                       foreach (PropertyDefinition property in properties)
-                               Filter (property);
-               }
-
-               static void Filter (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       for (int i = 0; i < provider.CustomAttributes.Count; i++) {
-                               CustomAttribute attribute = provider.CustomAttributes [i];
-                               if (!IsFilteredAttribute (attribute))
-                                       continue;
-
-                               provider.CustomAttributes.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsFilteredAttribute (CustomAttribute attribute)
-               {
-                       return attributes.Contains (attribute.Constructor.DeclaringType.FullName);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs b/mcs/tools/tuner/Mono.Tuner/FixModuleFlags.cs
deleted file mode 100644 (file)
index 2bb01ab..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class FixModuleFlags : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       assembly.MainModule.Attributes = ModuleAttributes.ILOnly;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs b/mcs/tools/tuner/Mono.Tuner/InjectSecurityAttributes.cs
deleted file mode 100644 (file)
index 9489876..0000000
+++ /dev/null
@@ -1,500 +0,0 @@
-//
-// InjectSecurityAttributes.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class InjectSecurityAttributes : BaseStep {
-
-               enum TargetKind {
-                       Type,
-                       Method,
-               }
-
-               protected enum AttributeType {
-                       Critical,
-                       SafeCritical,
-               }
-
-               const string _safe_critical = "System.Security.SecuritySafeCriticalAttribute";
-               const string _critical = "System.Security.SecurityCriticalAttribute";
-               const string _system_void = "System.Void";
-
-               const string sec_attr_folder = "secattrs";
-
-               protected AssemblyDefinition _assembly;
-
-               MethodDefinition _safe_critical_ctor;
-               MethodDefinition _critical_ctor;
-               TypeDefinition _void_type;
-
-               string data_folder;
-
-               protected override bool ConditionToProcess ()
-               {
-                       if (!Context.HasParameter (sec_attr_folder)) {
-                               Console.Error.WriteLine ("Warning: no secattrs folder specified.");
-                               return false;
-                       }
-
-                       data_folder = Context.GetParameter (sec_attr_folder);
-                       return true;
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       string secattr_file = Path.Combine (
-                               data_folder,
-                               assembly.Name.Name + ".secattr");
-
-                       if (!File.Exists (secattr_file)) {
-                               Console.Error.WriteLine ("Warning: file '{0}' not found, skipping.", secattr_file);
-                               return;
-                       }
-
-                       _assembly = assembly;
-
-                       // remove existing [SecurityCritical] and [SecuritySafeCritical]
-                       RemoveSecurityAttributes ();
-
-                       // add [SecurityCritical] and [SecuritySafeCritical] from the data file
-                       ProcessSecurityAttributeFile (secattr_file);
-               }
-
-               protected void RemoveSecurityAttributes ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               if (RemoveSecurityAttributes (type))
-                                       type.HasSecurity = false;
-
-                               if (type.HasMethods) {
-                                       foreach (MethodDefinition method in type.Methods) {
-                                               if (RemoveSecurityAttributes (method))
-                                                       method.HasSecurity = false;
-                                       }
-                               }
-                       }
-               }
-
-               static bool RemoveSecurityDeclarations (ISecurityDeclarationProvider provider)
-               {
-                       // also remove already existing CAS security declarations
-
-                       if (provider == null)
-                               return false;
-
-                       if (!provider.HasSecurityDeclarations)
-                               return false;
-
-                       provider.SecurityDeclarations.Clear ();
-                       return true;
-               }
-
-               static bool RemoveSecurityAttributes (ICustomAttributeProvider provider)
-               {
-                       bool result = RemoveSecurityDeclarations (provider as ISecurityDeclarationProvider);
-
-                       if (!provider.HasCustomAttributes)
-                               return result;
-
-                       var attributes = provider.CustomAttributes;
-                       for (int i = 0; i < attributes.Count; i++) {
-                               CustomAttribute attribute = attributes [i];
-                               switch (attribute.Constructor.DeclaringType.FullName) {
-                               case _safe_critical:
-                               case _critical:
-                                       attributes.RemoveAt (i--);
-                                       break;
-                               }
-                       }
-                       return result;
-               }
-
-               void ProcessSecurityAttributeFile (string file)
-               {
-                       using (StreamReader reader = File.OpenText (file)) {
-                               string line;
-                               while ((line = reader.ReadLine ()) != null)
-                                       ProcessLine (line);
-                       }
-               }
-
-               void ProcessLine (string line)
-               {
-                       if (line == null || line.Length < 6 || line [0] == '#')
-                               return;
-
-                       int sep = line.IndexOf (": ");
-                       if (sep == -1)
-                               return;
-
-                       string marker = line.Substring (0, sep);
-                       string target = line.Substring (sep + 2);
-
-                       ProcessSecurityAttributeEntry (
-                               DecomposeAttributeType (marker),
-                               DecomposeTargetKind (marker),
-                               target);
-               }
-
-               static AttributeType DecomposeAttributeType (string marker)
-               {
-                       if (marker.StartsWith ("SC"))
-                               return AttributeType.Critical;
-                       else if (marker.StartsWith ("SSC"))
-                               return AttributeType.SafeCritical;
-                       else
-                               throw new ArgumentException ();
-               }
-
-               static TargetKind DecomposeTargetKind (string marker)
-               {
-                       switch (marker [marker.Length - 1]) {
-                       case 'T':
-                               return TargetKind.Type;
-                       case 'M':
-                               return TargetKind.Method;
-                       default:
-                               throw new ArgumentException ();
-                       }
-               }
-
-               public static bool NeedsDefaultConstructor (TypeDefinition type)
-               {
-                       if (type.IsInterface)
-                               return false;
-
-                       TypeReference base_type = type.BaseType;
-                       if ((base_type == null) || (base_type.Namespace != "System"))
-                               return true;
-
-                       return ((base_type.Name != "Delegate") && (base_type.Name != "MulticastDelegate"));
-               }
-
-               void ProcessSecurityAttributeEntry (AttributeType type, TargetKind kind, string target)
-               {
-                       ICustomAttributeProvider provider = GetTarget (kind, target);
-                       if (provider == null) {
-                               Console.Error.WriteLine ("Warning: entry '{0}' could not be found", target);
-                               return;
-                       }
-
-                       // we need to be smarter when applying the attributes (mostly SC) to types
-                       if (kind == TargetKind.Type) {
-                               TypeDefinition td = (provider as TypeDefinition);
-                               // ensure [SecurityCritical] types (well most) have a default constructor
-                               if ((type == AttributeType.Critical) && NeedsDefaultConstructor (td)) {
-                                       if (GetDefaultConstructor (td) == null) {
-                                               // Console.Error.WriteLine ("Info: adding default ctor for '{0}'", td);
-                                               td.Methods.Add (CreateDefaultConstructor ());
-                                       }
-                               }
-
-                               // it's easier for some tools (e.g. less false positives in fxcop) 
-                               // and also quicker for the runtime (one less lookup) if all methods gets decorated
-                               foreach (MethodDefinition method in td.Methods) {
-                                       bool skip = false;
-
-                                       AttributeType mtype = type;
-                                       // there are cases where an SC cannot be applied to some methods
-                                       switch (method.Name) {
-                                       // e.g. everything we override from System.Object (which is transparent)
-                                       case "Equals":
-                                               skip = method.Parameters.Count == 1 && method.Parameters [0].ParameterType.FullName == "System.Object";
-                                               break;
-                                       case "Finalize":
-                                       case "GetHashCode":
-                                       case "ToString":
-                                               skip = !method.HasParameters;
-                                               break;
-                                       // e.g. some transparent interfaces, like IDisposable (implicit or explicit)
-                                       // downgrade some SC into SSC to respect the override/inheritance rules
-                                       case "System.IDisposable.Dispose":
-                                       case "Dispose":
-                                               skip = !method.HasParameters;
-                                               break;
-                                       }
-
-                                       if (skip)
-                                               continue;
-
-                                       switch (mtype) {
-                                       case AttributeType.Critical:
-                                               AddCriticalAttribute (method);
-                                               break;
-                                       case AttributeType.SafeCritical:
-                                               AddSafeCriticalAttribute (method);
-                                               break;
-                                       }
-                               }
-                       }
-
-                       switch (type) {
-                       case AttributeType.Critical:
-                               AddCriticalAttribute (provider);
-                               break;
-                       case AttributeType.SafeCritical:
-                               AddSafeCriticalAttribute (provider);
-                               break;
-                       }
-               }
-
-               protected void AddCriticalAttribute (ICustomAttributeProvider provider)
-               {
-                       // a [SecurityCritical] replaces a [SecuritySafeCritical]
-                       if (HasSecurityAttribute (provider, AttributeType.SafeCritical))
-                               RemoveSecurityAttributes (provider);
-
-                       AddSecurityAttribute (provider, AttributeType.Critical);
-               }
-
-               void AddSafeCriticalAttribute (ICustomAttributeProvider provider)
-               {
-                       // a [SecuritySafeCritical] is ignored if a [SecurityCritical] is present
-                       if (HasSecurityAttribute (provider, AttributeType.Critical))
-                               return;
-
-                       AddSecurityAttribute (provider, AttributeType.SafeCritical);
-               }
-
-               void AddSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
-               {
-                       if (HasSecurityAttribute (provider, type))
-                               return;
-
-                       var attributes = provider.CustomAttributes;
-                       switch (type) {
-                       case AttributeType.Critical:
-                               attributes.Add (CreateCriticalAttribute ());
-                               break;
-                       case AttributeType.SafeCritical:
-                               attributes.Add (CreateSafeCriticalAttribute ());
-                               break;
-                       }
-               }
-
-               protected static bool HasSecurityAttribute (ICustomAttributeProvider provider, AttributeType type)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in provider.CustomAttributes) {
-                               switch (attribute.Constructor.DeclaringType.Name) {
-                               case _critical:
-                                       if (type == AttributeType.Critical)
-                                               return true;
-
-                                       break;
-                               case _safe_critical:
-                                       if (type == AttributeType.SafeCritical)
-                                               return true;
-
-                                       break;
-                               }
-                       }
-
-                       return false;
-               }
-
-               ICustomAttributeProvider GetTarget (TargetKind kind, string target)
-               {
-                       switch (kind) {
-                       case TargetKind.Type:
-                               return GetType (target);
-                       case TargetKind.Method:
-                               return GetMethod (target);
-                       default:
-                               throw new ArgumentException ();
-                       }
-               }
-
-               TypeDefinition GetType (string fullname)
-               {
-                       return _assembly.MainModule.GetType (fullname);
-               }
-
-               MethodDefinition GetMethod (string signature)
-               {
-                       int pos = signature.IndexOf (" ");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string tmp = signature.Substring (pos + 1);
-
-                       pos = tmp.IndexOf ("::");
-                       if (pos == -1)
-                               throw new ArgumentException ();
-
-                       string type_name = tmp.Substring (0, pos);
-
-                       int parpos = tmp.IndexOf ("(");
-                       if (parpos == -1)
-                               throw new ArgumentException ();
-
-                       string method_name = tmp.Substring (pos + 2, parpos - pos - 2);
-
-                       TypeDefinition type = GetType (type_name);
-                       if (type == null)
-                               return null;
-
-                       return GetMethod (type.Methods, signature);
-               }
-
-               static MethodDefinition GetMethod (IEnumerable methods, string signature)
-               {
-                       foreach (MethodDefinition method in methods)
-                               if (GetFullName (method) == signature)
-                                       return method;
-
-                       return null;
-               }
-
-               static string GetFullName (MethodReference method)
-               {
-                       var sentinel = method.Parameters.FirstOrDefault (p => p.ParameterType.IsSentinel);
-                       var sentinel_pos = -1;
-                       if (sentinel != null)
-                               sentinel_pos = method.Parameters.IndexOf (sentinel);
-
-                       StringBuilder sb = new StringBuilder ();
-                       sb.Append (method.ReturnType.FullName);
-                       sb.Append (" ");
-                       sb.Append (method.DeclaringType.FullName);
-                       sb.Append ("::");
-                       sb.Append (method.Name);
-                       if (method.HasGenericParameters) {
-                               sb.Append ("<");
-                               for (int i = 0; i < method.GenericParameters.Count; i++ ) {
-                                       if (i > 0)
-                                               sb.Append (",");
-                                       sb.Append (method.GenericParameters [i].Name);
-                               }
-                               sb.Append (">");
-                       }
-                       sb.Append ("(");
-                       if (method.HasParameters) {
-                               for (int i = 0; i < method.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               sb.Append (",");
-
-                                       if (i == sentinel_pos)
-                                               sb.Append ("...,");
-
-                                       sb.Append (method.Parameters [i].ParameterType.FullName);
-                               }
-                       }
-                       sb.Append (")");
-                       return sb.ToString ();
-               }
-
-               static MethodDefinition GetDefaultConstructor (TypeDefinition type)
-               {
-                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                               if (!ctor.IsStatic && !ctor.HasParameters)
-                                       return ctor;
-
-                       return null;
-               }
-
-               MethodDefinition GetSafeCriticalCtor ()
-               {
-                       if (_safe_critical_ctor != null)
-                               return _safe_critical_ctor;
-
-                       TypeDefinition safe_critical_type = Context.GetType (_safe_critical);
-                       if (safe_critical_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _safe_critical));
-
-                       _safe_critical_ctor = GetDefaultConstructor (safe_critical_type);
-                       return _safe_critical_ctor;
-               }
-
-               MethodDefinition GetCriticalCtor ()
-               {
-                       if (_critical_ctor != null)
-                               return _critical_ctor;
-
-                       TypeDefinition critical_type = Context.GetType (_critical);
-                       if (critical_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _critical));
-
-                       _critical_ctor = GetDefaultConstructor (critical_type);
-                       return _critical_ctor;
-               }
-
-               TypeDefinition GetSystemVoid ()
-               {
-                       if (_void_type != null)
-                               return _void_type;
-
-                       _void_type = Context.GetType (_system_void);
-                       if (_void_type == null)
-                               throw new InvalidOperationException (String.Format ("{0} type not found", _system_void));
-
-                       return _void_type;
-               }
-
-               MethodReference Import (MethodDefinition method)
-               {
-                       return _assembly.MainModule.Import (method);
-               }
-
-               CustomAttribute CreateSafeCriticalAttribute ()
-               {
-                       return new CustomAttribute (Import (GetSafeCriticalCtor ()));
-               }
-
-               CustomAttribute CreateCriticalAttribute ()
-               {
-                       return new CustomAttribute (Import (GetCriticalCtor ()));
-               }
-
-               MethodDefinition CreateDefaultConstructor ()
-               {
-                       MethodDefinition method = new MethodDefinition (".ctor", 
-                               MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, 
-                               GetSystemVoid ());
-                       method.Body.Instructions.Add (Instruction.Create (OpCodes.Ret));
-                       return method;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs b/mcs/tools/tuner/Mono.Tuner/MarkNSObjectsBase.cs
deleted file mode 100644 (file)
index 9d65be1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// MarkNSObjectsBase.cs
-//
-// Authors:
-//     Jb Evain (jbevain@novell.com)
-//     Sebastien Pouliot  <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// 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;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class MarkNSObjectsBase : BaseSubStep {
-
-               protected abstract string ExportAttribute { get; }
-
-               public override SubStepTargets Targets {
-                       get { return SubStepTargets.Type; }
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (!IsProductType (type)) {
-                               Annotations.Mark (type);
-                               Annotations.SetPreserve (type, TypePreserve.All);
-                       } else
-                               PreserveProductType (type);
-               }
-
-               void PreserveProductType (TypeDefinition type)
-               {
-                       PreserveIntPtrConstructor (type);
-                       PreserveExportedMethods (type);
-               }
-
-               void PreserveExportedMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (var method in type.GetMethods ()) {
-                               if (!IsExportedMethod (method))
-                                       continue;
-
-                               if (!IsOverridenInUserCode (method))
-                                       continue;
-
-                               PreserveMethod (type, method);
-                       }
-               }
-
-               bool IsOverridenInUserCode (MethodDefinition method)
-               {
-                       if (!method.IsVirtual)
-                               return false;
-
-                       var overrides = Annotations.GetOverrides (method);
-                       if (overrides == null || overrides.Count == 0)
-                               return false;
-
-                       foreach (MethodDefinition @override in overrides)
-                               if (!IsProductMethod (@override))
-                                       return true;
-
-                       return false;
-               }
-
-               bool IsExportedMethod (MethodDefinition method)
-               {
-                       return HasExportAttribute (method);
-               }
-
-               bool HasExportAttribute (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in provider.CustomAttributes)
-                               if (attribute.AttributeType.FullName == ExportAttribute)
-                                       return true;
-
-                       return false;
-               }
-
-               void PreserveIntPtrConstructor (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition constructor in type.GetConstructors ()) {
-                               if (!constructor.HasParameters)
-                                       continue;
-
-                               if (constructor.Parameters.Count != 1 || constructor.Parameters [0].ParameterType.FullName != "System.IntPtr")
-                                       continue;
-
-                               PreserveMethod (type, constructor);
-                               break; // only one .ctor can match this
-                       }
-               }
-
-               void PreserveMethod (TypeDefinition type, MethodDefinition method)
-               {
-                       Annotations.AddPreservedMethod (type, method);
-               }
-
-               static bool IsProductMethod (MethodDefinition method)
-               {
-                       return IsProductType (method.DeclaringType);
-               }
-
-               static bool IsProductType (TypeDefinition type)
-               {
-                       return Profile.IsProductAssembly (type.Module.Assembly);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yApiMarker.cs
deleted file mode 100644 (file)
index fcd61af..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// MoonlightA11yApiMarker.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Xml;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yApiMarker : MarkStep {
-
-               bool IsA11yAssembly (AssemblyDefinition assembly)
-               {
-                       return assembly.ToString ().Contains ("DummyEntry") || assembly.ToString ().Contains ("MoonAtkBridge");
-               }
-
-               protected override void InitializeAssembly (AssemblyDefinition assembly)
-               {
-                       if (IsA11yAssembly (assembly))
-                               base.InitializeAssembly (assembly);
-               }
-
-               protected override void EnqueueMethod (MethodDefinition method)
-               {
-                       if (IsA11yAssembly (method.DeclaringType.Module.Assembly))
-                               base.EnqueueMethod (method);
-                       else
-                               Annotations.Mark (method);
-               }
-
-               protected override bool IgnoreScope (IMetadataScope scope)
-               {
-                       return false;
-               }
-
-               protected override TypeDefinition MarkType (TypeReference reference)
-               {
-                       if (reference == null)
-                               throw new ArgumentNullException ("reference");
-
-                       reference = GetOriginalType (reference);
-
-                       if (reference is GenericParameter)
-                               return null;
-
-                       TypeDefinition type = reference.Resolve ();
-
-                       if (type == null)
-                               throw new ResolutionException (reference);
-
-                       if (CheckProcessed (type))
-                               return type;
-
-                       Annotations.Mark (type);
-                       return type;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yAssemblyStep.cs
deleted file mode 100644 (file)
index 63a82b2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// MoonlightA11yAssemblyStep.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yAssemblyStep : MoonlightAssemblyStep {
-
-               protected override void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (BlacklistStep));
-                       pipeline.RemoveStep (typeof (MarkStep));
-                       pipeline.RemoveStep (typeof (SweepStep));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.AddStepBefore (typeof (OutputStep), new MoonlightA11yProcessor ());
-               }
-
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yDescriptorGenerator.cs
deleted file mode 100644 (file)
index 17db23b..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-//
-// MoonlightA11yDescriptorGenerator.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Text;
-
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yDescriptorGenerator : BaseStep {
-
-               XmlTextWriter writer = null;
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "MoonAtkBridge" || assembly.Name.Name == "System.Windows" ||
-                           assembly.Name.Name.Contains ("Dummy"))
-                               return;
-
-                       if (writer == null) {
-                               if (!Directory.Exists (Context.OutputDirectory))
-                                       Directory.CreateDirectory (Context.OutputDirectory);
-
-                               string file_name = "descriptors.xml";
-                               string file_path = Path.Combine (Context.OutputDirectory, file_name);
-                               if (File.Exists (file_path))
-                                       File.Delete (file_path);
-                               FileStream xml_file = new FileStream (file_path, FileMode.OpenOrCreate);
-                               Console.WriteLine ("Created file {0}", file_name);
-                               Console.Write ("Writing contents...");
-
-                               writer = new XmlTextWriter (xml_file, System.Text.Encoding.UTF8);
-                               writer.Formatting = Formatting.Indented;
-                               writer.WriteStartElement("linker");
-                       }
-
-                       SortedDictionary <TypeDefinition, IList> types = ScanAssembly (assembly);
-                       if (types != null && types.Count > 0) {
-                               writer.WriteStartElement("assembly");
-                               writer.WriteAttributeString ("fullname", assembly.Name.Name);
-
-                               foreach (TypeDefinition type in types.Keys) {
-                                       IList members = types [type];
-                                       if (members != null && members.Count > 0) {
-                                               writer.WriteStartElement("type");
-                                               writer.WriteAttributeString ("fullname", type.FullName);
-
-                                               foreach (IMetadataTokenProvider member in members) {
-                                                       MethodDefinition method = member as MethodDefinition;
-                                                       if (method != null) {
-                                                               writer.WriteStartElement("method");
-                                                               writer.WriteAttributeString ("signature",
-                                                                                            method.ReturnType.FullName + " " +
-                                                                                            method.Name + GetMethodParams (method));
-                                                               writer.WriteEndElement ();
-                                                               continue;
-                                                       }
-
-                                                       FieldDefinition field = member as FieldDefinition;
-                                                       if (field != null) {
-                                                               writer.WriteStartElement("field");
-                                                               writer.WriteAttributeString ("signature", field.DeclaringType.FullName + " " + field.Name);
-                                                               writer.WriteEndElement ();
-                                                       }
-                                               }
-                                               writer.WriteEndElement ();
-                                       }
-                               }
-
-                               writer.WriteEndElement ();
-                               Console.WriteLine ();
-                       }
-
-               }
-
-               protected override void EndProcess ()
-               {
-                       Console.WriteLine ();
-
-                       foreach (FileStream stream in streams)
-                               stream.Close ();
-
-                       if (writer != null) {
-                               writer.WriteEndElement ();
-                               writer.Close ();
-                               writer = null;
-                       }
-               }
-
-               //this is almost the ToString method of MethodDefinition...
-               private string GetMethodParams (MethodDefinition method)
-               {
-                       string @params = "(";
-                       if (method.HasParameters) {
-                               for (int i = 0; i < method.Parameters.Count; i++) {
-                                       if (i > 0)
-                                               @params += ",";
-
-                                       @params += method.Parameters [i].ParameterType.FullName;
-                               }
-                       }
-                       @params += ")";
-                       return @params;
-               }
-
-               SortedDictionary<TypeDefinition, IList> /*,List<IAnnotationProvider>>*/ ScanAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return null;
-
-                       SortedDictionary<TypeDefinition, IList> members_used = new SortedDictionary<TypeDefinition, IList> (new TypeComparer ());
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               IList used_providers = FilterPublicMembers (ScanType (type));
-                               if (used_providers.Count > 0)
-                                       members_used [type] = used_providers;
-                               else if (IsInternal (type, true) &&
-                                        Annotations.IsMarked (type))
-                                       throw new NotSupportedException (String.Format ("The type {0} is used while its API is not", type.ToString ()));
-                       }
-                       return members_used;
-               }
-
-               IList ScanType (TypeDefinition type)
-               {
-                       return ExtractUsedProviders (type.Methods, type.Fields);
-               }
-
-               static IList FilterPublicMembers (IList members)
-               {
-                       IList new_list = new ArrayList ();
-                       foreach (MemberReference item in members)
-                               if (IsInternal (item, true))
-                                       new_list.Add (item);
-
-                       return new_list;
-               }
-
-               static string [] master_infos = Directory.GetFiles (Environment.CurrentDirectory, "*.info");
-
-               static string FindMasterInfoFile (string name)
-               {
-                       if (master_infos.Length == 0)
-                               throw new Exception ("No masterinfo files found in current directory");
-
-                       foreach (string file in master_infos) {
-                               if (file.EndsWith (name + ".info"))
-                                       return file;
-                       }
-
-                       return null;
-               }
-
-               const string xpath_init = "assemblies/assembly/namespaces/namespace[@name='{0}']/classes/class[@name='{1}']";
-
-               static string GetXPathSearchForType (TypeDefinition type)
-               {
-                       TypeDefinition parent_type = type;
-                       string xpath = String.Empty;
-                       while (parent_type.DeclaringType != null) {
-                               xpath = String.Format ("/classes/class[@name='{0}']", parent_type.Name) + xpath;
-                               parent_type = parent_type.DeclaringType;
-                       }
-                       return String.Format (xpath_init, parent_type.Namespace, parent_type.Name) + xpath;
-               }
-
-               static bool IsInternal (MemberReference member, bool master_info)
-               {
-                       TypeDefinition type = null;
-                       string master_info_file = null;
-
-                       if (member is TypeDefinition) {
-                               type = member as TypeDefinition;
-                               if (!master_info)
-                                       return (!type.IsNested && !type.IsPublic) ||
-                                              (type.IsNested && (!type.IsNestedPublic || IsInternal (type.DeclaringType, false)));
-
-                               master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
-                               if (master_info_file == null)
-                                       return IsInternal (member, false);
-
-                               return !NodeExists (master_info_file, GetXPathSearchForType (type));
-                       }
-
-                       type = member.DeclaringType.Resolve ();
-
-                       if (IsInternal (type, master_info))
-                               return true;
-
-                       MethodDefinition method = member as MethodDefinition;
-                       FieldDefinition field = member as FieldDefinition;
-
-                       if (field == null && method == null)
-                               throw new System.NotSupportedException ("Members to scan should be methods or fields");
-
-                       if (!master_info) {
-
-                               if (method != null)
-                                       return !method.IsPublic;
-
-                               return !field.IsPublic;
-                       }
-
-                       master_info_file = FindMasterInfoFile (type.Module.Assembly.Name.Name);
-                       if (master_info_file == null)
-                               return IsInternal (member, false);
-
-                       string xpath_type = GetXPathSearchForType (type);
-                       string name;
-                       if (field != null)
-                               name = field.Name;
-                       else {
-                               name = method.ToString ();
-
-                               //lame, I know...
-                               name = WackyOutArgs (WackyCommas (name.Substring (name.IndexOf ("::") + 2)
-                                                   .Replace ("/", "+") // nested classes
-                                                   .Replace ('<', '[').Replace ('>', ']'))); //generic params
-                       }
-
-                       if (field != null || !IsPropertyMethod (method))
-                               return !NodeExists (master_info_file, xpath_type + String.Format ("/*/*[@name='{0}']", name));
-
-                       return !NodeExists (master_info_file, xpath_type + String.Format ("/properties/*/*/*[@name='{0}']", name));
-               }
-
-               //at some point I want to get rid of this method and ask cecil's maintainer to spew commas in a uniform way...
-               static string WackyCommas (string method)
-               {
-                       string outstring = String.Empty;
-                       bool square_bracket = false;
-                       foreach (char c in method) {
-                               if (c == '[')
-                                       square_bracket = true;
-                               else if (c == ']')
-                                       square_bracket = false;
-
-                               outstring = outstring + c;
-
-                               if (c == ',' && !square_bracket)
-                                       outstring = outstring + " ";
-                       }
-                       return outstring;
-               }
-
-               //ToString() spews & but not 'out' keyword
-               static string WackyOutArgs (string method)
-               {
-                       return Regex.Replace (method, @"\w+&", delegate (Match m) { return "out " + m.ToString (); });
-               }
-
-               //copied from MarkStep (violating DRY unless I can put this in a better place... Cecil?)
-               static bool IsPropertyMethod (MethodDefinition md)
-               {
-                       return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 ||
-                               (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0;
-               }
-
-               static Dictionary<string, XPathNavigator> navs = new Dictionary<string, XPathNavigator> ();
-               static List<FileStream> streams = new List<FileStream> ();
-
-               static bool NodeExists (string file, string xpath)
-               {
-                       Console.Write (".");
-                       //Console.WriteLine ("Looking for node {0} in file {1}", xpath, file.Substring (file.LastIndexOf ("/") + 1));
-
-                       XPathNavigator nav = null;
-                       if (!navs.TryGetValue (file, out nav)) {
-                               FileStream stream = new FileStream (file, FileMode.Open);
-                               XPathDocument document = new XPathDocument (stream);
-                               nav = document.CreateNavigator ();
-                               streams.Add (stream);
-                               navs [file] = nav;
-                       }
-                       return nav.SelectSingleNode (xpath) != null;
-               }
-
-               IList /*List<IAnnotationProvider>*/ ExtractUsedProviders (params IList[] members)
-               {
-                       IList used = new ArrayList ();
-                       if (members == null || members.Length == 0)
-                               return used;
-
-                       foreach (IList members_list in members)
-                               foreach (IMetadataTokenProvider provider in members_list)
-                                       if (Annotations.IsMarked (provider))
-                                               used.Add (provider);
-
-                       return used;
-               }
-
-               class TypeComparer : IComparer <TypeDefinition> {
-
-                       public int Compare (TypeDefinition x, TypeDefinition y)
-                       {
-                               return string.Compare (x.ToString (), y.ToString ());
-                       }
-
-               }
-
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs
deleted file mode 100644 (file)
index 2971b11..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// MoonlightA11yProcessor.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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.Linq;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yProcessor : InjectSecurityAttributes {
-
-               protected override bool ConditionToProcess ()
-               {
-                       return true;
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       _assembly = assembly;
-
-                       // remove existing [SecurityCritical] and [SecuritySafeCritical]
-                       RemoveSecurityAttributes ();
-
-                       // add [SecurityCritical]
-                       AddSecurityAttributes ();
-
-                       // convert all public members into internal
-                       MakeApiInternal ();
-               }
-
-               void MakeApiInternal ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               if (type.IsPublic)
-                                       type.IsPublic = false;
-
-                               if (type.HasMethods && !type.Name.EndsWith ("Adapter"))
-                                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                                               if (ctor.IsPublic)
-                                                       ctor.IsAssembly = true;
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor))
-                                               if (method.IsPublic)
-                                                       method.IsAssembly = true;
-                       }
-               }
-
-               void AddSecurityAttributes ()
-               {
-                       foreach (TypeDefinition type in _assembly.MainModule.Types) {
-                               AddCriticalAttribute (type);
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition ctor in type.Methods.Where (m => m.IsConstructor))
-                                               AddCriticalAttribute (ctor);
-
-                               if (type.HasMethods)
-                                       foreach (MethodDefinition method in type.Methods.Where (m => !m.IsConstructor)) {
-                                               MethodDefinition parent = null;
-
-                                               //TODO: take in account generic params
-                                               if (!method.HasGenericParameters) {
-
-                                                       /*
-                                                        * we need to scan base methods because the CoreCLR complains about SC attribs added
-                                                        * to overriden methods whose base (virtual or interface) method is not marked as SC
-                                                        * with TypeLoadExceptions
-                                                        */
-                                                       parent = GetBaseMethod (type, method);
-                                               }
-
-                                               //if there's no base method
-                                               if (parent == null ||
-
-                                               //if it's our bridge assembly, we're sure it will (finally, at the end of the linking process) have the SC attrib
-                                                   _assembly.MainModule.Types.Contains (parent.DeclaringType) ||
-
-                                               //if the type is in the moonlight assemblies, check if it has the SC attrib
-                                                   HasSecurityAttribute (parent, AttributeType.Critical))
-
-                                                       AddCriticalAttribute (method);
-                               }
-
-                       }
-               }
-
-               MethodDefinition GetBaseMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       // both GetOverridenMethod and GetInterfaceMethod return null if there is no base method
-                       return GetOverridenMethod (finalType, final) ?? GetInterfaceMethod (finalType, final);
-               }
-
-               //note: will not return abstract methods
-               MethodDefinition GetOverridenMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       TypeReference baseType = finalType.BaseType;
-                       while (baseType != null && baseType.Resolve () != null) {
-                               foreach (MethodDefinition method in baseType.Resolve ().Methods) {
-                                       if (!method.IsVirtual || method.Name != final.Name)
-                                               continue;
-
-                                       //TODO: should we discard them?
-                                       if (method.IsAbstract)
-                                               continue;
-
-                                       if (HasSameSignature (method, final))
-                                               return method;
-                               }
-                               baseType = baseType.Resolve().BaseType;
-                       }
-                       return null;
-               }
-
-               MethodDefinition GetInterfaceMethod (TypeDefinition finalType, MethodDefinition final)
-               {
-                       TypeDefinition baseType = finalType;
-                       while (baseType != null) {
-                               if (baseType.HasInterfaces)
-                                       foreach (var @interface in baseType.Interfaces)
-                                               foreach (MethodDefinition method in @interface.InterfaceType.Resolve ().Methods)
-                                                       if (method.Name == final.Name && HasSameSignature (method, final))
-                                                               return method;
-
-                               baseType = baseType.BaseType == null ? null : baseType.BaseType.Resolve ();
-                       }
-                       return null;
-               }
-
-               bool HasSameSignature (MethodDefinition method1, MethodDefinition method2)
-               {
-                       if (method1.ReturnType.FullName != method2.ReturnType.FullName)
-                               return false;
-
-                       if (method1.Parameters.Count != method2.Parameters.Count)
-                               return false;
-
-                       for (int i = 0; i < method1.Parameters.Count; i++) {
-                               if (method1.Parameters [i].ParameterType.FullName !=
-                                   method2.Parameters [i].ParameterType.FullName)
-                                       return false;
-                       }
-
-                       return true;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightA11yUsageInspectionStep.cs
deleted file mode 100644 (file)
index 27aa4a2..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// MoonlightA11yUsageInspectionStep.cs
-//
-// Author:
-//   Andrés G. Aragoneses (aaragoneses@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightA11yUsageInspectionStep : MoonlightAssemblyStep {
-
-               protected override void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.ReplaceStep (typeof (MarkStep), new MoonlightA11yApiMarker ());
-                       pipeline.ReplaceStep (typeof (SweepStep), new MoonlightA11yDescriptorGenerator ());
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.RemoveStep (typeof (OutputStep));
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs b/mcs/tools/tuner/Mono.Tuner/MoonlightAssemblyStep.cs
deleted file mode 100644 (file)
index fc98536..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// MoonlightAssemblyStep.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.IO;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class MoonlightAssemblyStep : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       CustomizePipeline (context.Pipeline);
-                       ProcessAssemblies (context);
-               }
-
-               static void ProcessAssemblies (LinkContext context)
-               {
-                       foreach (AssemblyDefinition assembly in context.GetAssemblies ())
-                               context.Annotations.SetAction (assembly, AssemblyAction.Link);
-               }
-
-               protected virtual void CustomizePipeline (Pipeline pipeline)
-               {
-                       pipeline.RemoveStep (typeof (LoadI18nAssemblies));
-                       pipeline.RemoveStep (typeof (BlacklistStep));
-                       pipeline.RemoveStep (typeof (TypeMapStep));
-                       pipeline.RemoveStep (typeof (MarkStep));
-                       pipeline.RemoveStep (typeof (SweepStep));
-                       pipeline.RemoveStep (typeof (CleanStep));
-                       pipeline.RemoveStep (typeof (RegenerateGuidStep));
-                       pipeline.AddStepBefore (typeof (OutputStep), new InjectSecurityAttributes ());
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs b/mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs
deleted file mode 100644 (file)
index 18dbe7f..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Tuner {
-
-       public class PreserveCrypto : IStep {
-
-               AnnotationStore annotations;
-
-               public void Process (LinkContext context)
-               {
-                       annotations = context.Annotations;
-
-                       ProcessCorlib (context);
-                       ProcessSystemCore (context);
-               }
-
-               void ProcessCorlib (LinkContext context)
-               {
-                       AssemblyDefinition corlib;
-                       if (!context.TryGetLinkedAssembly ("mscorlib", out corlib))
-                               return;
-
-                       AddPreserveInfo (corlib, "DES", "DESCryptoServiceProvider");
-                       AddPreserveInfo (corlib, "DSA", "DSACryptoServiceProvider");
-                       AddPreserveInfo (corlib, "RandomNumberGenerator", "RNGCryptoServiceProvider");
-                       AddPreserveInfo (corlib, "SHA1", "SHA1CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "SHA1", "SHA1Managed");
-                       AddPreserveInfo (corlib, "MD5", "MD5CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "RC2", "RC2CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "TripleDES", "TripleDESCryptoServiceProvider");
-
-                       AddPreserveInfo (corlib, "Rijndael", "RijndaelManaged");
-                       AddPreserveInfo (corlib, "RIPEMD160", "RIPEMD160Managed");
-                       AddPreserveInfo (corlib, "SHA256", "SHA256Managed");
-                       AddPreserveInfo (corlib, "SHA384", "SHA384Managed");
-                       AddPreserveInfo (corlib, "SHA512", "SHA512Managed");
-
-                       AddPreserveInfo (corlib, "HMAC", "HMACMD5");
-                       AddPreserveInfo (corlib, "HMAC", "HMACRIPEMD160");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA1");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA256");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA384");
-                       AddPreserveInfo (corlib, "HMAC", "HMACSHA512");
-
-                       AddPreserveInfo (corlib, "HMACMD5", "MD5CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "HMACRIPEMD160", "RIPEMD160Managed");
-                       AddPreserveInfo (corlib, "HMACSHA1", "SHA1CryptoServiceProvider");
-                       AddPreserveInfo (corlib, "HMACSHA1", "SHA1Managed");
-                       AddPreserveInfo (corlib, "HMACSHA256", "SHA256Managed");
-                       AddPreserveInfo (corlib, "HMACSHA384", "SHA384Managed");
-                       AddPreserveInfo (corlib, "HMACSHA512", "SHA512Managed");
-
-                       TryAddPreserveInfo (corlib, "Aes", "AesManaged");
-
-                       var corlibAes = GetCryptoType (corlib, "Aes");
-                       Preserve (corlibAes, GetCryptoType (corlib, "AesManaged"));
-
-                       AssemblyDefinition syscore;
-                       if (context.TryGetLinkedAssembly ("System.Core", out syscore))
-                               Preserve (corlibAes, GetCryptoType (syscore, "AesCryptoServiceProvider"));
-               }
-
-               void ProcessSystemCore (LinkContext context)
-               {
-                       AssemblyDefinition syscore;
-                       if (!context.TryGetLinkedAssembly ("System.Core", out syscore))
-                               return;
-
-                       // AddPreserveInfo (syscore, "Aes", "AesCryptoServiceProvider");
-                       TryAddPreserveInfo (syscore, "Aes", "AesManaged");
-               }
-
-               bool TryAddPreserveInfo (AssemblyDefinition assembly, string name, string type)
-               {
-                       var marker = GetCryptoType (assembly, name);
-                       if (marker == null)
-                               return false;
-
-                       var implementation = GetCryptoType (assembly, type);
-                       if (implementation == null)
-                               return false;
-
-                       Preserve (marker, implementation);
-                       return true;
-               }
-
-               void AddPreserveInfo (AssemblyDefinition assembly, string name, string type)
-               {
-                       var marker = GetCryptoType (assembly, name);
-                       if (marker == null)
-                               throw new ArgumentException (name);
-
-                       var implementation = GetCryptoType (assembly, type);
-                       if (implementation == null)
-                               throw new ArgumentException (type);
-
-                       Preserve (marker, implementation);
-               }
-
-               void Preserve (TypeDefinition marker, TypeDefinition implementation)
-               {
-                       if (marker == null || implementation == null)
-                               return;
-                       foreach (var constructor in implementation.GetConstructors ())
-                               annotations.AddPreservedMethod (marker, constructor);
-               }
-
-               TypeDefinition GetCryptoType (AssemblyDefinition assembly, string name)
-               {
-                       return assembly.MainModule.GetType ("System.Security.Cryptography." + name);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs b/mcs/tools/tuner/Mono.Tuner/PreserveHttps.cs
deleted file mode 100644 (file)
index c3c56c7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.IO;
-using System.Xml.XPath;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PreserveHttps : BaseStep {
-
-               static string [] types = new [] {
-                       "System.Net.WebRequest",
-                       "System.Net.WebClient",
-                       "System.Net.Security.RemoteCertificateValidationCallback",
-                       "System.Web.Services.Protocols.WebClientProtocol",
-                       "System.Security.Cryptography.X509Certificates.X509Certificate",
-                       "System.ServiceModel.ClientBase`1",
-                       "System.Web.Services.WebServiceBindingAttribute",
-                       "System.Web.Services.Protocols.SoapHttpClientProtocol",
-                       "System.Xml.XmlDocument"
-               };
-
-               bool need_https;
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (need_https)
-                               return;
-
-                       if (Profile.IsSdkAssembly (assembly) || Profile.IsProductAssembly (assembly))
-                               return;
-
-                       if (HasNeededReference (assembly.MainModule))
-                               need_https = true;
-               }
-
-               static bool HasNeededReference (ModuleDefinition module)
-               {
-                       foreach (var type in types)
-                               if (module.HasTypeReference (type))
-                                       return true;
-
-                       return false;
-               }
-
-               protected override void EndProcess ()
-               {
-                       if (!need_https)
-                               return;
-
-                       var mono_security = Context.Resolve ("Mono.Security");
-                       if (mono_security == null)
-                               return;
-
-                       if (Annotations.GetAction (mono_security) != AssemblyAction.Link)
-                               return;
-
-                       var xml_preserve = CreatePreserveStep ();
-                       Context.Pipeline.AddStepAfter (typeof (PreserveHttps), xml_preserve);
-//                     Context.Pipeline.AddStepAfter (xml_preserve, new PreserveCrypto ());
-               }
-
-               static IStep CreatePreserveStep ()
-               {
-                       return new ResolveFromXmlStep (
-                               new XPathDocument (
-                                       new StringReader (descriptor)));
-               }
-
-               const string descriptor = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
-<linker>
-       <assembly fullname=""Mono.Security"">
-               <type fullname=""Mono.Security.Protocol.Tls.HttpsClientStream"" />
-               <type fullname=""Mono.Security.Protocol.Tls.SslClientStream"" />
-               <type fullname=""Mono.Security.Protocol.Tls.SslStreamBase"" />
-       </assembly>
-</linker>
-";
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs b/mcs/tools/tuner/Mono.Tuner/PreserveSoapHttpClients.cs
deleted file mode 100644 (file)
index bdb04a9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-
-using Mono.Linker;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PreserveSoapHttpClients : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get { return SubStepTargets.Type; }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link && !Profile.IsSdkAssembly (assembly);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (IsWebServiceClient (type))
-                               PreserveClient (type);
-               }
-
-               void PreserveClient (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               string sync_method;
-                               if (!TryExtractSyncMethod (method, out sync_method))
-                                       continue;
-
-                               AddPreservedMethod (method, sync_method);
-                       }
-               }
-
-               void AddPreservedMethod (MethodDefinition target, string methodName)
-               {
-                       foreach (MethodDefinition method in target.DeclaringType.Methods)
-                               if (method.Name == methodName)
-                                       Annotations.AddPreservedMethod (target, method);
-               }
-
-               static bool TryExtractSyncMethod (MethodDefinition method, out string sync_method)
-               {
-                       if (TryExtractPrefixedMethodName ("Begin", method.Name, out sync_method))
-                               return true;
-
-                       if (TryExtractPrefixedMethodName ("End", method.Name, out sync_method))
-                               return true;
-
-                       if (TryExtractSuffixedMethodName ("Async", method.Name, out sync_method))
-                               return true;
-
-                       return false;
-               }
-
-               static bool TryExtractPrefixedMethodName (string prefix, string fullName, out string methodName)
-               {
-                       methodName = null;
-
-                       int pos = fullName.IndexOf (prefix, StringComparison.Ordinal);
-                       if (pos == -1)
-                               return false;
-
-                       methodName = fullName.Substring (prefix.Length);
-                       return true;
-               }
-
-               static bool TryExtractSuffixedMethodName (string suffix, string fullName, out string methodName)
-               {
-                       methodName = null;
-
-                       int pos = fullName.LastIndexOf (suffix, StringComparison.Ordinal);
-                       if (pos == -1)
-                               return false;
-
-                       methodName = fullName.Substring (0, pos);
-                       return true;
-               }
-
-               static bool IsWebServiceClient (TypeDefinition type)
-               {
-                       return type.Inherits ("System.Web.Services.Protocols", "SoapHttpClientProtocol");
-               }
-       }
-}
\ No newline at end of file
diff --git a/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs b/mcs/tools/tuner/Mono.Tuner/PrintStatus.cs
deleted file mode 100644 (file)
index 374395b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// PrintStatus.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PrintStatus : BaseStep {
-
-               static string display_internalized = "display_internalized";
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       Console.WriteLine ("Assembly `{0}' ({1}) tuned", assembly.Name, assembly.MainModule.FullyQualifiedName);
-
-                       if (!DisplayInternalized ())
-                               return;
-
-                       foreach (TypeDefinition type in assembly.MainModule.Types)
-                               ProcessType (type);
-               }
-
-               bool DisplayInternalized ()
-               {
-                       try {
-                               return bool.Parse (Context.GetParameter (display_internalized));
-                       } catch {
-                               return false;
-                       }
-               }
-
-               void ProcessType (TypeDefinition type)
-               {
-                       ProcessCollection (type.Fields);
-                       ProcessCollection (type.Methods);
-               }
-
-               void ProcessCollection (ICollection collection)
-               {
-                       foreach (IMetadataTokenProvider provider in collection)
-                               ProcessProvider (provider);
-               }
-
-               void ProcessProvider (IMetadataTokenProvider provider)
-               {
-                       if (!TunerAnnotations.IsInternalized (Context, provider))
-                               return;
-
-                       Console.WriteLine ("[internalized] {0}", provider);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs b/mcs/tools/tuner/Mono.Tuner/PrintTypeMap.cs
deleted file mode 100644 (file)
index 8838b1a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// PrintTypeMap.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2009 Novell, Inc.
-//
-// 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;
-using System.Collections.Generic;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class PrintTypeMap : BaseStep {
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       foreach (TypeDefinition type in assembly.MainModule.GetAllTypes ())
-                               PrintMap (type);
-               }
-
-               void PrintMap (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               return;
-
-                       Console.WriteLine ("Type {0} map", type);
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               Console.WriteLine ("  Method {0} map", method);
-
-                               IEnumerable<MethodDefinition> overrides = Annotations.GetOverrides (method);
-                               foreach (var @override in overrides ?? new MethodDefinition [0])
-                                       Console.WriteLine ("    HasOverride {0}", @override);
-
-                               IEnumerable<MethodDefinition> bases = Annotations.GetBaseMethods (method);
-                               foreach (var @base in bases ?? new MethodDefinition [0])
-                                       Console.WriteLine ("    Base {0}", @base);
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/Profile.cs b/mcs/tools/tuner/Mono.Tuner/Profile.cs
deleted file mode 100644 (file)
index 54cfffa..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class Profile {
-
-               static Profile current;
-
-               public static Profile Current {
-                       get {
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoTouch");
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoDroid");
-                               if (current != null)
-                                       return current;
-
-                               current = CreateProfile ("MonoMac");
-                               if (current != null)
-                                       return current;
-
-                               throw new NotSupportedException ("No active profile");
-                       }
-                       set {
-                               current = value;
-                       }
-               }
-
-               static Profile CreateProfile (string name)
-               {
-                       var type = Type.GetType (string.Format ("{0}.Tuner.{0}Profile", name));
-                       if (type == null)
-                               return null;
-
-                       return (Profile) Activator.CreateInstance (type);
-               }
-
-               public static bool IsSdkAssembly (AssemblyDefinition assembly)
-               {
-                       return Current.IsSdk (assembly);
-               }
-
-               public static bool IsSdkAssembly (string assemblyName)
-               {
-                       return Current.IsSdk (assemblyName);
-               }
-
-               public static bool IsProductAssembly (AssemblyDefinition assembly)
-               {
-                       return Current.IsProduct (assembly);
-               }
-
-               public static bool IsProductAssembly (string assemblyName)
-               {
-                       return Current.IsProduct (assemblyName);
-               }
-
-               protected virtual bool IsSdk (AssemblyDefinition assembly)
-               {
-                       return IsSdk (assembly.Name.Name);
-               }
-               
-               protected virtual bool IsProduct (AssemblyDefinition assembly)
-               {
-                       return IsProduct (assembly.Name.Name);
-               }
-
-               protected abstract bool IsSdk (string assemblyName);
-               protected abstract bool IsProduct (string assemblyName);
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs b/mcs/tools/tuner/Mono.Tuner/RemoveAttributesBase.cs
deleted file mode 100644 (file)
index 6110180..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public abstract class RemoveAttributesBase : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Assembly
-                                       | SubStepTargets.Type
-                                       | SubStepTargets.Field
-                                       | SubStepTargets.Method
-                                       | SubStepTargets.Property
-                                       | SubStepTargets.Event;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessAttributeProvider (assembly);
-                       ProcessAttributeProvider (assembly.MainModule);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       ProcessAttributeProvider (type);
-
-                       if (type.HasGenericParameters)
-                               ProcessAttributeProviderCollection (type.GenericParameters);
-               }
-
-               void ProcessAttributeProviderCollection (IList list)
-               {
-                       for (int i = 0; i < list.Count; i++)
-                               ProcessAttributeProvider ((ICustomAttributeProvider) list [i]);
-               }
-
-               public override void ProcessField (FieldDefinition field)
-               {
-                       ProcessAttributeProvider (field);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessMethodAttributeProvider (method);
-               }
-
-               void ProcessMethodAttributeProvider (MethodDefinition method)
-               {
-                       ProcessAttributeProvider (method);
-                       ProcessAttributeProvider (method.MethodReturnType);
-
-                       if (method.HasParameters)
-                               ProcessAttributeProviderCollection (method.Parameters);
-
-                       if (method.HasGenericParameters)
-                               ProcessAttributeProviderCollection (method.GenericParameters);
-               }
-
-               public override void ProcessProperty (PropertyDefinition property)
-               {
-                       ProcessAttributeProvider (property);
-               }
-
-               public override void ProcessEvent (EventDefinition @event)
-               {
-                       ProcessAttributeProvider (@event);
-               }
-
-               void ProcessAttributeProvider (ICustomAttributeProvider provider)
-               {
-                       if (!provider.HasCustomAttributes)
-                               return;
-
-                       for (int i = 0; i < provider.CustomAttributes.Count; i++) {
-                               var attrib = provider.CustomAttributes [i];
-                               if (!IsRemovedAttribute (attrib))
-                                       continue;
-
-                               WillRemoveAttribute (provider, attrib);
-                               provider.CustomAttributes.RemoveAt (i--);
-                       }
-               }
-
-               protected abstract bool IsRemovedAttribute (CustomAttribute attribute);
-               protected virtual void WillRemoveAttribute (ICustomAttributeProvider provider, CustomAttribute attribute) { }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveResources.cs b/mcs/tools/tuner/Mono.Tuner/RemoveResources.cs
deleted file mode 100644 (file)
index 7edc44f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveResources : IStep {
-
-               readonly I18nAssemblies assemblies;
-
-               public RemoveResources (I18nAssemblies assemblies)
-               {
-                       this.assemblies = assemblies;
-               }
-
-               public virtual void Process (LinkContext context)
-               {
-                       AssemblyDefinition assembly;
-                       if (!context.TryGetLinkedAssembly ("mscorlib", out assembly))
-                               return;
-
-                       // skip this if we're not linking mscorlib, e.g. --linkskip=mscorlib
-                       if (context.Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       var resources = assembly.MainModule.Resources;
-
-                       for (int i = 0; i < resources.Count; i++) {
-                               var resource = resources [i] as EmbeddedResource;
-                               if (resource == null)
-                                       continue;
-
-                               switch (resource.Name) {
-                               case "collation.core.bin":
-                               case "collation.tailoring.bin":
-                                       continue;
-                               default:
-                                       if (!resource.Name.Contains ("cjk"))
-                                               continue;
-                                       if (IncludeCJK ())
-                                               continue;
-
-                                       resources.RemoveAt (i--);
-                                       break;
-                               }
-                       }
-               }
-
-               bool IncludeCJK ()
-               {
-                       return (assemblies & I18nAssemblies.CJK) != 0;
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs b/mcs/tools/tuner/Mono.Tuner/RemoveSecurity.cs
deleted file mode 100644 (file)
index 2704564..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveSecurity : BaseSubStep {
-
-               public override SubStepTargets Targets {
-                       get {
-                               return SubStepTargets.Assembly
-                                       | SubStepTargets.Type
-                                       | SubStepTargets.Method;
-                       }
-               }
-
-               public override bool IsActiveFor (AssemblyDefinition assembly)
-               {
-                       return Annotations.GetAction (assembly) == AssemblyAction.Link;
-               }
-
-               public override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       ProcessSecurityProvider (assembly);
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       ProcessSecurityProvider (type);
-               }
-
-               public override void ProcessMethod (MethodDefinition method)
-               {
-                       ProcessSecurityProvider (method);
-               }
-
-               static void ProcessSecurityProvider (ISecurityDeclarationProvider provider)
-               {
-                       if (!provider.HasSecurityDeclarations)
-                               return;
-
-                       provider.SecurityDeclarations.Clear ();
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs b/mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs
deleted file mode 100644 (file)
index d38aef1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// RemoveSerialization.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-
-namespace Mono.Tuner {
-
-       public class RemoveSerialization : BaseStep {
-
-               static readonly string _Serialization = "System.Runtime.Serialization";
-               static readonly string _ISerializable = Concat (_Serialization, "ISerializable");
-               static readonly string _IDeserializationCallback = Concat (_Serialization, "IDeserializationCallback");
-               static readonly string _SerializationInfo = Concat (_Serialization, "SerializationInfo");
-               static readonly string _StreamingContext = Concat (_Serialization, "StreamingContext");
-
-               static readonly string _GetObjectData = "GetObjectData";
-               static readonly string _OnDeserialization = "OnDeserialization";
-
-               static string Concat (string lhs, string rhs)
-               {
-                       return string.Concat (lhs, ".", rhs);
-               }
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (assembly.Name.Name == "mscorlib")
-                               return;
-
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       foreach (ModuleDefinition module in assembly.Modules)
-                               foreach (TypeDefinition type in module.Types)
-                                       ProcessType (type);
-               }
-
-               static void RemoveInterface (TypeDefinition type, string name)
-               {
-                       for (int i = 0; i < type.Interfaces.Count; i++) {
-                               TypeReference iface = type.Interfaces [i].InterfaceType;
-                               if (iface.FullName == name) {
-                                       type.Interfaces.RemoveAt (i);
-                                       return;
-                               }
-                       }
-               }
-
-               static void RemoveSerializableFlag (TypeDefinition type)
-               {
-                       type.Attributes &= ~TypeAttributes.Serializable;
-               }
-
-               static void ProcessType (TypeDefinition type)
-               {
-                       RemoveSerializableFlag (type);
-
-                       RemoveInterface (type, _ISerializable);
-                       RemoveMethod (type, ".ctor", _SerializationInfo, _StreamingContext);
-                       RemoveInterfaceMethod (type, _ISerializable, _GetObjectData, _SerializationInfo, _StreamingContext);
-
-                       RemoveInterface (type, _IDeserializationCallback);
-                       RemoveInterfaceMethod (type, _IDeserializationCallback, _OnDeserialization, "System.Object");
-
-                       RemoveField (type);
-               }
-
-               static void RemoveField (TypeDefinition type)
-               {
-                       for (int i = 0; i < type.Fields.Count; i++) {
-                               FieldDefinition field = type.Fields [i];
-                               if (field.FieldType.FullName == _SerializationInfo) {
-                                       type.Fields.RemoveAt (i);
-                                       break;
-                               }
-                       }
-               }
-
-               static bool ParametersMatch (IMethodSignature meth, string [] parameters)
-               {
-                       for (int i = 0; i < parameters.Length; i++) {
-                               ParameterDefinition param = meth.Parameters [i];
-                               if (param.ParameterType.FullName != parameters [i])
-                                       return false;
-                       }
-
-                       return true;
-               }
-
-               static void RemoveInterfaceMethod (TypeDefinition type, string iface, string method, params string [] parameters)
-               {
-                       RemoveMethod (type, method, parameters);
-                       RemoveMethod (type, Concat (iface, method), parameters);
-               }
-
-               static void RemoveMethod (TypeDefinition type, string name, params string [] parameters)
-               {
-                       RemoveMethod (type.Methods, name, parameters);
-               }
-
-               static void RemoveMethod (IList container, string name, params string [] parameters)
-               {
-                       for (int i = 0; i < container.Count; i++) {
-                               MethodDefinition method = (MethodDefinition) container [i];
-                               if (method.Name != name)
-                                       continue;
-
-                               if (method.Parameters.Count != parameters.Length)
-                                       continue;
-
-                               if (!ParametersMatch (method, parameters))
-                                       continue;
-
-                               container.RemoveAt (i);
-                               return;
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs b/mcs/tools/tuner/Mono.Tuner/TunerAnnotations.cs
deleted file mode 100644 (file)
index 2107ac4..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// TunerAnnotations.cs
-//
-// Author:
-//   Jb Evain (jbevain@novell.com)
-//
-// (C) 2007 Novell, Inc.
-//
-// 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 Mono.Cecil;
-using Mono.Linker;
-
-namespace Mono.Tuner {
-
-       public class TunerAnnotations {
-
-               static readonly object _internalizedKey = new object ();
-
-               public static void Internalized (LinkContext context, IMetadataTokenProvider provider)
-               {
-                       var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
-                       annotations [provider] = _internalizedKey;
-               }
-
-               public static bool IsInternalized (LinkContext context, IMetadataTokenProvider provider)
-               {
-                       var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey);
-
-                       return annotations.ContainsKey (provider);
-               }
-
-               private TunerAnnotations ()
-               {
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs b/mcs/tools/tuner/MonoMac.Tuner/ApplyPreserveAttribute.cs
deleted file mode 100644 (file)
index d7c49b8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       public class ApplyPreserveAttribute : ApplyPreserveAttributeBase {
-
-               protected override string PreserveAttribute {
-                       get { return "MonoMac.Foundation.PreserveAttribute"; }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/Extensions.cs b/mcs/tools/tuner/MonoMac.Tuner/Extensions.cs
deleted file mode 100644 (file)
index ec7fd1f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Cecil;
-
-using Mono.Linker;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
-       static class Extensions {
-
-               const string NSObject = "MonoMac.Foundation.NSObject";
-               const string INativeObject = "MonoMac.ObjCRuntime.INativeObject";
-
-               public static bool IsNSObject (this TypeDefinition type)
-               {
-                       return type.Inherits (NSObject);
-               }
-
-               public static bool IsNativeObject (this TypeDefinition type)
-               {
-                       return type.Implements (INativeObject);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs b/mcs/tools/tuner/MonoMac.Tuner/MarkNSObjects.cs
deleted file mode 100644 (file)
index 163decc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// MarkNSObjects.cs
-//
-// Authors:
-//     Jb Evain (jbevain@novell.com)
-//     Sebastien Pouliot  <sebastien@xamarin.com>
-//
-// (C) 2009 Novell, Inc.
-// Copyright (C) 2011 Xamarin, Inc.
-//
-// 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 Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       public class MarkNSObjects : MarkNSObjectsBase {
-
-               protected override string ExportAttribute {
-                       get { return "MonoMac.Foundation.ExportAttribute"; }
-               }
-
-               public override void ProcessType (TypeDefinition type)
-               {
-                       if (!type.IsNSObject () || !type.IsNativeObject ())
-                               return;
-
-                       base.ProcessType (type);
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs b/mcs/tools/tuner/MonoMac.Tuner/MethodMapInjection.cs
deleted file mode 100644 (file)
index ebb2407..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace MonoMac.Tuner {
-
-       public class MethodMapInjection : BaseStep {
-
-               struct ExportedMethod {
-                       public readonly CustomAttribute attribute;
-                       public readonly MethodDefinition method;
-
-                       public ExportedMethod (CustomAttribute attribute, MethodDefinition method)
-                       {
-                               this.attribute = attribute;
-                               this.method = method;
-                       }
-               }
-
-               ModuleDefinition module;
-
-               bool imported;
-               TypeReference void_type;
-               TypeReference dictionary_intptr_methoddesc;
-               MethodReference dictionary_intptr_methoddesc_ctor;
-               MethodReference dictionary_intptr_methoddesc_set_item;
-               MethodReference methoddesc_ctor;
-               MethodReference selector_get_handle;
-               MethodReference methodbase_get_method_from_handle;
-               MethodReference class_register_methods;
-               MethodReference type_get_type_from_handle;
-               FieldReference selector_init;
-
-               protected override void ProcessAssembly (AssemblyDefinition assembly)
-               {
-                       if (Annotations.GetAction (assembly) != AssemblyAction.Link)
-                               return;
-
-                       module = assembly.MainModule;
-
-                       foreach (TypeDefinition type in module.GetAllTypes ()) {
-                               if (!type.IsNSObject ())
-                                       continue;
-
-                               ProcessNSObject (type);
-                       }
-
-                       imported = false;
-               }
-
-               void PrepareImports ()
-               {
-                       if (imported)
-                               return;
-
-                       var corlib = Context.GetAssembly ("mscorlib");
-
-                       void_type = Import (corlib, "System.Void");
-
-                       var monomac = Context.GetAssembly ("MonoMac");
-
-                       var dictionary = Import (corlib, "System.Collections.Generic.Dictionary`2");
-
-                       var intptr = Import (corlib, "System.IntPtr");
-                       var method_desc = Import (monomac, "MonoMac.ObjCRuntime.MethodDescription");
-
-                       var dic_i_md = new GenericInstanceType (dictionary);
-                       dic_i_md.GenericArguments.Add (intptr);
-                       dic_i_md.GenericArguments.Add (method_desc);
-                       dictionary_intptr_methoddesc = dic_i_md;
-
-                       dictionary_intptr_methoddesc_ctor = Import (".ctor", dic_i_md, false, void_type, Import (corlib, "System.Int32"));
-
-                       dictionary_intptr_methoddesc_set_item = Import ("set_Item", dic_i_md, false, void_type,
-                               dictionary.GenericParameters [0],
-                               dictionary.GenericParameters [1]);
-
-                       methoddesc_ctor = Import (".ctor", method_desc, false, void_type,
-                               Import (corlib, "System.Reflection.MethodBase"),
-                               Import (monomac, "MonoMac.ObjCRuntime.ArgumentSemantic"));
-
-                       var selector = Import (monomac, "MonoMac.ObjCRuntime.Selector");
-
-                       selector_get_handle = Import ("GetHandle", selector, true, intptr, Import (corlib, "System.String"));
-                       selector_init = new FieldReference ("Init", selector, intptr);
-
-                       var methodbase = Import (corlib, "System.Reflection.MethodBase");
-
-                       methodbase_get_method_from_handle = Import ("GetMethodFromHandle", methodbase, true, methodbase, Import (corlib, "System.RuntimeMethodHandle"));
-
-                       var type = Import (corlib, "System.Type");
-
-                       type_get_type_from_handle = Import ("GetTypeFromHandle", type, true, type, Import (corlib, "System.RuntimeTypeHandle"));
-
-                       var @class = Import (monomac, "MonoMac.ObjCRuntime.Class");
-
-                       class_register_methods = Import ("RegisterMethods", @class, true, void_type, type, dic_i_md);
-
-                       imported = true;
-               }
-
-               MethodReference Import (string name, TypeReference declaring_type, bool @static, TypeReference return_type, params TypeReference [] parameters_type)
-               {
-                       var reference = new MethodReference (name, return_type, declaring_type) {
-                               HasThis = !@static,
-                               ExplicitThis = false,
-                               CallingConvention = MethodCallingConvention.Default,
-                       };
-
-                       foreach (var parameter_type in parameters_type)
-                               reference.Parameters.Add (new ParameterDefinition (parameter_type));
-
-                       return reference;
-               }
-
-               TypeReference Import (TypeReference type)
-               {
-                       return module.Import (type);
-               }
-
-               TypeReference Import (AssemblyDefinition assembly, string type_name)
-               {
-                       return Import (assembly.MainModule.GetType (type_name));
-               }
-
-               void ProcessNSObject (TypeDefinition type)
-               {
-                       var exported = new List<ExportedMethod> ();
-
-                       if (type.HasMethods) {
-                               ProcessMethods (type, exported);
-                               ProcessConstructors (type, exported);
-                       }
-
-                       if (exported.Count == 0)
-                               return;
-
-                       InjectMethodMap (type, exported);
-               }
-
-               void InjectMethodMap (TypeDefinition type, List<ExportedMethod> exported_methods)
-               {
-                       PrepareImports ();
-
-                       var cctor = GetTypeConstructor (type);
-
-                       var selectors = MapSelectors (cctor);
-
-                       var map = new VariableDefinition (dictionary_intptr_methoddesc);
-                       map.Name = "$method_map";
-                       cctor.Body.Variables.Add (map);
-                       cctor.Body.SimplifyMacros ();
-
-                       var il = cctor.Body.GetILProcessor ();
-
-                       var instructions = new List<Instruction> {
-                               il.Create (OpCodes.Ldc_I4, exported_methods.Count),
-                               il.Create (OpCodes.Newobj, dictionary_intptr_methoddesc_ctor),
-                               il.Create (OpCodes.Stloc, map),
-                       };
-
-                       foreach (var exported in exported_methods) {
-
-                               instructions.Add (il.Create (OpCodes.Ldloc, map));
-
-                               if (!IsDefaultConstructor (exported)) {
-                                       var selector_name = GetSelectorName (exported);
-                                       FieldReference selector;
-
-                                       if (selectors != null && selectors.TryGetValue (selector_name, out selector)) {
-                                               instructions.Add (il.Create (OpCodes.Ldsfld, selector));
-                                       } else {
-                                               instructions.AddRange (new [] {
-                                                       il.Create (OpCodes.Ldstr, selector_name),
-                                                       il.Create (OpCodes.Call, selector_get_handle),
-                                               });
-                                       }
-                               } else
-                                       instructions.Add (il.Create (OpCodes.Ldsfld, selector_init));
-
-                               instructions.AddRange (new [] {
-                                       il.Create (OpCodes.Ldtoken, exported.method),
-                                       il.Create (OpCodes.Call, methodbase_get_method_from_handle),
-                                       il.Create (OpCodes.Ldc_I4, GetArgumentSemantic (exported)),
-                                       il.Create (OpCodes.Newobj, methoddesc_ctor),
-                                       il.Create (OpCodes.Callvirt, dictionary_intptr_methoddesc_set_item),
-                               });
-                       }
-
-                       instructions.AddRange (new [] {
-                               il.Create (OpCodes.Ldtoken, type),
-                               il.Create (OpCodes.Call, type_get_type_from_handle),
-                               il.Create (OpCodes.Ldloc, map),
-                               il.Create (OpCodes.Call, class_register_methods),
-                       });
-
-                       Append (il, instructions);
-
-                       cctor.Body.OptimizeMacros ();
-               }
-
-               static Dictionary<string, FieldReference> MapSelectors (MethodDefinition cctor)
-               {
-                       var instructions = cctor.Body.Instructions;
-                       Dictionary<string, FieldReference> selectors = null;
-
-                       for (int i = 0; i < instructions.Count; i++) {
-                               var instruction = instructions [i];
-
-                               FieldReference field;
-                               if (!IsCreateSelector (instruction, out field))
-                                       continue;
-
-                               if (selectors == null)
-                                       selectors = new Dictionary<string, FieldReference> ();
-
-                               selectors.Add ((string) instruction.Operand, field);
-                       }
-
-                       return selectors;
-               }
-
-               static bool IsCreateSelector (Instruction instruction, out FieldReference field)
-               {
-                       field = null;
-
-                       if (instruction.OpCode != OpCodes.Ldstr)
-                               return false;
-
-                       if (instruction.Next == null)
-                               return false;
-
-                       instruction = instruction.Next;
-
-                       if (instruction.OpCode != OpCodes.Call)
-                               return false;
-
-                       var method = (MethodReference) instruction.Operand;
-                       if (method.DeclaringType.Name != "Selector")
-                               return false;
-
-                       if (method.Name != "GetHandle" && method.Name != "sel_registerName")
-                               return false;
-
-                       if (instruction.Next == null)
-                               return false;
-
-                       instruction = instruction.Next;
-
-                       if (instruction.OpCode != OpCodes.Stsfld)
-                               return false;
-
-                       field = instruction.Operand as FieldReference;
-                       return true;
-               }
-
-               static bool IsDefaultConstructor (ExportedMethod exported)
-               {
-                       return exported.attribute == null && exported.method.IsConstructor && !exported.method.IsStatic;
-               }
-
-               static void Append (ILProcessor il, IEnumerable<Instruction> instructions)
-               {
-                       var method_instructions = il.Body.Instructions;
-                       var last = method_instructions [method_instructions.Count - 1];
-
-                       foreach (var instruction in instructions)
-                               il.InsertBefore (last, instruction);
-               }
-
-               static int GetArgumentSemantic (ExportedMethod exported)
-               {
-                       if (exported.attribute == null)
-                               return 0; // Assign
-
-                       var arguments = exported.attribute.ConstructorArguments;
-
-                       if (arguments.Count == 2)
-                               return (int) arguments [1].Value;
-
-                       if (arguments.Count == 1)
-                               return -1; // None
-
-                       return 0; // Assign
-               }
-
-               static string GetSelectorName (ExportedMethod exported)
-               {
-                       var arguments = exported.attribute.ConstructorArguments;
-
-                       if (arguments.Count == 0)
-                               return exported.method.Name;
-
-                       return (string) arguments [0].Value;
-               }
-
-               MethodDefinition GetTypeConstructor (TypeDefinition type)
-               {
-                       return type.GetTypeConstructor () ?? CreateTypeConstructor (type);
-               }
-
-               MethodDefinition CreateTypeConstructor (TypeDefinition type)
-               {
-                       var cctor = new MethodDefinition (".cctor", MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, void_type);
-                       cctor.Body.GetILProcessor ().Emit (OpCodes.Ret);
-
-                       type.Methods.Add (cctor);
-
-                       return cctor;
-               }
-
-               void ProcessConstructors (TypeDefinition type, List<ExportedMethod> exported)
-               {
-                       foreach (MethodDefinition ctor in type.GetConstructors ()) {
-                               if (!ctor.HasParameters && !ctor.IsStatic) {
-                                       exported.Add (new ExportedMethod (null, ctor));
-                                       continue;
-                               }
-
-                               CustomAttribute export;
-                               if (!TryGetExportAttribute (ctor, out export))
-                                       continue;
-
-                               exported.Add (new ExportedMethod (export, ctor));
-                       }
-               }
-
-               static bool TryGetExportAttribute (MethodDefinition method, out CustomAttribute export)
-               {
-                       export = null;
-
-                       if (!method.HasCustomAttributes)
-                               return false;
-
-                       foreach (CustomAttribute attribute in method.CustomAttributes) {
-                               if (attribute.AttributeType.FullName != "MonoMac.Foundation.ExportAttribute")
-                                       continue;
-
-                               export = attribute;
-                               return true;
-                       }
-
-                       return false;
-               }
-
-               void ProcessMethods (TypeDefinition type, List<ExportedMethod> exported)
-               {
-                       foreach (MethodDefinition method in type.GetMethods ()) {
-                               CustomAttribute attribute;
-                               if (TryGetExportAttribute (method, out attribute)) {
-                                       exported.Add (new ExportedMethod (attribute, method));
-                                       continue;
-                               }
-
-                               if (!method.IsVirtual)
-                                       continue;
-
-                               var bases = Annotations.GetBaseMethods (method);
-                               if (bases == null)
-                                       continue;
-
-                               foreach (MethodDefinition @base in bases) {
-                                       if (@base.DeclaringType.IsInterface)
-                                               continue;
-
-                                       if (TryGetExportAttribute (@base, out attribute)) {
-                                               exported.Add (new ExportedMethod (attribute, method));
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml b/mcs/tools/tuner/MonoMac.Tuner/MonoMac.xml
deleted file mode 100644 (file)
index 9a078c8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<linker>
-       <assembly fullname="MonoMac">
-               <namespace fullname="MonoMac.ObjCRuntime" />
-               <!--
-               <type fullname="MonoMac.ObjCRuntime.Runtime" />
-               <type fullname="MonoMac.ObjCRuntime.Class" />
-               <type fullname="MonoMac.ObjCRuntime.Selector" />
-               <type fullname="MonoMac.ObjCRuntime.NativeConstructorBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.NativeImplementationBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.NativeMethodBuilder" />
-               <type fullname="MonoMac.ObjCRuntime.INativeObject" />
-               -->
-               <type fullname="MonoMac.Foundation.NSObject" preserve="fields">
-                       <method name="NativeRelease" />
-                       <method name="NativeRetain" />
-                       <method name="Retain" />
-               </type>
-               <type fullname="MonoMac.Foundation.NSArray" preserve="fields">
-                       <method name="ArrayFromHandle" />
-                       <method name="StringArrayFromHandle" />
-                       <method name="FromNSObjects" />
-                       <method name="FromStrings" />
-               </type>
-               <type fullname="MonoMac.Foundation.ExportAttribute" />
-       </assembly>
-       <assembly fullname="mscorlib">
-               <type fullname="System.Runtime.Serialization.FormatterServices">
-                       <method name="GetUninitializedObject" />
-               </type>
-               <type fullname="System.Runtime.InteropServices.Marshal">
-                       <method name="StructureToPtr" />
-               </type>
-               <type fullname="System.Runtime.InteropServices.MarshalAsAttribute">
-                       <field name="MarshalTypeRef" />
-               </type>
-       </assembly>
-</linker>
diff --git a/mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs b/mcs/tools/tuner/MonoMac.Tuner/MonoMacProfile.cs
deleted file mode 100644 (file)
index 0692e48..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Mono.Tuner;
-
-using Mono.Cecil;
-
-namespace MonoMac.Tuner {
-
-       class MonoMacProfile : Profile {
-
-               static readonly HashSet<string> Sdk = new HashSet<string> {
-                       "mscorlib",
-                       "I18N.CJK",
-                       "I18N",
-                       "I18N.MidEast",
-                       "I18N.Other",
-                       "I18N.Rare",
-                       "I18N.West",
-                       "Microsoft.Build.Engine",
-                       "Microsoft.Build.Framework",
-                       "Microsoft.Build.Tasks.v4.0",
-                       "Microsoft.Build.Utilities.v4.0",
-                       "Microsoft.CSharp",
-                       "Microsoft.Web.Infrastructure",
-                       "Mono.C5",
-                       "Mono.Cairo",
-                       "Mono.CodeContracts",
-                       "Mono.CompilerServices.SymbolWriter",
-                       "Mono.Configuration.Crypto",
-                       "Mono.CSharp",
-                       "Mono.Data.Sqlite",
-                       "Mono.Data.Tds",
-                       "Mono.Debugger.Soft",
-                       "Mono.Http",
-                       "Mono.Management",
-                       "Mono.Messaging",
-                       "Mono.Messaging.RabbitMQ",
-                       "Mono.Options",
-                       "Mono.Parallel",
-                       "Mono.Posix",
-                       "Mono.Security",
-                       "Mono.Security.Win32",
-                       "Mono.Simd",
-                       "Mono.Tasklets",
-                       "Mono.Tuner",
-                       "Mono.WebBrowser",
-                       "Mono.Web",
-                       "Novell.Directory.Ldap",
-                       "Npgsql",
-                       "OpenSystem.C",
-                       "PEAPI",
-                       "System.ComponentModel.Composition",
-                       "System.ComponentModel.DataAnnotations",
-                       "System.Configuration",
-                       "System.Configuration.Install",
-                       "System.Core",
-                       "System.Data.DataSetExtensions",
-                       "System.Data",
-                       "System.Data.Linq",
-                       "System.Data.OracleClient",
-                       "System.Data.Services.Client",
-                       "System.Data.Services",
-                       "System.Design",
-                       "System.DirectoryServices",
-                       "System",
-                       "System.Drawing.Design",
-                       "System.Drawing",
-                       "System.Dynamic",
-                       "System.EnterpriseServices",
-                       "System.IdentityModel",
-                       "System.IdentityModel.Selectors",
-                       "System.Management",
-                       "System.Messaging",
-                       "System.Net",
-                       "System.Numerics",
-                       "System.Runtime.Caching",
-                       "System.Runtime.DurableInstancing",
-                       "System.Runtime.Remoting",
-                       "System.Runtime.Serialization",
-                       "System.Runtime.Serialization.Formatters.Soap",
-                       "System.Security",
-                       "System.ServiceModel.Discovery",
-                       "System.ServiceModel",
-                       "System.ServiceModel.Routing",
-                       "System.ServiceModel.Web",
-                       "System.ServiceProcess",
-                       "System.Transactions",
-                       "System.Web.Abstractions",
-                       "System.Web.ApplicationServices",
-                       "System.Web",
-                       "System.Web.DynamicData",
-                       "System.Web.Extensions.Design",
-                       "System.Web.Extensions",
-                       "System.Web.Routing",
-                       "System.Web.Services",
-                       "System.Windows.Forms.DataVisualization",
-                       "System.Windows.Forms",
-                       "System.Xaml",
-                       "System.Xml",
-                       "System.Xml.Linq",
-                       "WebMatrix.Data",
-                       "WindowsBase",
-                       "Microsoft.VisualBasic",
-               };
-
-               protected override bool IsSdk (AssemblyDefinition assembly)
-               {
-                       return Sdk.Contains (assembly.Name.Name);
-               }
-
-               protected override bool IsProduct (AssemblyDefinition assembly)
-               {
-                       return assembly.Name.Name == "MonoMac";
-               }
-       }
-}
diff --git a/mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs b/mcs/tools/tuner/MonoMac.Tuner/RemoveSelectors.cs
deleted file mode 100644 (file)
index 0c201ae..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Mono.Linker;
-using Mono.Linker.Steps;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-using Mono.Tuner;
-
-namespace MonoMac.Tuner {
-
-       public class RemoveSelectors : IStep {
-
-               public void Process (LinkContext context)
-               {
-                       AssemblyDefinition monomac;
-                       if (!context.TryGetLinkedAssembly ("MonoMac", out monomac))
-                               return;
-
-                       foreach (TypeDefinition type in monomac.MainModule.Types) {
-                               if (!type.IsNSObject ())
-                                       continue;
-
-                               ProcessNSObject (type);
-                       }
-               }
-
-               static void ProcessNSObject (TypeDefinition type)
-               {
-                       var selectors = PopulateSelectors (type);
-                       if (selectors == null)
-                               return;
-
-                       foreach (var method in CollectMethods (type))
-                               CheckSelectorUsage (method, selectors);
-
-                       if (selectors.Count == 0)
-                               return;
-
-                       PatchStaticConstructor (type, selectors);
-                       RemoveUnusedSelectors (type, selectors);
-               }
-
-               static void CheckSelectorUsage (MethodDefinition method, HashSet<FieldDefinition> selectors)
-               {
-                       if (!method.HasBody)
-                               return;
-
-                       foreach (Instruction instruction in method.Body.Instructions) {
-                               switch (instruction.OpCode.OperandType) {
-                               case OperandType.InlineTok:
-                               case OperandType.InlineField:
-                                       var field = instruction.Operand as FieldDefinition;
-                                       if (field == null)
-                                               continue;
-
-                                       if (selectors.Contains (field))
-                                               selectors.Remove (field);
-
-                                       break;
-                               }
-                       }
-               }
-
-               static void PatchStaticConstructor (TypeDefinition type, HashSet<FieldDefinition> selectors)
-               {
-                       var cctor = type.GetTypeConstructor ();
-                       if (cctor == null || !cctor.HasBody)
-                               return;
-
-                       var instructions = cctor.Body.Instructions;
-
-                       for (int i = 0; i < instructions.Count; i++) {
-                               var instruction = instructions [i];
-                               if (!IsCreateSelector (instruction, selectors))
-                                       continue;
-
-                               instructions.RemoveAt (i--);
-                               instructions.RemoveAt (i--);
-                               instructions.RemoveAt (i--);
-                       }
-               }
-
-               static bool IsCreateSelector (Instruction instruction, HashSet<FieldDefinition> selectors)
-               {
-                       if (instruction.OpCode != OpCodes.Stsfld)
-                               return false;
-
-                       var field = instruction.Operand as FieldDefinition;
-                       if (field == null)
-                               return false;
-
-                       if (!selectors.Contains (field))
-                               return false;
-
-                       instruction = instruction.Previous;
-                       if (instruction == null)
-                               return false;
-
-                       if (instruction.OpCode != OpCodes.Call)
-                               return false;
-
-                       if (!IsRegisterSelector (instruction.Operand as MethodReference))
-                               return false;
-
-                       instruction = instruction.Previous;
-                       if (instruction == null)
-                               return false;
-
-                       if (instruction.OpCode != OpCodes.Ldstr)
-                               return false;
-
-                       return true;
-               }
-
-               static bool IsRegisterSelector (MethodReference method)
-               {
-                       if (method == null)
-                               return false;
-
-                       if (method.Name != "GetHandle" && method.Name != "sel_registerName")
-                               return false;
-
-                       if (method.DeclaringType.FullName != "MonoMac.ObjCRuntime.Selector")
-                               return false;
-
-                       return true;
-               }
-
-               static void RemoveUnusedSelectors (TypeDefinition type, HashSet<FieldDefinition> selectors)
-               {
-                       var fields = type.Fields;
-
-                       for (int i = 0; i < fields.Count; i++)
-                               if (selectors.Contains (fields [i]))
-                                       fields.RemoveAt (i--);
-               }
-
-               static HashSet<FieldDefinition> PopulateSelectors (TypeDefinition type)
-               {
-                       if (!type.HasFields)
-                               return null;
-
-                       HashSet<FieldDefinition> selectors = null;
-
-                       foreach (FieldDefinition field in type.Fields) {
-                               if (!IsSelector (field))
-                                       continue;
-
-                               if (selectors == null)
-                                       selectors = new HashSet<FieldDefinition> ();
-
-                               selectors.Add (field);
-                       }
-
-                       return selectors;
-               }
-
-               static bool IsSelector (FieldDefinition field)
-               {
-                       if (!field.IsStatic)
-                               return false;
-
-                       if (field.FieldType.FullName != "System.IntPtr")
-                               return false;
-
-                       if (!field.Name.StartsWith ("sel"))
-                               return false;
-
-                       return true;
-               }
-
-               static IEnumerable<MethodDefinition> CollectMethods (TypeDefinition type)
-               {
-                       if (!type.HasMethods)
-                               yield break;
-
-                       foreach (MethodDefinition method in type.Methods) {
-                               if (method.IsStatic && method.IsConstructor)
-                                       continue;
-
-                               yield return method;
-                       }
-               }
-       }
-}