AppendStep() public method

public AppendStep ( IStep step ) : void
step IStep
return void
Exemplo n.º 1
0
 static Pipeline GetStandardPipeline()
 {
     Pipeline p = new Pipeline ();
     p.AppendStep (new LoadReferencesStep ());
     p.AppendStep (new BlacklistStep ());
     p.AppendStep (new TypeMapStep ());
     p.AppendStep (new MarkStep ());
     return p;
 }
Exemplo n.º 2
0
 static Pipeline GetStandardPipeline()
 {
     var pipeline = new Pipeline();
     pipeline.AppendStep(new LoadReferencesStep());
     pipeline.AppendStep(new BlacklistStep());
     pipeline.AppendStep(new TypeMapStep());
     pipeline.AppendStep(new MarkStep());
     pipeline.AppendStep(new SweepStep());
     pipeline.AppendStep(new CleanStep());
     pipeline.AppendStep(new RegenerateGuidStep());
     pipeline.AppendStep(new OutputStep());
     return pipeline;
 }
Exemplo n.º 3
0
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline ();

            if (options.LinkNone) {
                pipeline.AppendStep (new FixAbstractMethodsStep ());
                pipeline.AppendStep (new OutputStep ());
                return pipeline;
            }

            pipeline.AppendStep (new LoadReferencesStep ());

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

            pipeline.AppendStep (new BlacklistStep ());

            foreach (var desc in options.LinkDescriptions)
                pipeline.AppendStep (new ResolveFromXmlStep (new XPathDocument (desc)));

            pipeline.AppendStep (new CustomizeActions (options.LinkSdkOnly, options.SkippedAssemblies));

            pipeline.AppendStep (new TypeMapStep ());

            // monodroid tuner steps
            pipeline.AppendStep (new SubStepDispatcher {
                new ApplyPreserveAttribute (),
                new PreserveExportedTypes (),
                new RemoveSecurity (),
                new MarkJavaObjects (),
                new PreserveJavaExceptions (),
                new PreserveJavaTypeRegistrations (),
                new PreserveApplications (),
                new RemoveAttributes (),
                new PreserveDynamicTypes (),
                new PreserveSoapHttpClients (),
                new PreserveTypeConverters (),
                new PreserveLinqExpressions (),
                new PreserveRuntimeSerialization (),
            });

            pipeline.AppendStep (new PreserveCrypto ());
            pipeline.AppendStep (new PreserveCode ());

            pipeline.AppendStep (new RemoveLibraryResourceZip ());
            pipeline.AppendStep (new RemoveResources (options.I18nAssemblies)); // remove collation tables
            // end monodroid specific

            pipeline.AppendStep (new FixAbstractMethodsStep ());
            pipeline.AppendStep (new MonoDroidMarkStep ());
            pipeline.AppendStep (new SweepStep ());
            pipeline.AppendStep (new CleanStep ());
            // monodroid tuner steps
            if (!string.IsNullOrWhiteSpace (options.ProguardConfiguration))
                pipeline.AppendStep (new GenerateProguardConfiguration (options.ProguardConfiguration));
            // end monodroid specific
            pipeline.AppendStep (new RegenerateGuidStep ());
            pipeline.AppendStep (new OutputStep ());

            return pipeline;
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var mydir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
            var monoroot = mydir.Parent.Parent.Parent.Parent;

            var inputdir = Path.Combine(monoroot.FullName,"builds/monodistribution/lib/mono/unity");
            var outputdir = Path.Combine(monoroot.FullName, "tmp/unity_linkered");

            if (Directory.Exists(outputdir))
                Directory.Delete(outputdir, true);
            Directory.CreateDirectory(outputdir);

            var assemblies = new List<string>();
            var nonassemblies = new List<string>();
            var files = new List<string>();
            foreach(var file in Directory.GetFiles(inputdir))
            {
                var ext = Path.GetExtension(file);
                var filename = Path.GetFileName(file);
                files.Add(filename);
                if (ext == ".dll" || ext==".exe")
                    assemblies.Add(filename);
                else
                    nonassemblies.Add(filename);
            }

            Console.WriteLine("InputDir: "+inputdir);
            Console.WriteLine("OutputDir: "+outputdir);

            Pipeline p = new Pipeline();

            foreach(var file in assemblies)
            {
                var fullfile = Path.Combine(inputdir,file);
                IStep s = null;
                var action = GetAssemblyAction(file);
                if (action==AssemblyAction.Link)
                    s = new MarkPublicApiExceptStep(fullfile);
                else if (action == AssemblyAction.Copy)
                    s = new ResolveFromAssemblyStep(fullfile);
                if (s!=null) p.AppendStep(s);
            }
            p.AppendStep(new LoadReferencesStep());
            p.AppendStep(new BlacklistStep());
            p.AppendStep(new TypeMapStep());
            p.AppendStep(new MarkAllFieldsOfSerializableTypes());
            p.AppendStep(new MarkStep());
            p.AppendStep(new SweepStep());
            p.AppendStep(new CleanStep());
            p.AppendStep(new RegenerateGuidStep());
            p.AppendStep(new OutputStep());
            p.AppendStep(new OutputMarkBacktraceReportStep());
            p.AppendStep(new FailIfWeMissTypesThatWeShippedInAPreviousVersionStep());

            LinkContext context = new LinkContext(p);
            context.CoreAction = AssemblyAction.Link;
            context.OutputDirectory = outputdir;
            context.Resolver.AddSearchDirectory(inputdir);
            p.Process(context);

            foreach(var file in files.Where(f => GetAssemblyAction(f)==AssemblyAction.Copy))
            {
                var _from = Path.Combine(inputdir,file);
                var _to = Path.Combine(outputdir,file);
                File.Copy(_from,_to,true);
            }
            WriteDiffReport(inputdir,assemblies, outputdir);
        }
Exemplo n.º 5
0
        protected static bool AddCustomStep(Pipeline pipeline, string arg)
        {
            Assembly custom_assembly = null;
            int      pos             = arg.IndexOf(",");

            if (pos != -1)
            {
                custom_assembly = GetCustomAssembly(arg.Substring(pos + 1));
                if (custom_assembly == null)
                {
                    return(false);
                }
                arg = arg.Substring(0, pos);
            }

            pos = arg.IndexOf(":");
            if (pos == -1)
            {
                var step = ResolveStep(arg, custom_assembly);
                if (step == null)
                {
                    return(false);
                }

                pipeline.AppendStep(step);
                return(true);
            }

            string[] parts = arg.Split(':');
            if (parts.Length != 2)
            {
                Console.WriteLine($"Invalid value '{arg}' specified for '--custom-step' option");
                return(false);
            }

            if (!parts[0].StartsWith("-") && !parts[0].StartsWith("+"))
            {
                Console.WriteLine($"Expected '+' or '-' to control new step insertion");
                return(false);
            }

            bool   before = parts[0][0] == '-';
            string name   = parts[0].Substring(1);

            IStep target = FindStep(pipeline, name);

            if (target == null)
            {
                Console.WriteLine($"Pipeline step '{name}' could not be found");
                return(false);
            }

            IStep newStep = ResolveStep(parts[1], custom_assembly);

            if (newStep == null)
            {
                return(false);
            }

            if (before)
            {
                pipeline.AddStepBefore(target, newStep);
            }
            else
            {
                pipeline.AddStepAfter(target, newStep);
            }

            return(true);
        }
Exemplo n.º 6
0
        static Pipeline CreatePipeline(LinkerOptions options)
        {
            var pipeline = new Pipeline ();

            pipeline.AppendStep (options.LinkMode == LinkMode.None ? new LoadOptionalReferencesStep () : 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 CustomizeMacActions (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 TypeMapStep ());

                pipeline.AppendStep (new SubStepDispatcher {
                    new ApplyPreserveAttribute (),
                    new CoreRemoveSecurity (),
                    new OptimizeGeneratedCodeSubStep (options.EnsureUIThread),
                    new CoreRemoveAttributes (),
                    new CoreHttpMessageHandler (options),
                    new CoreTlsProviderStep (options),
                    new MarkNSObjects (),
                });

                pipeline.AppendStep (new MonoMacPreserveCode (options));
                pipeline.AppendStep (new PreserveCrypto ());

                pipeline.AppendStep (new MonoMacMarkStep ());
                pipeline.AppendStep (new MacRemoveResources (options));
                pipeline.AppendStep (new MobileSweepStep ());
                pipeline.AppendStep (new CleanStep ());

                pipeline.AppendStep (new MonoMacNamespaces ());
                pipeline.AppendStep (new RemoveSelectors ());

                pipeline.AppendStep (new RegenerateGuidStep ());
            }

            pipeline.AppendStep (new ListExportedSymbols ());

            pipeline.AppendStep (new OutputStep ());

            return pipeline;
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
		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");
		}