public void Generate(
            LibraryDescription description,
            string assemblyName,
            string assemblyOutputPath,
            Action <IEnumerable <SyntaxNode> > sourceWriter = null,
            Action <string> compiltionLogWriter             = null)
        {
            var classGenerator = new ClassProxyGenerator(new MethodBodyGetter());
            var proxySource    = new LibraryProxyGenerator(classGenerator).Generate(description);

            var trees = CompilationTreesGetter.GetCompilationTreesFrom(proxySource);

            sourceWriter?.Invoke(trees.Select(el => el.GetRoot()));

            new Compiller().Compile(trees, assemblyName, assemblyOutputPath, compiltionLogWriter);
        }
示例#2
0
        public void Generate(
            LibraryDescription description,
            string assemblyName,
            string assemblyOutputPath,
            Action <IEnumerable <string> > sourceLogger = null,
            Action <string> compiltionLogger            = null)
        {
            var methodBodyGetter          = new MethodBodyGetter("classRef", "jObject");
            var methodProxyGenerator      = new MethodProxyGenerator(methodBodyGetter);
            var constructorProxyGenerator = new ConstructorProxyGenerator(methodBodyGetter);

            var classGenerator = new ClassProxyGenerator(methodProxyGenerator, constructorProxyGenerator);
            var proxySource    = new LibraryProxyGenerator(classGenerator).Generate(description);

            var trees = CompilationTreesGetter.GetCompilationTreesFrom(proxySource);

            sourceLogger?.Invoke(trees.Select(el => el
                                              .GetRoot()
                                              .NormalizeWhitespace()
                                              .ToFullString())
                                 );

            new Compiller().Compile(trees, assemblyName, assemblyOutputPath, compiltionLogger);
        }