示例#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;
        }
示例#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));
 }
示例#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();
        }
示例#5
0
 protected TestBase(ITestOutputHelper testOutputHelper)
 {
     _testOutputHelper = testOutputHelper;
     _assemblyCompiler = new AssemblyCompiler(
         new FluentlangToCSharpEmitter(),
         new CSharpToAssemblyCompiler(LocalSystemDllsMetadataReferenceProvider.Instance, GetLogger <CSharpToAssemblyCompiler>()));
     _assemblyFactory = new AssemblyFactory(_assemblyCompiler);
 }
示例#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;
        }
示例#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;
        }
示例#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;
        }
        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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#13
0
 public virtual IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
 {
     return context;
 }
示例#14
0
 public AssemblyFactory(IAssemblyCompiler assemblyCompiler)
 {
     _assemblyCompiler = assemblyCompiler;
 }
示例#15
0
 public DefaultAssemblyProvider(IAssemblyCompiler assemblyCompiler, Encoding scriptFileEncoding)
 {
     _assemblyCompiler   = assemblyCompiler;
     _scriptFileEncoding = scriptFileEncoding;
 }
示例#16
0
 public AspNetCoreCompiler(ICompilerLog compilerLog)
 {
     _compilerLog      = compilerLog;
     _assemblyCompiler = new AspNetCoreAssemblyCompiler(compilerLog, new TemplateProvider(CompileTargetEnum.AspNetCore));
     _openApiCompiler  = new OpenApiCompiler();
 }
示例#17
0
 public DefaultAssemblyProvider(IAssemblyCompiler assemblyCompiler)
     : this(assemblyCompiler, DefaultEncoding)
 {
 }
示例#18
0
 public virtual IAssemblyCompilerContext Run(IAssemblyCompiler compiler, IAssemblyCompilerContext context)
 {
     return(context);
 }
示例#19
0
 public EditorEngine(AssemblyFactory assemblyFactory, IAssemblyCompiler assemblyCompiler)
 {
     _assemblyFactory  = assemblyFactory;
     _assemblyCompiler = assemblyCompiler;
 }
 public ScriptAssemblyComposer(IAssemblyCompiler compiler)
 {
     this.compiler = compiler;
  
 }