Example #1
0
 public void Process(LinkContext context)
 {
     _context = context;
     ProcessAssemblies (_document.CreateNavigator ());
 }
Example #2
0
 static LinkContext GetDefaultContext(Pipeline pipeline)
 {
     LinkContext context = new LinkContext (pipeline);
     context.CoreAction = AssemblyAction.Skip;
     context.OutputDirectory = "output";
     return context;
 }
Example #3
0
 public void Process(LinkContext context)
 {
     while (_steps.Count > 0) {
         IStep step = (IStep) _steps [0];
         step.Process (context);
         _steps.Remove (step);
     }
 }
Example #4
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);
        }