Beispiel #1
0
        private static IEnumerable <string> CreateMatchingActions(XmlElement root, BuildEnviroment e)
        {
            foreach (var x in root.ElementsNamed("test"))
            {
                string action = x.GetAttributeString("action");
                string lhs    = x.GetAttributeString("lhs");
                string rhs    = x.GetAttributeString("rhs");

                string lhsValue = e.resolve(lhs);
                string rhsValue = e.resolve(rhs);

                bool ok = false;

                if (action == "=")
                {
                    if (lhsValue == rhsValue)
                    {
                        ok = true;
                    }
                }
                else
                {
                    throw new Exception("unsupported test action " + action);
                }

                if (ok)
                {
                    foreach (var s in CreateActions(x, e))
                    {
                        yield return(s);
                    }
                }
            }
        }
Beispiel #2
0
 private static IEnumerable <string> CreateActions(XmlElement root, BuildEnviroment e)
 {
     foreach (var x in root.ElementsNamed("action"))
     {
         yield return(x.GetFirstText());
     }
 }
Beispiel #3
0
 internal static IEnumerable <BuildAction> Read(XmlElement root, AutoVarData avd, BuildEnviroment parent)
 {
     foreach (var e in Xml.ElementsNamed(root, "action"))
     {
         BuildAction action = new BuildAction(BuildEnviroment.Read(e, avd, parent), Xml.GetAttributeString(e, "type"), Xml.GetAttributeString(e, "context"), Xml.GetAttributeString(e, "description"), Xml.GetAttributeString(e, "base"));
         yield return(action);
     }
 }
Beispiel #4
0
 public BuildAction(BuildEnviroment env, string Type, string Context, string description, string baseAction)
 {
     this.enviroment  = env;
     this.type        = Type;
     this.context     = Context;
     this.description = description;
     this.baseAction  = baseAction;
 }
Beispiel #5
0
 private static IEnumerable <Group> Read(XmlElement root, AutoVarData avd, BuildEnviroment parent)
 {
     foreach (var x in root.ElementsNamed("group"))
     {
         Group g = new Group("");
         Group.Read(x, g, avd, parent);
         yield return(g);
     }
 }
Beispiel #6
0
        internal static BuildEnviroment Read(System.Xml.XmlElement root, AutoVarData avd, BuildEnviroment parent)
        {
            BuildEnviroment env = new BuildEnviroment();

            env.Parent = parent;

            env.readVariables(root, avd);

            return(env);
        }
Beispiel #7
0
        public static BaseAction Load(string name, BuildEnviroment env)
        {
            string file = Path.Combine(AutoVarData.GetInstallFolder(), Path.ChangeExtension(name, "act"));

            var        root = Xml.Open(Xml.FromFile(file), "action");
            BaseAction act  = new BaseAction();

            act.add(CreateMatchingActions(root, env));
            if (act.commands.Count == 0)
            {
                throw new Exception("Missing commands for " + name);
            }
            return(act);
        }
Beispiel #8
0
 internal void execute(BuildEnviroment enviroment)
 {
     foreach (var c in commands)
     {
         var v = enviroment.run(c);
         v.WaitForExit();
         if (v.ExitCode != 0)
         {
             throw new Exception("failed to run cmd");
         }
         string err = v.StandardError.ReadToEnd();
         string msg = v.StandardOutput.ReadToEnd();
     }
 }
Beispiel #9
0
 private static void Read(XmlElement root, Group p, AutoVarData avd, BuildEnviroment parent)
 {
     p.enviroment = BuildEnviroment.Read(root, avd, parent);
     p.actions    = new List <BuildAction>(BuildAction.Read(root, avd, p.enviroment));
     p.groups     = new List <Group>(Group.Read(root, avd, p.enviroment));
 }
Beispiel #10
0
 public string getResolved(BuildEnviroment enviroment)
 {
     return(verify(enviroment.resolve(Value, Name)));
 }