Q:

Creating a script to use Google Closure for multiple javascript files

I need to use the Google Closure compiler.jar to minify a huge project I am working on.  I have multiple js files that I want to compile into a single game.min.js file.  I know I can use the following:
java -jar compiler.jar --js file1.js --js file2.js --js etc, etc --js_output_file game.min.js

...but I have a LOT of files and as I understand it Closure doesn't have support for adding a directory and finding all the *.js files residing under that directory.  My fumbling google searches are not giving me any tools that I can use for the job (or nothing that works at any rate).
Has anyone out there found / used / written a script that loops through a directory and spits out all the .js files into a single minified file?  I am hopeless with php, python, etc, so any help greatly appreciated.

A:

You can use ant to automate the use of the closure compiler.
I do it in two separate steps, concatenation then compilation :
<concat destfile="src/somepath/app.concat.js">
    <filelist dir="src/somepath">
        <file name="a.js" />
        <file name="b.js" />
        <file name="c.js" />
        <file name="d.js" />
    </filelist>
</concat>

<jscomp compilationLevel="simple" warning="quiet" debug="false" output="src/app.min.js">
    <sources dir="src/somepath">
        <file name="app.concat.js" />
    </sources>
</jscomp>

Be careful that the order of the files is important. That's why you can't simply pass a fileset to the jscomp task.

