public OptimizeGeneratedCodeSubStep(LinkerOptions options)
 {
     Options = options;
     #if DEBUG
     Console.WriteLine ("OptimizeGeneratedCodeSubStep Arch {0} Device: {1}, EnsureUiThread: {2}, FAT 32+64 {3}", Arch, Device, EnsureUIThread, IsDualBuild);
     #endif
 }
Exemple #2
0
        static MonoTouchLinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
        {
            var context = new MonoTouchLinkContext(pipeline, options.Resolver);

            context.CoreAction      = options.LinkMode == LinkMode.None ? AssemblyAction.Copy : AssemblyAction.Link;
            context.LinkSymbols     = options.LinkSymbols;
            context.OutputDirectory = options.OutputDirectory;
            context.SetParameter("debug-build", options.DebugBuild.ToString());
            context.StaticRegistrar = options.Target.StaticRegistrar;
            context.Target          = options.Target;
            options.LinkContext     = context;

            return(context);
        }
Exemple #3
0
        static MonoTouchLinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
        {
            var context = new MonoTouchLinkContext(pipeline, options.Resolver);

            context.CoreAction      = options.LinkMode == LinkMode.None ? AssemblyAction.Copy : AssemblyAction.Link;
            context.LinkSymbols     = options.LinkSymbols;
            context.OutputDirectory = options.OutputDirectory;
            context.SetParameter("debug-build", options.DebugBuild.ToString());
            context.StaticRegistrar      = options.Target.StaticRegistrar;
            context.Target               = options.Target;
            context.ExcludedFeatures     = new [] { "remoting", "com", "sre" };
            context.SymbolWriterProvider = new CustomSymbolWriterProvider();
            options.LinkContext          = context;

            return(context);
        }
Exemple #4
0
        public static void Process(LinkerOptions options, out MonoTouchLinkContext context, out List <AssemblyDefinition> assemblies)
        {
            var pipeline = CreatePipeline(options);

            foreach (var ad in options.MainAssemblies)
            {
                pipeline.PrependStep(new MobileResolveMainAssemblyStep(ad));
            }

            context = CreateLinkContext(options, pipeline);
            context.Resolver.AddSearchDirectory(options.OutputDirectory);

            if (options.DumpDependencies)
            {
                var prepareDependenciesDump = context.Annotations.GetType().GetMethod("PrepareDependenciesDump", new Type[1] {
                    typeof(string)
                });
                if (prepareDependenciesDump != null)
                {
                    prepareDependenciesDump.Invoke(context.Annotations, new object[1] {
                        string.Format("{0}{1}linker-dependencies.xml.gz", options.OutputDirectory, Path.DirectorySeparatorChar)
                    });
                }
            }

            try {
                pipeline.Process(context);
            } catch (FileNotFoundException fnfe) {
                // Cecil throw this if the assembly is not found
                throw new MonoTouchException(2002, true, fnfe, fnfe.Message);
            } catch (AggregateException) {
                throw;
            } catch (MonoTouchException) {
                throw;
            } catch (ResolutionException re) {
                TypeReference  tr    = (re.Member as TypeReference);
                IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
                throw new MonoTouchException(2002, true, re, "Failed to resolve \"{0}\" reference from \"{1}\"", re.Member, scope);
            } catch (XmlResolutionException ex) {
                throw new MonoTouchException(2017, true, ex, "Could not process XML description: {0}", ex?.InnerException?.Message ?? ex.Message);
            } catch (Exception e) {
                throw new MonoTouchException(2001, true, e, "Could not link assemblies. Reason: {0}", e.Message);
            }

            assemblies = ListAssemblies(context);
        }
        static SubStepDispatcher GetPostLinkOptimizations(LinkerOptions options)
        {
            SubStepDispatcher sub = new SubStepDispatcher();

            if (options.Application.Optimizations.ForceRejectedTypesRemoval == true)
            {
                sub.Add(new RemoveRejectedTypesStep());
            }
            if (!options.DebugBuild)
            {
                sub.Add(new MetadataReducerSubStep());
                if (options.Application.Optimizations.SealAndDevirtualize == true)
                {
                    sub.Add(new SealerSubStep());
                }
            }
            return(sub);
        }
        static MonoTouchLinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
        {
            var context = new MonoTouchLinkContext(pipeline, options.Resolver);

            context.CoreAction      = options.LinkMode == LinkMode.None ? AssemblyAction.Copy : AssemblyAction.Link;
            context.LinkSymbols     = options.LinkSymbols;
            context.OutputDirectory = options.OutputDirectory;
            context.SetParameter("debug-build", options.DebugBuild.ToString());
            context.Target               = options.Target;
            context.ExcludedFeatures     = new [] { "remoting", "com", "sre" };
            context.SymbolWriterProvider = new CustomSymbolWriterProvider();
            if (options.Application.Optimizations.StaticConstructorBeforeFieldInit == false)
            {
                context.DisabledOptimizations |= CodeOptimizations.BeforeFieldInit;
            }
            options.LinkContext = context;

            return(context);
        }
Exemple #7
0
        static SubStepDispatcher GetSubSteps(LinkerOptions options)
        {
            SubStepDispatcher sub = new SubStepDispatcher();

            sub.Add(new ApplyPreserveAttribute());
            sub.Add(new CoreRemoveSecurity());
            sub.Add(new OptimizeGeneratedCodeSubStep(options));
            sub.Add(new RemoveUserResourcesSubStep(options));
            // OptimizeGeneratedCodeSubStep and RemoveNativeCodeSubStep needs [GeneratedCode] so it must occurs before RemoveAttributes
            sub.Add(new RemoveAttributes());
            // http://bugzilla.xamarin.com/show_bug.cgi?id=1408
            if (options.LinkAway)
            {
                sub.Add(new RemoveCode(options));
            }
            sub.Add(new MarkNSObjects());
            sub.Add(new PreserveSoapHttpClients());
            sub.Add(new CoreHttpMessageHandler(options));
            return(sub);
        }
Exemple #8
0
        static SubStepDispatcher GetSubSteps(LinkerOptions options)
        {
            SubStepDispatcher sub = new SubStepDispatcher();

            sub.Add(new ApplyPreserveAttribute());
            sub.Add(new CoreRemoveSecurity());
            sub.Add(new OptimizeGeneratedCodeSubStep(options));
            // OptimizeGeneratedCodeSubStep needs [GeneratedCode] so it must occurs before RemoveAttributes
            sub.Add(new RemoveAttributes());
            // http://bugzilla.xamarin.com/show_bug.cgi?id=1408
            if (options.LinkAway)
            {
                sub.Add(new RemoveCode(options));
            }
            sub.Add(new MarkNSObjects());
            sub.Add(new PreserveSoapHttpClients());
            sub.Add(new CoreHttpMessageHandler(options));
            if (Driver.App.Platform != Xamarin.Utils.ApplePlatform.WatchOS)
            {
                sub.Add(new CoreTlsProviderStep(options));
            }
            return(sub);
        }
Exemple #9
0
        static SubStepDispatcher GetSubSteps(LinkerOptions options)
        {
            SubStepDispatcher sub = new SubStepDispatcher();

            sub.Add(new ApplyPreserveAttribute());
            sub.Add(new CoreRemoveSecurity());
            sub.Add(new OptimizeGeneratedCodeSubStep(options));
            sub.Add(new RemoveUserResourcesSubStep(options));
            if (options.Application.Optimizations.CustomAttributesRemoval == true)
            {
                sub.Add(new RemoveAttributes());
            }
            // http://bugzilla.xamarin.com/show_bug.cgi?id=1408
            if (options.LinkAway)
            {
                sub.Add(new RemoveCode(options));
            }
            sub.Add(new MarkNSObjects());
            sub.Add(new PreserveSoapHttpClients());
            sub.Add(new CoreHttpMessageHandler(options));
            sub.Add(new InlinerSubStep());
            sub.Add(new PreserveSmartEnumConversionsSubStep());
            return(sub);
        }
Exemple #10
0
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline();

            pipeline.AppendStep(new LoadReferencesStep());

            if (options.I18nAssemblies != I18nAssemblies.None)
            {
                pipeline.AppendStep(new LoadI18nAssemblies(options.I18nAssemblies));
            }

            // that must be done early since the XML files can "add" new assemblies [#15878]
            // and some of the assemblies might be (directly or referenced) SDK assemblies
            foreach (string definition in options.ExtraDefinitions)
            {
                pipeline.AppendStep(GetResolveStep(definition));
            }

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.AppendStep(new BlacklistStep());
            }

            pipeline.AppendStep(new CustomizeIOSActions(options.LinkMode, options.SkippedAssemblies));

            // We need to store the Field attribute in annotations, since it may end up removed.
            pipeline.AppendStep(new ProcessExportedFields());

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.AppendStep(new MonoTouchTypeMapStep());

                pipeline.AppendStep(GetSubSteps(options));

                pipeline.AppendStep(new PreserveCode(options));

                pipeline.AppendStep(new RemoveResources(options.I18nAssemblies));                   // remove collation tables

                pipeline.AppendStep(new MonoTouchMarkStep());
                pipeline.AppendStep(new MonoTouchSweepStep());
                pipeline.AppendStep(new CleanStep());

                if (!options.DebugBuild)
                {
                    pipeline.AppendStep(GetPostLinkOptimizations(options));
                }

                pipeline.AppendStep(new FixModuleFlags());
            }
            else
            {
                SubStepDispatcher sub = new SubStepDispatcher()
                {
                    new RemoveUserResourcesSubStep(options)
                };
                pipeline.AppendStep(sub);
            }

            pipeline.AppendStep(new ListExportedSymbols(options.MarshalNativeExceptionsState));

            pipeline.AppendStep(new OutputStep());

            return(pipeline);
        }
Exemple #11
0
 public PreserveCode(LinkerOptions options) : base(options.I18nAssemblies)
 {
     Device = options.Device;
 }
Exemple #12
0
        public static void Process(LinkerOptions options, out MonoTouchLinkContext context, out List <AssemblyDefinition> assemblies)
        {
            var pipeline = CreatePipeline(options);

            foreach (var ad in options.MainAssemblies)
            {
                pipeline.PrependStep(new MobileResolveMainAssemblyStep(ad, options.Application.Embeddinator));
            }

            context = CreateLinkContext(options, pipeline);
            context.Resolver.AddSearchDirectory(options.OutputDirectory);

            if (options.DumpDependencies)
            {
                var prepareDependenciesDump = context.Annotations.GetType().GetMethod("PrepareDependenciesDump", new Type[1] {
                    typeof(string)
                });
                if (prepareDependenciesDump != null)
                {
                    prepareDependenciesDump.Invoke(context.Annotations, new object[1] {
                        string.Format("{0}{1}linker-dependencies.xml.gz", options.OutputDirectory, Path.DirectorySeparatorChar)
                    });
                }
            }

            try {
                pipeline.Process(context);
            } catch (FileNotFoundException fnfe) {
                // Cecil throw this if the assembly is not found
                throw new MonoTouchException(2002, true, fnfe, fnfe.Message);
            } catch (AggregateException) {
                throw;
            } catch (MonoTouchException) {
                throw;
            } catch (MarkException me) {
                var re = me.InnerException as ResolutionException;
                if (re == null)
                {
                    if (me.InnerException != null)
                    {
                        throw ErrorHelper.CreateError(2102, me, "Error processing the method '{0}' in the assembly '{1}': {2}", me.Method.FullName, me.Method.Module, me.InnerException.Message);
                    }
                    else
                    {
                        throw ErrorHelper.CreateError(2102, me, "Error processing the method '{0}' in the assembly '{1}'", me.Method.FullName, me.Method.Module);
                    }
                }
                else
                {
                    TypeReference  tr    = (re.Member as TypeReference);
                    IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
                    throw ErrorHelper.CreateError(2101, me, "Can't resolve the reference '{0}', referenced from the method '{1}' in '{2}'.", re.Member, me.Method.FullName, scope);
                }
            } catch (ResolutionException re) {
                TypeReference  tr    = (re.Member as TypeReference);
                IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
                throw new MonoTouchException(2002, true, re, "Failed to resolve \"{0}\" reference from \"{1}\"", re.Member, scope);
            } catch (XmlResolutionException ex) {
                throw new MonoTouchException(2017, true, ex, "Could not process XML description: {0}", ex?.InnerException?.Message ?? ex.Message);
            } catch (Exception e) {
                var message = new StringBuilder();
                if (e.Data.Count > 0)
                {
                    message.AppendLine();
                    var m = e.Data ["MethodDefinition"] as string;
                    if (m != null)
                    {
                        message.AppendLine($"\tMethod: `{m}`");
                    }
                    var t = e.Data ["TypeReference"] as string;
                    if (t != null)
                    {
                        message.AppendLine($"\tType: `{t}`");
                    }
                    var a = e.Data ["AssemblyDefinition"] as string;
                    if (a != null)
                    {
                        message.AppendLine($"\tAssembly: `{a}`");
                    }
                }
                message.Append($"Reason: {e.Message}");
                throw new MonoTouchException(2001, true, e, "Could not link assemblies. {0}", message);
            }

            assemblies = ListAssemblies(context);
        }
 public PreserveCode(LinkerOptions options)
     : base(options.I18nAssemblies)
 {
     Device = options.Device;
 }
Exemple #14
0
        public void LinkAssemblies(string main, ref List<string> assemblies, string output_dir, out MonoTouchLinkContext link_context)
        {
            if (Driver.Verbosity > 0)
                Console.WriteLine ("Linking {0} into {1} using mode '{2}'", main, output_dir, App.LinkMode);

            var cache = Resolver.ToResolverCache ();
            var resolver = cache != null
                ? new AssemblyResolver (cache)
                : new AssemblyResolver ();

            resolver.AddSearchDirectory (Resolver.RootDirectory);
            resolver.AddSearchDirectory (Resolver.FrameworkDirectory);

            var options = new LinkerOptions {
                MainAssembly = Resolver.Load (main),
                OutputDirectory = output_dir,
                LinkMode = App.LinkMode,
                Resolver = resolver,
                SkippedAssemblies = App.LinkSkipped,
                I18nAssemblies = App.I18n,
                LinkSymbols = true,
                LinkAway = App.LinkAway,
                ExtraDefinitions = App.Definitions,
                Device = App.IsDeviceBuild,
                // by default we keep the code to ensure we're executing on the UI thread (for UI code) for debug builds
                // but this can be overridden to either (a) remove it from debug builds or (b) keep it in release builds
                EnsureUIThread = App.ThreadCheck.HasValue ? App.ThreadCheck.Value : App.EnableDebug,
                OldRegistrar = (App.Registrar == RegistrarMode.LegacyDynamic || App.Registrar == RegistrarMode.LegacyStatic),
                DebugBuild = App.EnableDebug,
                Arch = Is64Build ? 8 : 4,
                IsDualBuild = App.IsDualBuild,
                Unified = App.IsUnified,
                DumpDependencies = App.LinkerDumpDependencies,
                RuntimeOptions = App.RuntimeOptions
            };

            MonoTouch.Tuner.Linker.Process (options, out link_context, out assemblies);

            // reset resolver
            foreach (var file in assemblies) {
                /*				var assembly = */Resolver.Load (file);
                // FIXME assembly.MainModule.AssemblyResolver = Resolver;
            }
            Driver.Watch ("Link Assemblies", 1);
        }
 public RemoveCode(LinkerOptions options)
 {
     Device = options.Device;
     Debug  = options.DebugBuild;
 }
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline();

            pipeline.Append(new LoadReferencesStep());

            if (options.I18nAssemblies != I18nAssemblies.None)
            {
                pipeline.Append(new LoadI18nAssemblies(options.I18nAssemblies));
            }

            // that must be done early since the XML files can "add" new assemblies [#15878]
            // and some of the assemblies might be (directly or referenced) SDK assemblies
            foreach (string definition in options.ExtraDefinitions)
            {
                pipeline.Append(GetResolveStep(definition));
            }

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.Append(new BlacklistStep());
            }

            if (options.WarnOnTypeRef.Count > 0)
            {
                pipeline.Append(new PreLinkScanTypeReferenceStep(options.WarnOnTypeRef));
            }

            pipeline.Append(new CustomizeIOSActions(options.LinkMode, options.SkippedAssemblies));

            // We need to store the Field attribute in annotations, since it may end up removed.
            pipeline.Append(new ProcessExportedFields());

            // We remove incompatible bitcode from all assemblies, not only the linked assemblies.
            RemoveBitcodeIncompatibleCodeStep remove_incompatible_bitcode = null;

            if (options.Application.Optimizations.RemoveUnsupportedILForBitcode == true)
            {
                remove_incompatible_bitcode = new RemoveBitcodeIncompatibleCodeStep(options);
            }

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.Append(new CoreTypeMapStep());

                pipeline.Append(GetSubSteps());

                pipeline.Append(new PreserveCode(options));

                pipeline.Append(new RemoveResources(options.I18nAssemblies));                   // remove collation tables

                pipeline.Append(new MonoTouchMarkStep());

                // We only want to remove from methods that aren't already linked away, so we need to do this
                // after the mark step. If we remove any incompatible code, we'll mark
                // the NotSupportedException constructor we need, so we need to do this before the sweep step.
                if (remove_incompatible_bitcode != null)
                {
                    pipeline.Append(new SubStepDispatcher {
                        remove_incompatible_bitcode
                    });
                }

                pipeline.Append(new MonoTouchSweepStep(options));
                pipeline.Append(new CleanStep());

                pipeline.AppendStep(GetPostLinkOptimizations(options));

                pipeline.Append(new FixModuleFlags());
            }
            else
            {
                SubStepDispatcher sub = new SubStepDispatcher()
                {
                    new RemoveUserResourcesSubStep(),
                };
                if (options.Application.Optimizations.ForceRejectedTypesRemoval == true)
                {
                    sub.Add(new RemoveRejectedTypesStep());
                }
                if (remove_incompatible_bitcode != null)
                {
                    sub.Add(remove_incompatible_bitcode);
                }
                pipeline.Append(sub);
            }

            pipeline.Append(new ListExportedSymbols(options.MarshalNativeExceptionsState));

            pipeline.Append(new OutputStep());

            // expect that changes can occur until it's all saved back to disk
            if (options.WarnOnTypeRef.Count > 0)
            {
                pipeline.Append(new PostLinkScanTypeReferenceStep(options.WarnOnTypeRef));
            }

            return(pipeline);
        }
Exemple #17
0
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline ();

            pipeline.AppendStep (new LoadReferencesStep ());

            if (options.I18nAssemblies != I18nAssemblies.None)
                pipeline.AppendStep (new LoadI18nAssemblies (options.I18nAssemblies));

            // that must be done early since the XML files can "add" new assemblies [#15878]
            // and some of the assemblies might be (directly or referenced) SDK assemblies
            foreach (string definition in options.ExtraDefinitions)
                pipeline.AppendStep (GetResolveStep (definition));

            if (options.LinkMode != LinkMode.None)
                pipeline.AppendStep (new BlacklistStep ());

            pipeline.AppendStep (new CustomizeIOSActions (options.LinkMode, options.SkippedAssemblies));

            // We need to store the Field attribute in annotations, since it may end up removed.
            pipeline.AppendStep (new ProcessExportedFields ());

            if (options.LinkMode != LinkMode.None) {
                pipeline.AppendStep (new MonoTouchTypeMapStep ());

                pipeline.AppendStep (GetSubSteps (options));

                pipeline.AppendStep (new PreserveCode (options));

                // only remove bundled resources on device builds as MonoDevelop requires the resources later
                // (to be extracted). That differs from the device builds (where another unmodified copy is used)
                if (options.Device)
                    pipeline.AppendStep (new RemoveMonoTouchResources ());

                pipeline.AppendStep (new RemoveResources (options.I18nAssemblies)); // remove collation tables

                pipeline.AppendStep (new MonoTouchMarkStep ());
                pipeline.AppendStep (new MonoTouchSweepStep ());
                pipeline.AppendStep (new CleanStep ());

                if (!options.DebugBuild)
                    pipeline.AppendStep (GetPostLinkOptimizations (options));

                pipeline.AppendStep (new RemoveSelectors ());
                pipeline.AppendStep (new FixModuleFlags ());
            }

            pipeline.AppendStep (new ListExportedSymbols ());

            pipeline.AppendStep (new OutputStep ());

            return pipeline;
        }
Exemple #18
0
        static MonoTouchLinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
        {
            var context = new MonoTouchLinkContext (pipeline, options.Resolver);
            context.CoreAction = options.LinkMode == LinkMode.None ? AssemblyAction.Copy : AssemblyAction.Link;
            context.LinkSymbols = options.LinkSymbols;
            context.OutputDirectory = options.OutputDirectory;
            context.SetParameter ("debug-build", options.DebugBuild.ToString ());

            options.LinkContext = context;

            return context;
        }
Exemple #19
0
        public static void Process(LinkerOptions options, out MonoTouchLinkContext context, out List<string> assemblies)
        {
            var pipeline = CreatePipeline (options);

            pipeline.PrependStep (new MobileResolveMainAssemblyStep (options.MainAssembly));

            context = CreateLinkContext (options, pipeline);
            context.Resolver.AddSearchDirectory (options.OutputDirectory);

            if (options.DumpDependencies) {
                var prepareDependenciesDump = context.Annotations.GetType ().GetMethod ("PrepareDependenciesDump", new Type[1] { typeof (string) });
                if (prepareDependenciesDump != null)
                    prepareDependenciesDump.Invoke (context.Annotations, new object[1] { string.Format ("{0}{1}linker-dependencies.xml.gz", options.OutputDirectory, Path.DirectorySeparatorChar) });
            }

            try {
                pipeline.Process (context);
            } catch (FileNotFoundException fnfe) {
                // Cecil throw this if the assembly is not found
                throw new MonoTouchException (2002, true, fnfe, fnfe.Message);
            } catch (AggregateException) {
                throw;
            } catch (MonoTouchException) {
                throw;
            } catch (ResolutionException re) {
                TypeReference tr = (re.Member as TypeReference);
                IMetadataScope scope = tr == null ? re.Member.DeclaringType.Scope : tr.Scope;
                throw new MonoTouchException (2002, true, re, "Failed to resolve \"{0}\" reference from \"{1}\"", re.Member, scope);
            } catch (Exception e) {
                throw new MonoTouchException (2001, true, e, "Could not link assemblies. Reason: {0}", e.Message);
            }

            assemblies = ListAssemblies (context);
        }
 public RemoveCode(LinkerOptions options)
 {
     Device = options.Device;
     Debug = options.DebugBuild;
 }
Exemple #21
0
 public MonoTouchSweepStep(LinkerOptions options)
     : base(options.LinkSymbols)
 {
 }
Exemple #22
0
 public OptimizeGeneratedCodeSubStep(LinkerOptions options)
     : base(options)
 {
 }
Exemple #23
0
 static SubStepDispatcher GetPostLinkOptimizations(LinkerOptions options)
 {
     SubStepDispatcher sub = new SubStepDispatcher ();
     sub.Add (new MetadataReducerSubStep ());
     sub.Add (new SealerSubStep ());
     return sub;
 }
Exemple #24
0
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline();

            pipeline.AppendStep(new LoadReferencesStep());

            if (options.I18nAssemblies != I18nAssemblies.None)
            {
                pipeline.AppendStep(new LoadI18nAssemblies(options.I18nAssemblies));
            }

            // that must be done early since the XML files can "add" new assemblies [#15878]
            // and some of the assemblies might be (directly or referenced) SDK assemblies
            foreach (string definition in options.ExtraDefinitions)
            {
                pipeline.AppendStep(GetResolveStep(definition));
            }

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.AppendStep(new BlacklistStep());
            }

            pipeline.AppendStep(new CustomizeIOSActions(options.LinkMode, options.SkippedAssemblies));

            // We need to store the Field attribute in annotations, since it may end up removed.
            pipeline.AppendStep(new ProcessExportedFields());

            if (options.LinkMode != LinkMode.None)
            {
                pipeline.AppendStep(new MonoTouchTypeMapStep());

                pipeline.AppendStep(GetSubSteps(options));

                pipeline.AppendStep(new PreserveCode(options));

                // only remove bundled resources on device builds as MonoDevelop requires the resources later
                // (to be extracted). That differs from the device builds (where another unmodified copy is used)
                if (options.Device)
                {
                    pipeline.AppendStep(new RemoveMonoTouchResources());
                }

                pipeline.AppendStep(new RemoveResources(options.I18nAssemblies));                   // remove collation tables

                pipeline.AppendStep(new MonoTouchMarkStep());
                pipeline.AppendStep(new MonoTouchSweepStep());
                pipeline.AppendStep(new CleanStep());

                if (!options.DebugBuild)
                {
                    pipeline.AppendStep(GetPostLinkOptimizations(options));
                }

                pipeline.AppendStep(new RemoveSelectors());
                pipeline.AppendStep(new FixModuleFlags());
            }

            pipeline.AppendStep(new ListExportedSymbols(options.MarshalNativeExceptionsState));

            pipeline.AppendStep(new OutputStep());

            return(pipeline);
        }
 public RemoveBitcodeIncompatibleCodeStep(LinkerOptions options)
 {
     Options = options;
 }
Exemple #26
0
 static SubStepDispatcher GetSubSteps(LinkerOptions options)
 {
     SubStepDispatcher sub = new SubStepDispatcher ();
     sub.Add (new ApplyPreserveAttribute ());
     sub.Add (new CoreRemoveSecurity ());
     sub.Add (new OptimizeGeneratedCodeSubStep (options));
     // OptimizeGeneratedCodeSubStep needs [GeneratedCode] so it must occurs before RemoveAttributes
     sub.Add (new RemoveAttributes ());
     // http://bugzilla.xamarin.com/show_bug.cgi?id=1408
     if (options.LinkAway)
         sub.Add (new RemoveCode (options));
     sub.Add (new MarkNSObjects ());
     sub.Add (new PreserveSoapHttpClients ());
     // there's only one registrar for unified, i.e. DynamicRegistrar
     if (!options.Unified)
         sub.Add (new RemoveExtraRegistrar (options.OldRegistrar));
     sub.Add (new CoreHttpMessageHandler (options));
     sub.Add (new CoreTlsProviderStep (options));
     return sub;
 }