コード例 #1
0
		public LinkContext (Pipeline pipeline, AssemblyResolver resolver)
		{
			_pipeline = pipeline;
			_resolver = resolver;
			_actions = new Hashtable ();
			_parameters = new Hashtable ();
		}
コード例 #2
0
		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));
		}
コード例 #3
0
		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 ());
		}
コード例 #4
0
		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 ());
		}
コード例 #5
0
ファイル: Linker.cs プロジェクト: yudhitech/xamarin-android
 static LinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
 {
     var context = new LinkContext (pipeline, options.Resolver);
     if (options.DumpDependencies) {
         var prepareDependenciesDump = context.Annotations.GetType ().GetMethod ("PrepareDependenciesDump", new Type[] {});
         if (prepareDependenciesDump != null)
             prepareDependenciesDump.Invoke (context.Annotations, null);
     }
     context.LogInternalExceptions = Xamarin.Android.Tasks.MonoAndroidHelper.LogInternalExceptions;
     context.CoreAction = AssemblyAction.Link;
     context.LinkSymbols = true;
     context.SymbolReaderProvider = new MdbReaderProvider ();
     context.SymbolWriterProvider = new MdbWriterProvider ();
     context.OutputDirectory = options.OutputDirectory;
     return context;
 }
コード例 #6
0
ファイル: Linker.cs プロジェクト: yudhitech/xamarin-android
 static void Run(Pipeline pipeline, LinkContext context)
 {
     pipeline.Process (context);
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: tigerhu67/monobuildtools
        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);
        }
コード例 #8
0
ファイル: Tuning.cs プロジェクト: yudhitech/xamarin-macios
        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;
        }
コード例 #9
0
ファイル: Tuning.cs プロジェクト: yudhitech/xamarin-macios
 static LinkContext CreateLinkContext(LinkerOptions options, Pipeline pipeline)
 {
     var context = new MonoMacLinkContext (pipeline, options.Resolver);
     context.CoreAction = AssemblyAction.Link;
     context.LinkSymbols = options.LinkSymbols;
     if (options.LinkSymbols) {
         context.SymbolReaderProvider = new MdbReaderProvider ();
         context.SymbolWriterProvider = new MdbWriterProvider ();
     }
     context.OutputDirectory = options.OutputDirectory;
     return context;
 }
コード例 #10
0
ファイル: Driver.cs プロジェクト: nobled/mono
		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;
		}
コード例 #11
0
ファイル: LinkContext.cs プロジェクト: GirlD/mono
		public LinkContext (Pipeline pipeline)
			: this (pipeline, new AssemblyResolver ())
		{
		}
コード例 #12
0
 public LinkContext(Pipeline pipeline, AssemblyResolver resolver)
     : this(pipeline, resolver, new ReaderParameters {
     AssemblyResolver = resolver
 }, new UnintializedContextFactory())
 {
 }
コード例 #13
0
 public LinkContext(Pipeline pipeline)
     : this(pipeline, new AssemblyResolver())
 {
 }
コード例 #14
0
ファイル: Driver.cs プロジェクト: nobled/mono
		static LinkContext GetDefaultContext (Pipeline pipeline)
		{
			LinkContext context = new LinkContext (pipeline);
			context.CoreAction = AssemblyAction.Skip;
			context.OutputDirectory = "output";
			return context;
		}
コード例 #15
0
ファイル: Tuning.cs プロジェクト: yudhitech/xamarin-macios
        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;
        }
コード例 #16
0
ファイル: Linker.cs プロジェクト: yudhitech/xamarin-android
        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;
        }
コード例 #17
0
ファイル: Tuning.cs プロジェクト: yudhitech/xamarin-macios
        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;
        }
コード例 #18
0
ファイル: LinkContext.cs プロジェクト: GirlD/mono
		public LinkContext (Pipeline pipeline, AssemblyResolver resolver)
		{
			_pipeline = pipeline;
			_resolver = resolver;
			_actions = new Hashtable ();
			_parameters = new Hashtable ();
			_annotations = new AnnotationStore ();
			_readerParameters = new ReaderParameters {
				AssemblyResolver = _resolver,
			};
		}
コード例 #19
0
ファイル: Tuning.cs プロジェクト: yudhitech/xamarin-macios
 public MonoMacLinkContext(Pipeline pipeline, AssemblyResolver resolver)
     : base(pipeline, resolver)
 {
 }
コード例 #20
0
ファイル: SharpPakApp.cs プロジェクト: alexey-bez/SharpDX
 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;
 }
コード例 #21
0
ファイル: Driver.cs プロジェクト: nobled/mono
		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");
		}