Ejemplo n.º 1
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var assemblyContext = context as AssemblyCompilerContext;
            if (assemblyContext == null)
                return context;

            var cmd = new StringBuilder("gcc -Wall -o ");
            cmd.Append(assemblyContext.Output);

            foreach (var file in assemblyContext.OutputFiles)
                cmd.AppendFormat(" {0}", file.Filename);

            string output;
            string error;
            if (Helper.Execute(cmd.ToString(), out error, out output) == 0)
            {
                if (!string.IsNullOrEmpty(error))
                    Helper.Break();

                return context;
            }

            Helper.Stop(() => new BuildException(error, output));

            return null;
        }
Ejemplo n.º 2
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var assemblyContext = context as AssemblyCompilerContext;

            if (assemblyContext == null)
            {
                return(context);
            }

            var cmd = new StringBuilder("gcc -Wall -o ");

            cmd.Append(assemblyContext.Output);

            foreach (var file in assemblyContext.OutputFiles)
            {
                cmd.AppendFormat(" {0}", file.Filename);
            }

            string output;
            string error;

            if (Helper.Execute(cmd.ToString(), out error, out output) == 0)
            {
                if (!string.IsNullOrEmpty(error))
                {
                    Helper.Break();
                }

                return(context);
            }

            Helper.Stop(() => new BuildException(error, output));

            return(null);
        }
 public AzureFunctionsCompiler(ICompilerLog compilerLog)
 {
     _compilerLog      = compilerLog;
     _jsonCompiler     = new JsonCompiler();
     _openApiCompiler  = new OpenApiCompiler();
     _assemblyCompiler = new AzureFunctionsAssemblyCompiler(compilerLog, new TemplateProvider(CompileTargetEnum.AzureFunctions));
 }
Ejemplo n.º 4
0
        public FunctionCompiler(Assembly configurationSourceAssembly,
                                string outputBinaryFolder,
                                bool outputProxiesJson,
                                TargetEnum target,
                                IAssemblyCompiler assemblyCompiler = null,
                                ITriggerReferenceProvider triggerReferenceProvider = null)
        {
            _configurationSourceAssembly = configurationSourceAssembly;
            _outputBinaryFolder          = outputBinaryFolder;
            _outputProxiesJson           = outputProxiesJson;
            _target            = target;
            _serviceCollection = new ServiceCollection();
            CommandingDependencyResolverAdapter adapter = new CommandingDependencyResolverAdapter(
                (fromType, toInstance) => _serviceCollection.AddSingleton(fromType, toInstance),
                (fromType, toType) => _serviceCollection.AddTransient(fromType, toType),
                (resolveType) => null // we never resolve during compilation
                );

            _commandRegistry          = adapter.AddCommanding();
            _assemblyCompiler         = assemblyCompiler ?? new AssemblyCompiler();
            _triggerReferenceProvider = triggerReferenceProvider ?? new TriggerReferenceProvider();
            _jsonCompiler             = new JsonCompiler();
            _proxiesJsonCompiler      = new ProxiesJsonCompiler();
            _openApiCompiler          = new OpenApiCompiler();
        }
Ejemplo n.º 5
0
 protected TestBase(ITestOutputHelper testOutputHelper)
 {
     _testOutputHelper = testOutputHelper;
     _assemblyCompiler = new AssemblyCompiler(
         new FluentlangToCSharpEmitter(),
         new CSharpToAssemblyCompiler(LocalSystemDllsMetadataReferenceProvider.Instance, GetLogger <CSharpToAssemblyCompiler>()));
     _assemblyFactory = new AssemblyFactory(_assemblyCompiler);
 }
Ejemplo n.º 6
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var ac = context as AssemblyCompilerContext;
            Helper.IsNotNull(ac);

            var asm = ac.AssemblyDefinition;
            var mc = compiler.MethodCompiler;
            foreach (ModuleDefinition module in asm.Modules)
                foreach (TypeDefinition type in module.Types)
                    foreach (MethodDefinition method in type.Methods)
                        ac.MethodContexts.Add(mc.GetContext(context, method));

            return ac;
        }
Ejemplo n.º 7
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var assemblyContext = context as AssemblyCompilerContext;
            if (assemblyContext == null)
                return context;

            var list = new List<IMethodCompilerContext>(assemblyContext.MethodContexts);
            assemblyContext.MethodContexts.Clear();

            foreach (var mc in list)
                assemblyContext.MethodContexts.Add(compiler.MethodCompiler.Compile(mc));

            return assemblyContext;
        }
Ejemplo n.º 8
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext ctxt)
        {
            var context = ctxt as TestContext;
            if (context == null)
                return ctxt;

            var mc = context.MethodContexts.First();

            CreateRuntime(context, mc.Method);

            //CreateStack(assemblyContext, method);

            return context;
        }
Ejemplo n.º 9
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var asmcc = context as AssemblyCompilerContext;

            if (asmcc == null)
            {
                return(context);
            }

            var asm = asmcc.AssemblyDefinition;

            foreach (AssemblyNameReference asmRef in asm.MainModule.AssemblyReferences)
            {
            }

            return(context);
        }
Ejemplo n.º 10
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext ctxt)
        {
            var context = ctxt as TestContext;

            if (context == null)
            {
                return(ctxt);
            }

            var mc = context.MethodContexts.First();

            CreateRuntime(context, mc.Method);

            //CreateStack(assemblyContext, method);

            return(context);
        }
Ejemplo n.º 11
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var assemblyContext = context as AssemblyCompilerContext;

            if (assemblyContext == null)
            {
                return(context);
            }

            var list = new List <IMethodCompilerContext>(assemblyContext.MethodContexts);

            assemblyContext.MethodContexts.Clear();

            foreach (var mc in list)
            {
                assemblyContext.MethodContexts.Add(compiler.MethodCompiler.Compile(mc));
            }

            return(assemblyContext);
        }
Ejemplo n.º 12
0
        public override IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
        {
            var ac = context as AssemblyCompilerContext;

            Helper.IsNotNull(ac);

            var asm = ac.AssemblyDefinition;
            var mc  = compiler.MethodCompiler;

            foreach (ModuleDefinition module in asm.Modules)
            {
                foreach (TypeDefinition type in module.Types)
                {
                    foreach (MethodDefinition method in type.Methods)
                    {
                        ac.MethodContexts.Add(mc.GetContext(context, method));
                    }
                }
            }

            return(ac);
        }
Ejemplo n.º 13
0
 public virtual IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
 {
     return context;
 }
Ejemplo n.º 14
0
 public AssemblyFactory(IAssemblyCompiler assemblyCompiler)
 {
     _assemblyCompiler = assemblyCompiler;
 }
Ejemplo n.º 15
0
 public DefaultAssemblyProvider(IAssemblyCompiler assemblyCompiler, Encoding scriptFileEncoding)
 {
     _assemblyCompiler   = assemblyCompiler;
     _scriptFileEncoding = scriptFileEncoding;
 }
Ejemplo n.º 16
0
 public AspNetCoreCompiler(ICompilerLog compilerLog)
 {
     _compilerLog      = compilerLog;
     _assemblyCompiler = new AspNetCoreAssemblyCompiler(compilerLog, new TemplateProvider(CompileTargetEnum.AspNetCore));
     _openApiCompiler  = new OpenApiCompiler();
 }
Ejemplo n.º 17
0
 public DefaultAssemblyProvider(IAssemblyCompiler assemblyCompiler)
     : this(assemblyCompiler, DefaultEncoding)
 {
 }
Ejemplo n.º 18
0
 public virtual IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
 {
     return(context);
 }
Ejemplo n.º 19
0
 public EditorEngine(AssemblyFactory assemblyFactory, IAssemblyCompiler assemblyCompiler)
 {
     _assemblyFactory  = assemblyFactory;
     _assemblyCompiler = assemblyCompiler;
 }
 public ScriptAssemblyComposer(IAssemblyCompiler compiler)
 {
     this.compiler = compiler;
  
 }