public static void compile(ProtoModule module) throws Exception
    {
        String strOptions = null;
        String originalOutput = module.getOutput();
        try
        {
            for (String output : COMMA.split(originalOutput))
            {
                output = output.trim();
                // update output for each iteration
                // effectively it is different compiler
                module.setOutput(output);
                // default generator is "output"
                module.setGenerator(output);
                ProtoCompiler compiler = __compilers.get(output);
                if (compiler == null)
                {
                    if (__compilerResolver != null)
                        compiler = __compilerResolver.resolve(module);
                    else if (output.endsWith(".stg"))
                    {
                        // custom code generator
                        String generator = createGeneratorName(output);
                        module.setGenerator(generator);
                        compiler = new PluginProtoCompiler(module, output);
                    }
                    else
                        throw new IllegalStateException("unknown output: " + output);
                }

                compiler.compile(module);

                if (!SILENT_MODE)
                {
                    StringBuilder buffer = new StringBuilder()
                            .append("Successfully compiled proto from ")
                            .append(module.getSource())
                            .append(" to output: ")
                            .append(output);

                    // lazy
                    if (strOptions == null)
                        strOptions = module.getOptions().toString();

                    if (strOptions.length() > 2)
                        buffer.append(' ').append(strOptions);

                    System.out.println(buffer.toString());
                }
            }
        }
        finally
        {
            // reset original module output and generator
            module.setOutput(originalOutput);
            module.setGenerator(null);
        }
    }
The main execution point of compiling protos.

@author David Yu
@created Jan 5, 2010
protostuff-compiler/src/main/java/io/protostuff/compiler/CompilerMain.java