public override void ExecuteRecursive(TaskExecutionNode node) { //Debugger.Break(); var assemblyProviders = new IAssemblyTaskProvider[] { new MsTestAssemblyTaskProvider(), new NUnitAssemblyTaskProvider(), new XUnitAssemblyTaskProvider() }; var classProviders = new IClassTaskProvider[] { new MsTestClassTaskProvider(), new NUnitClassTaskProvider(), new XUnitClassTaskProvider() }; var methodProviders = new IMethodTaskProvider[] { new MsTestMethodTaskProvider(), new NUnitMethodTaskProvider(), new XUnitMethodTaskProvider() }; var taskEnvironment = new TaskEnvironment(Server, assemblyProviders, classProviders, methodProviders); var taskNode = new TaskNode(node, taskEnvironment); foreach (var silverlightTaskNode in taskNode.GetSilverlightTasks()) { silverlightTaskNode.Execute(Execute); } }
protected void SetupTasks(TaskEnvironment environment, IList <ITask> target, XElement config) { if (null == config) { return; } foreach (var element in config.Elements()) { var name = element.Name.LocalName; if (name == "before" || name == "after" || name == "fallback" || name == "project") { continue; } if (null == TaskFactory) { throw new Exception("no task factory configured"); } var task = TaskFactory.Create(environment, element); if (null != task) { target.Add(task); task.Initialize(environment, this, element); } } }
private void ProcessTargets(TaskEnvironment env) { var targets = env.Config.Elements("target").ToDictionary(_ => _.Attr("code"), _ => _); foreach (var target in env.Targets) { ProcessTarget(env, targets, target, new List <string>()); } }
public void Execute(TaskEnvironment env) { env.Log.Debug("> project " + env.Config.Attr("code")); SetupEnvironment(env); ProcessSubprojects(env, "before", env.Config); ProcessTargets(env); ProcessSubprojects(env, "after", env.Config); env.Log.Debug("< project " + env.Config.Attr("code")); }
public int Execute(TaskConsoleParameters args) { var context = BSharpCompiler.CompileDirectory(args.ScriptDirectory, new BSharpConfig { Global = new Scope(args.Global), KeepLexInfo = true }); var cls = context[args.ScriptClass]; if (null == cls) { throw new Exception("cannot find class " + args.ScriptClass); } var container = ContainerFactory.CreateDefault(); container.RegisterAssembly(typeof(TaskProcess).Assembly); var configProvider = new GenericConfiguration(cls.Compiled, context) { Custom = args }; container.Set <IConfigProvider>(configProvider); Loggy.Manager = container.Get <ILoggyManager>(); var defloggy = Loggy.Manager.Get(); defloggy.Level = args.LogLevel; var consoleAppender = defloggy.Appenders.OfType <ConsoleAppender>().FirstOrDefault(); if (null == consoleAppender) { defloggy.Appenders.Add(new ConsoleAppender { Format = args.LogFormat, Level = args.LogLevel, Manager = Loggy.Manager }); } else { consoleAppender.Format = args.LogFormat; consoleAppender.Level = args.LogLevel; } var loggy = Loggy.Manager.Get("bcinst"); var installRequest = new TaskEnvironment { Config = cls.Compiled, Context = context, Log = loggy, Globals = new Scope(args.Global), Targets = args.Targets.ToArray() }; var processor = container.Get <ITaskProcessor>(); processor.Execute(installRequest); return(0); }
public ITask Create(TaskEnvironment environment, XElement definition) { foreach (var taskSource in Extensions) { var task = taskSource.Create(environment, definition); if (null != task) { return(task); } } return(null); }
private void ExecuteSilverlightTasks(TaskExecutionNode node) { var assemblyTaskProviders = UnitTestTaskProviderFactory.GetAssemblyTaskProviders(); var classTaskProviders = UnitTestTaskProviderFactory.GetClassTaskProviders(); var methodTaskProviders = UnitTestTaskProviderFactory.GetMethodTaskProviders(); var taskEnvironment = new TaskEnvironment(Server, assemblyTaskProviders, classTaskProviders, methodTaskProviders); var taskNode = new TaskNode(node, taskEnvironment); foreach (var silverlightTaskNode in taskNode.GetSilverlightTasks()) { silverlightTaskNode.Execute(Execute); } }
public override void ExecuteRecursive(TaskExecutionNode node) { //Debugger.Break(); var assemblyTaskProviders = UnitTestTaskProviderFactory.GetAssemblyTaskProviders(); var classTaskProviders = UnitTestTaskProviderFactory.GetClassTaskProviders(); var methodTaskProviders = UnitTestTaskProviderFactory.GetMethodTaskProviders(); var taskEnvironment = new TaskEnvironment(Server, assemblyTaskProviders, classTaskProviders, methodTaskProviders); var taskNode = new TaskNode(node, taskEnvironment); foreach (var silverlightTaskNode in taskNode.GetSilverlightTasks()) { silverlightTaskNode.Execute(Execute); } }
private void ProcessTarget(TaskEnvironment env, XElement target) { var iocname = target.Attr("component"); if (string.IsNullOrWhiteSpace(iocname)) { iocname = "qorpent.tasks.compound"; } var task = env.Container.Get <ITask>(iocname); task.Initialize(env, null, target); var scope = new Scope(env.Globals); ProcessSubprojects(env, "before", target); task.Execute(scope); ProcessSubprojects(env, "after", target); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); var libname = config.Attr("code"); if (environment.LibNameCache.Contains(libname)) { L.Trace("lib " + libname + " already in cache"); } else { environment.Container.RegisterAssembly(Assembly.Load(libname)); var factory = environment.Container.Get <ITaskFactory>(); factory.UpdateSourceList(); L.Trace("lib " + libname + " registered in Container"); } }
public virtual void Initialize(TaskEnvironment environment, ITask parent, XElement config) { Environment = environment; TaskFactory = TaskFactory ?? environment.Container.Get <ITaskFactory>(); Parent = parent; Config = config; L = Environment.Log; ErrorLevel = config.Attr("errorlevel", "Error").To <LogLevel>(); Condition = config.Attr("condition"); TaskScope = config.Attr("scope").To <TaskScope>(); var name = config.Attr("name"); if (!string.IsNullOrWhiteSpace(name)) { Name = name; } if (config.Attr("async").ToBool()) { Flags |= TaskFlags.Async; } SetupTasks(environment, Before, config.Element("before")); SetupTasks(environment, After, config.Element("after")); SetupTasks(environment, Fallback, config.Element("fallback")); TaskCode = config.Attr("code"); TaskName = config.Attr("name"); var current = config; while (true) { if (null == current) { break; } foreach (var a in current.Attributes()) { if (!PlainConfig.ContainsKey(a.Name.LocalName)) { PlainConfig[a.Name.LocalName] = a.Value; } } current = current.Parent; } }
private void SetupEnvironment(TaskEnvironment request) { request.Container = request.Container ?? Container; foreach (var element in request.Config.Elements("lib")) { var libname = element.AttrOrValue("code"); if (!request.LibNameCache.Contains(libname)) { request.Container.RegisterAssembly(Assembly.Load(libname)); request.LibNameCache.Add(libname); } } if (null == request.Targets || 0 == request.Targets.Length) { request.Targets = new[] { "default" }; } }
public ITask Create(TaskEnvironment environment, XElement definition) { if (definition.Name.LocalName == "task") { var name = definition.Attr("code"); if (string.IsNullOrWhiteSpace(name)) { throw new Exception("invalid generic task - no code"); } var gt = ResolveService <ITask>(name); if (null == gt) { throw new Exception("no configured task with name " + name); } return(gt); } else { var name = "qorpent.tasks." + definition.Name.LocalName.ToLowerInvariant() + ".task"; var deft = ResolveService <ITask>(name); return(deft); } }
private void ProcessTarget(TaskEnvironment env, Dictionary <string, XElement> targets, string targetName, List <string> visited) { if (visited.Contains(targetName)) { return; } visited.Add(targetName); env.Log.Debug(">> target '" + targetName + "'"); if (!targets.ContainsKey(targetName)) { throw new Exception("Cannot find target '" + targetName + "' in project '" + env.Config.Attr("code") + "'"); } var target = targets[targetName]; var pretargets = target.Attr("targets").SmartSplit(false, true, ',', ';', ' '); foreach (var pretarget in pretargets) { ProcessTarget(env, targets, pretarget, visited); } ProcessTarget(env, target); env.Log.Debug("<< target " + targetName); }
private void ProcessSubprojects(TaskEnvironment request, string mode, XElement root) { var requirements = request.Config.Elements("project") .Where( _ => _.Attr("mode") == mode || (mode == "before" && string.IsNullOrWhiteSpace(_.Attr("mode")))); foreach (var requirement in requirements) { var clsname = requirement.Attr("code"); var cls = request.Context[clsname]; if (null == clsname) { throw new Exception("cannot find required subproject " + cls); } var targets = requirement.Attr("targets"); var subenvironment = request.Copy(); if (!string.IsNullOrWhiteSpace(targets)) { subenvironment.Targets = targets.SmartSplit(false, true, ',', ';', ' ').ToArray(); } Execute(subenvironment); } }
private void ExecuteSilverlightTasks(TaskExecutionNode node) { var assemblyTaskProviders = UnitTestTaskProviderFactory.GetAssemblyTaskProviders(); var classTaskProviders = UnitTestTaskProviderFactory.GetClassTaskProviders(); var methodTaskProviders = UnitTestTaskProviderFactory.GetMethodTaskProviders(); var taskEnvironment = new TaskEnvironment(Server, assemblyTaskProviders, classTaskProviders, methodTaskProviders); var taskNode = new TaskNode(node, taskEnvironment); foreach (var silverlightTaskNode in taskNode.GetSilverlightTasks()) { silverlightTaskNode.Execute(Execute); } }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); ConnectionName = config.Attr("connection", "default"); Database = config.Attr("database"); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); CommandText = config.AttrOrValue("script"); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); this.Directory = config.ChooseAttr("dir", "directory"); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); SetupTasks(environment, Main, config); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); Message = config.AttrOrValue("message"); Level = config.Attr("level", "warn").To <LogLevel>(); }
public override void Initialize(TaskEnvironment environment, ITask parent, XElement config) { base.Initialize(environment, parent, config); this.DirectoryToCreate = config.Attr("code"); }