thanpolas / grunt-closure-tools

Google Closure Tools for grunt
MIT License
95 stars 22 forks source link

Support "--js closure-library/closure/goog/deps.js" #64

Closed nalbion closed 7 years ago

nalbion commented 10 years ago

https://code.google.com/p/closure-library/wiki/FrequentlyAskedQuestions#When_I_compile_with_type-checking_on,_I_get_warnings_about_

When I compile with type-checking on, I get warnings about "Bad type annotation. Unknown type" from closure library files.

The raw compiler option would look something like:

--js closure-library/closure/goog/deps.js.

NOTE: If you're using closurebuilder.py (or calcdeps.py), it is not sufficient to simply specifiy "--root closure-library". You have to specifically add the deps file by passing a compiler option:

-f "--js closure-library/closure/goog/deps.js."
nalbion commented 10 years ago

Wierd - if I use the following "hack" (ideally I should be able to specify the path to closure as a variable)

    closureBuilder: {
        options: {
                            ...
            compilerOpts: {
                'js bower_components\\closure-library\\closure\\goog\\deps.js': null,
                compilation_level: 'ADVANCED_OPTIMIZATIONS',
                warning_level: 'verbose'
                ...

I get an error:

Executing: python bower_components/closure-library/closure/bin/build/closurebuilder.py -i js-closure/main.js --root=js-closure/ --root=bower_componen ts/closure-library/closure --root=bower_components/closure-library/third_party -o compiled --output_file=js/myproject.js --compiler_jar=node_modules/ superstartup-closure-compiler/build/compiler.jar --compiler_flags="--js bower_components\closure-library\closure\goog\deps.js" --compiler_flags="--com pilation_level=ADVANCED_OPTIMIZATIONS" --compiler_flags="--warning_level=verbose"

Error: Command failed: bower_components/closure-library/closure/bin/build/closurebuilder.py: Scanning paths...

bower_components/closure-library/closure/bin/build/closurebuilder.py: Compiling with the following command: java -client -jar node_modules/supersta rtup-closure-compiler/build/compiler.jar --js bower_components\closure-library\closure\goog\base.js ... --js bower_components\closure-library\closure\goog\deps.js --compilation_level=ADVANCED_OPTIMIZATIONS --warning_level=verbose

--js bower_components\closure-library\closure\goog\deps.js --compilation_level=ADVANCED_OPTIMIZATIONS --warning_level=verbose ...

--js VAL : The JavaScript filename. You may specify multiple

thanpolas commented 10 years ago

I'm not sure what to say... why would you need to include closure-library/closure/goog/deps.js?

How are the typecheck warnings related to this package?

Is this a bug or a feature request? What would you expect the correct behavior to be?

kvasa commented 10 years ago

You have to set 'js' in 'compilerOpts'. For example this works for me:

'closureBuilder': {
        options: {
            closureLibraryPath: 'src/lib/closure-library',
            builder: 'src/lib/closure-library/closure/bin/build/closurebuilder.py',
            namespaces: 'tf.editor.Editor',
            compilerFile: 'local/compiler.jar',
            output_mode: 'script',
            compile: true,
            compilerOpts: {
                compilation_level: 'ADVANCED_OPTIMIZATIONS',
                warning_level: 'VERBOSE',
                output_wrapper: '\'(function(){%output%}).call();\'',
                js: 'src/lib/closure-library/closure/goog/deps.js'
            },
            execOpts: {
                maxBuffer: 999999 * 1024
            }
        },

        default: {
            src: ['src/js/', 'src/lib/closure-library'],
            dest: 'build/js/Editor.comp.js'
        }
    },
thanpolas commented 7 years ago

closing due to inactivity, feel free to re-open if the issue persists.