@@ -140,21 +140,31 @@ 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` ,
149+ '--js=map.js' ,
150+ '--js=message.js' ,
151+ '--js=binary/arith.js' ,
152+ '--js=binary/constants.js' ,
153+ '--js=binary/decoder.js' ,
154+ '--js=binary/encoder.js' ,
155+ '--js=binary/reader.js' ,
156+ '--js=binary/utils.js' ,
157+ '--js=binary/writer.js' ,
158+ `--js=${ exportsFile } ` ,
159+ `--entry_point=${ exportsFile } ` ,
160+ `> ${ outputFile } `
161+ ] . join ( ' ' ) ;
152162}
153163
154164gulp . task ( 'dist' , gulp . series ( [ 'genproto_wellknowntypes' ] , function ( cb ) {
155165 // TODO(haberman): minify this more aggressively.
156166 // Will require proper externs/exports.
157- exec ( getClosureBuilderCommand ( 'commonjs/export.js' , 'google-protobuf.js' ) ,
167+ exec ( getClosureCompilerCommand ( 'commonjs/export.js' , 'google-protobuf.js' ) ,
158168 function ( err , stdout , stderr ) {
159169 console . log ( stdout ) ;
160170 console . log ( stderr ) ;
@@ -164,7 +174,7 @@ gulp.task('dist', gulp.series(['genproto_wellknowntypes'], function(cb) {
164174
165175gulp . task ( 'commonjs_asserts' , function ( cb ) {
166176 exec ( 'mkdir -p commonjs_out/test_node_modules && ' +
167- getClosureBuilderCommand (
177+ getClosureCompilerCommand (
168178 'commonjs/export_asserts.js' ,
169179 'commonjs_out/test_node_modules/closure_asserts_commonjs.js' ) ,
170180 function ( err , stdout , stderr ) {
@@ -176,7 +186,7 @@ gulp.task('commonjs_asserts', function (cb) {
176186
177187gulp . task ( 'commonjs_testdeps' , function ( cb ) {
178188 exec ( 'mkdir -p commonjs_out/test_node_modules && ' +
179- getClosureBuilderCommand (
189+ getClosureCompilerCommand (
180190 'commonjs/export_testdeps.js' ,
181191 'commonjs_out/test_node_modules/testdeps_commonjs.js' ) ,
182192 function ( err , stdout , stderr ) {
@@ -229,7 +239,7 @@ gulp.task(
229239 ] ,
230240 function ( cb ) {
231241 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' ,
242+ './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' ,
233243 function ( err , stdout , stderr ) {
234244 console . log ( stdout ) ;
235245 console . log ( stderr ) ;
0 commit comments