Closure-compiler: Command line recursive globbing does not work on Windows

Created on 26 Sep 2018  路  7Comments  路  Source: google/closure-compiler

I'm having trouble getting the '**' command-line globbing operator for js files to work on Windows in recent releases. It appears to work on Linux just fine.

Windows example:

C:/temp/closure/test/test1.js
C:/temp/closure/test/test2.js

> java -jar compiler.jar --js='C:/temp/closure/**.js'
The compiler is waiting for input via stdin

Linux example:

/tmp/closure/test/test1.js
/tmp/closure/test/test2.js

> java -jar compiler.jar --js='/tmp/closure/**.js'
\

P3 help wanted internal-issue-created triage-done

Most helpful comment

Created Google internal issue http://b/122664915

All 7 comments

Chad I think you looked at something similiar recently?

+1 on this, in my scenario:

google-closure-compiler index.js "./lib/**/*.js" --process_common_js_modules --module_resolution NODE

results in

{ Error: ENOENT: no such file or directory, open 'C:\Projects\FRSource\FRS-hide-scrollbar\lib\**\*.js'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at vvd (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\jscomp.js:6455:186)
    at ovd (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\jscomp.js:7882:451)
    at XO (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\jscomp.js:1938:29)
    at $O (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\jscomp.js:3371:44)
    at C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\jscomp.js:3573:46
    at CompilerJS.run (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\lib\node\closure-compiler-js.js:54:17)
    at getFilesFromStdin.then.inputFiles (C:\Projects\FRSource\FRS-hide-scrollbar\node_modules\google-closure-compiler\cli.js:149:31)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Projects\\FRSource\\FRS-hide-scrollbar\\lib\\**\\*.js' }

There's a couple of issues going on here. For instance #3087 is also applicable.

@FRSgit That glob pattern isn't recognized by Closure Compiler. "./lib/**.js" would be the correct version.

@ChadKillingsworth but that means closure-compiler doesn't support minimatch-style glob (as stated in README). You think it should be noted in readme or maybe I should file a bug about that?

I have a similar problem - I'm trying to exclude files and it's not working. I have

--js=!**template.js

in my command line but it still tries to process template.js.

I assumed the problem was caused by escaping, so I downloaded the source code and modified it to output the args to stdout but the arg makes it all the way into main without getting messed up.

I found a few issues:

  • the exclude filename is a relative path and the filename from the include is an absolute path so they aren't equal and the file gets included when it shouldn't
  • the excludes and includes are processed in the same loop so the order of parameters is significant, I don't know if this is intended
  • it searches through all subdirectories of the current directory looking for files matching the exclude glob and adding them to the exclude list which can be slow if the current directory contains a lot of files and folders. If possible it would be quicker to compare the included files to the excluded globs

Created Google internal issue http://b/122664915

Was this page helpful?
0 / 5 - 0 ratings