Esempio n. 1
0
        public void GetBuildComponentsWithRootActionsTest()
        {
            BuildFile bf = TestData.BuildFile;

            List <IBuildFileElement> elements = (List <IBuildFileElement>)bf.GetBuildComponentsWithRootActions(new List <string>(new string[] { "Core", "TestComponent" }));

            Assert.AreEqual(3, elements.Count);
            Assert.AreEqual(((BuildComponent)elements[1]).Name, "Core");
            Assert.AreEqual(((BuildComponent)elements[2]).Name, "TestComponent");
        }
Esempio n. 2
0
        private List <IBuildFileElement> GetElements(BuildFile bf)
        {
            List <IBuildFileElement> elements = new List <IBuildFileElement>();

            if (radioBCAll.Checked)
            {
                elements = (List <IBuildFileElement>)bf.RootElements;
            }
            else if (radioBCSpec.Checked)
            {
                List <string> comps = new List <string>();

                foreach (object item in cListBC.CheckedItems)
                {
                    comps.Add(item.ToString());
                }

                elements = (List <IBuildFileElement>)bf.GetBuildComponentsWithRootActions(comps);
            }

            return(elements);
        }
Esempio n. 3
0
        private void HandleArguments()
        {
            if (cla.ParameterCount == 0 || cla["help"] != null)
            {
                System.Console.Write(this.GetHelpMessage());
                return;
            }

            BuildFile bf = this.GetBuildFile(cla["bf"]);

            List <IBuildFileElement> elements = new List <IBuildFileElement>();

            if (cla["bc"] == null)
            {
                if (bf.DefaultComponents == null)
                {
                    elements = (List <IBuildFileElement>)bf.RootElements;
                }
                else
                {
                    elements = (List <IBuildFileElement>)bf.GetBuildComponentsWithRootActions((List <string>)bf.DefaultComponents);
                }
            }
            else
            {
                if (cla["bc"].Length == 0)
                {
                    throw new CamBuildConsoleException("Argument 'bc' must be followed by a list of components to be built.");
                }

                if (cla["bc"] == "!all")
                {
                    elements = (List <IBuildFileElement>)bf.RootElements;
                }
                else
                {
                    List <string> comps = this.GetBuildComponents(cla["bc"]);

                    elements = (List <IBuildFileElement>)bf.GetBuildComponentsWithRootActions(comps);
                }
            }

            if (cla["prop"] != null)
            {
                SetProperties(bf);
            }

            this.SetRebuild(cla["rebuild"], bf);

            if (cla["silent"] == null)
            {
                Logging.Instance.Loggers.Add(new ConsoleLogger());
            }

            this.AddLoggers(cla["log"], cla["bf"]);

            System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss.fff") + "] Executing build file '" + cla["bf"] + "'.");
            System.Console.WriteLine();

            new BuildFileElementExecutor().ExecuteElements(elements);

            System.Console.WriteLine();
            System.Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss.fff") + "] Execution completed.");
        }