static void compileWithArgs(final String[] args, int offset, final int limit)
            throws Exception
    {
        String propsResource = args[offset++];
        Properties props = propsFrom(propsResource);
        if (props == null)
        {
            System.err.println(propsResource + " does not exist.");
            return;
        }

        Properties globalOptions = newGlobalOptions(props);

        final CachingProtoLoader loader =
                ("true".equals(props.getProperty("cache_protos")) ||
                "true".equals(System.getProperty("cache_protos"))) ?
                        new CachingProtoLoader() : null;

        boolean selectedProfileOrModule = false;
        for (String arg = propsResource;;)
        {
            if (offset != limit)
            {
                if ((arg = args[offset]).charAt(0) == '@')
                {
                    // activating a profile
                    compileProfile(props, arg, loader, globalOptions, null, 0);

                    selectedProfileOrModule = true;
                    offset++;
                    continue;
                }

                if (!new File(arg).exists())
                {
                    // specific module
                    compile(loadModule(props, arg, loader, null, null,
                            globalOptions, null, null));

                    selectedProfileOrModule = true;
                    offset++;
                    continue;
                }
            }

            if (selectedProfileOrModule)
            {
                if (offset == limit)
                    return;

                selectedProfileOrModule = false;

                if ((props = propsFrom((arg = args[offset++]))) == null)
                {
                    // the next properties file does not exist.
                    System.err.println(arg + " does not exist.");
                    return;
                }

                globalOptions = newGlobalOptions(props);

                continue;
            }

            // compile the csv from "modules" property
            String moduleString = props.getProperty("modules");
            if (moduleString == null || moduleString.length() == 0)
            {
                System.err.println("Errors on: " + arg);
                propsErr();
                return;
            }

            for (String m : COMMA.split(moduleString))
            {
                m = m.trim();

                if (m.charAt(0) == '@')
                {
                    // referencing another profile
                    compileProfile(props, m, loader, globalOptions, null, 0);
                    continue;
                }

                compile(loadModule(props, m, loader, null, null,
                        globalOptions, null, null));
            }

            if (offset == limit)
                return;

            if ((props = propsFrom((arg = args[offset++]))) == null)
            {
                // the next properties file does not exist.
                System.err.println(arg + " does not exist.");
                return;
            }

            globalOptions = newGlobalOptions(props);
        }
    }
The main execution point of compiling protos.

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