Merge pull request #6173 from haon4/cherrypick_fix_build

Fix gulpfile to use gulp 4 API
pull/6201/head^2
Hao Nguyen 6 years ago committed by GitHub
commit 303191d892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      js/gulpfile.js
  2. 2
      js/package.json

@ -144,7 +144,7 @@ function getClosureBuilderCommand(exportsFile, outputFile) {
exportsFile + ' > ' + outputFile;
}
gulp.task('dist', ['genproto_wellknowntypes'], function (cb) {
gulp.task('dist', gulp.series(['genproto_wellknowntypes'], function (cb) {
// TODO(haberman): minify this more aggressively.
// Will require proper externs/exports.
exec(getClosureBuilderCommand('commonjs/export.js', 'google-protobuf.js'),
@ -153,7 +153,7 @@ gulp.task('dist', ['genproto_wellknowntypes'], function (cb) {
console.log(stderr);
cb(err);
});
});
}));
gulp.task('commonjs_asserts', function (cb) {
exec('mkdir -p commonjs_out/test_node_modules && ' +
@ -179,7 +179,7 @@ gulp.task('commonjs_testdeps', function (cb) {
});
});
gulp.task('make_commonjs_out', ['dist', 'genproto_well_known_types_commonjs', 'genproto_group1_commonjs', 'genproto_group2_commonjs', 'genproto_commonjs_wellknowntypes', 'commonjs_asserts', 'commonjs_testdeps', 'genproto_group3_commonjs_strict'], function (cb) {
gulp.task('make_commonjs_out', gulp.series(['dist', 'genproto_well_known_types_commonjs', 'genproto_group1_commonjs', 'genproto_group2_commonjs', 'genproto_commonjs_wellknowntypes', 'commonjs_asserts', 'commonjs_testdeps', 'genproto_group3_commonjs_strict'], function (cb) {
// TODO(haberman): minify this more aggressively.
// Will require proper externs/exports.
var cmd = "mkdir -p commonjs_out/binary && mkdir -p commonjs_out/test_node_modules && ";
@ -201,35 +201,35 @@ gulp.task('make_commonjs_out', ['dist', 'genproto_well_known_types_commonjs', 'g
console.log(stderr);
cb(err);
});
});
}));
gulp.task('deps', ['genproto_well_known_types_closure', 'genproto_group1_closure', 'genproto_group2_closure'], function (cb) {
gulp.task('deps', gulp.series(['genproto_well_known_types_closure', 'genproto_group1_closure', 'genproto_group2_closure'], function (cb) {
exec('./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',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
}));
gulp.task('test_closure', ['genproto_well_known_types_closure', 'genproto_group1_closure', 'genproto_group2_closure', 'deps'], function (cb) {
gulp.task('test_closure', gulp.series(['genproto_well_known_types_closure', 'genproto_group1_closure', 'genproto_group2_closure', 'deps'], function (cb) {
exec('JASMINE_CONFIG_PATH=jasmine.json ./node_modules/.bin/jasmine',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
}));
gulp.task('test_commonjs', ['make_commonjs_out'], function (cb) {
gulp.task('test_commonjs', gulp.series(['make_commonjs_out'], function (cb) {
exec('cd commonjs_out && JASMINE_CONFIG_PATH=jasmine.json NODE_PATH=test_node_modules ../node_modules/.bin/jasmine',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
}));
gulp.task('test', ['test_closure', 'test_commonjs'], function(cb) {
gulp.task('test', gulp.series(['test_closure', 'test_commonjs'], function(cb) {
cb();
});
}));

@ -11,7 +11,7 @@
"glob": "~6.0.4",
"google-closure-compiler": "~20190301.0.0",
"google-closure-library": "~20190301.0.0",
"gulp": "~3.9.0",
"gulp": "~4.0.1",
"jasmine": "~2.4.1"
},
"scripts": {

Loading…
Cancel
Save