@@ -140,50 +140,55 @@ gulp.task('genproto_group3_commonjs_strict', function (cb) {
140140} ) ;
141141
142142
143- function getClosureBuilderCommand ( exportsFile , outputFile ) {
144- return './node_modules/google-closure-library/closure/bin/build/closurebuilder.py ' +
145- '--root node_modules ' +
146- '-o compiled ' +
147- '--compiler_jar node_modules/google-closure-compiler-java/compiler.jar ' +
148- '-i ' + exportsFile + ' ' +
149- 'map.js message.js binary/arith.js binary/constants.js binary/decoder.js ' +
150- 'binary/encoder.js binary/reader.js binary/utils.js binary/writer.js ' +
151- exportsFile + ' > ' + outputFile ;
143+ function getClosureCompilerCommand ( exportsFile , outputFile ) {
144+ const closureLib = 'node_modules/google-closure-library' ;
145+ return [
146+ 'node_modules/.bin/google-closure-compiler' ,
147+ `--js=${ closureLib } /closure/goog/**.js` ,
148+ `--js=${ closureLib } /third_party/closure/goog/**.js` , '--js=map.js' ,
149+ '--js=message.js' , '--js=binary/arith.js' , '--js=binary/constants.js' ,
150+ '--js=binary/decoder.js' , '--js=binary/encoder.js' , '--js=binary/reader.js' ,
151+ '--js=binary/utils.js' , '--js=binary/writer.js' , `--js=${ exportsFile } ` ,
152+ `--entry_point=${ exportsFile } ` , `> ${ outputFile } `
153+ ] . join ( ' ' ) ;
152154}
153155
154156gulp . task ( 'dist' , gulp . series ( [ 'genproto_wellknowntypes' ] , function ( cb ) {
155157 // TODO(haberman): minify this more aggressively.
156158 // Will require proper externs/exports.
157- exec ( getClosureBuilderCommand ( 'commonjs/export.js' , 'google-protobuf.js' ) ,
158- function ( err , stdout , stderr ) {
159- console . log ( stdout ) ;
160- console . log ( stderr ) ;
161- cb ( err ) ;
162- } ) ;
159+ exec (
160+ getClosureCompilerCommand ( 'commonjs/export.js' , 'google-protobuf.js' ) ,
161+ function ( err , stdout , stderr ) {
162+ console . log ( stdout ) ;
163+ console . log ( stderr ) ;
164+ cb ( err ) ;
165+ } ) ;
163166} ) ) ;
164167
165- gulp . task ( 'commonjs_asserts' , function ( cb ) {
166- exec ( 'mkdir -p commonjs_out/test_node_modules && ' +
167- getClosureBuilderCommand (
168- 'commonjs/export_asserts.js' ,
169- 'commonjs_out/test_node_modules/closure_asserts_commonjs.js' ) ,
170- function ( err , stdout , stderr ) {
171- console . log ( stdout ) ;
172- console . log ( stderr ) ;
173- cb ( err ) ;
174- } ) ;
168+ gulp . task ( 'commonjs_asserts' , function ( cb ) {
169+ exec (
170+ 'mkdir -p commonjs_out/test_node_modules && ' +
171+ getClosureCompilerCommand (
172+ 'commonjs/export_asserts.js' ,
173+ 'commonjs_out/test_node_modules/closure_asserts_commonjs.js' ) ,
174+ function ( err , stdout , stderr ) {
175+ console . log ( stdout ) ;
176+ console . log ( stderr ) ;
177+ cb ( err ) ;
178+ } ) ;
175179} ) ;
176180
177- gulp . task ( 'commonjs_testdeps' , function ( cb ) {
178- exec ( 'mkdir -p commonjs_out/test_node_modules && ' +
179- getClosureBuilderCommand (
180- 'commonjs/export_testdeps.js' ,
181- 'commonjs_out/test_node_modules/testdeps_commonjs.js' ) ,
182- function ( err , stdout , stderr ) {
183- console . log ( stdout ) ;
184- console . log ( stderr ) ;
185- cb ( err ) ;
186- } ) ;
181+ gulp . task ( 'commonjs_testdeps' , function ( cb ) {
182+ exec (
183+ 'mkdir -p commonjs_out/test_node_modules && ' +
184+ getClosureCompilerCommand (
185+ 'commonjs/export_testdeps.js' ,
186+ 'commonjs_out/test_node_modules/testdeps_commonjs.js' ) ,
187+ function ( err , stdout , stderr ) {
188+ console . log ( stdout ) ;
189+ console . log ( stderr ) ;
190+ cb ( err ) ;
191+ } ) ;
187192} ) ;
188193
189194gulp . task (
@@ -229,7 +234,7 @@ gulp.task(
229234 ] ,
230235 function ( cb ) {
231236 exec (
232- './node_modules/google-closure-library/closure/bin/build/depswriter.py binary/arith.js binary/constants.js binary/decoder.js binary/encoder.js binary/reader.js binary/utils.js binary/writer.js debug.js map.js message.js node_loader.js test_bootstrap.js > deps.js' ,
237+ './node_modules/.bin/closure-make-deps --closure-path=. --file=node_modules/ google-closure-library/closure/goog/deps.js binary/arith.js binary/constants.js binary/decoder.js binary/encoder.js binary/reader.js binary/utils.js binary/writer.js debug.js map.js message.js node_loader.js test_bootstrap.js > deps.js' ,
233238 function ( err , stdout , stderr ) {
234239 console . log ( stdout ) ;
235240 console . log ( stderr ) ;
0 commit comments