Example #1
0
        protected static void Build(string code, Dictionary <string, string> substitutions = null)
        {
            var engine = new Engine();

            var result = engine.Build(
                code, substitutions ?? new Dictionary <string, string>(), false
                );

            TaskRegistry.Global = new TaskRegistry(result);
        }
Example #2
0
        protected static void Build(string code, Dictionary<string, string> substitutions = null)
        {
            var engine = new Engine();

            var result = engine.Build(
                code, substitutions ?? new Dictionary<string, string>(), false
            );

            TaskRegistry.Global = new TaskRegistry(result);
        }
Example #3
0
        public BuildResult Build(string code, IDictionary <string, string> substitutions, bool debug)
        {
            var key = new CacheKey(script, code, substitutions, debug);

            var cached = key.Find(tasks);

            if (cached != null && !reset)
            {
                return(cached);
            }

            if (reset)
            {
                key.Reset();
            }

            var output = engine.Build(code, substitutions, debug);

            key.Store(output);

            return(output);
        }
Example #4
0
        protected static string Build(string code, Dictionary <string, string> substitutions = null, bool createScriptFile = false)
        {
            var additionalReferences = new[]
            {
                new AssemblyReference(typeof(StepAttribute).Assembly.Location),
                new AssemblyReference(typeof(Env).Assembly.Location)
            };

            var engine = new Engine(additionalReferences);
            var source = new ScriptSource(code);

            if (createScriptFile)
            {
                var tmp = Path.GetTempFileName();
                File.WriteAllText(tmp, code);
                source = new ScriptSource(code, new FileInfo(tmp));
            }

            var result = engine.Build(source,
                                      substitutions ?? new Dictionary <string, string>(), false);

            TaskRegistry.Global = new TaskRegistry(result);
            return(source.File?.FullName);
        }