Unverified Commit 303191d8 authored by Hao Nguyen's avatar Hao Nguyen Committed by GitHub

Merge pull request #6173 from haon4/cherrypick_fix_build

Fix gulpfile to use gulp 4 API
parents 95c207f2 f9cd7bd9
...@@ -144,7 +144,7 @@ function getClosureBuilderCommand(exportsFile, outputFile) { ...@@ -144,7 +144,7 @@ function getClosureBuilderCommand(exportsFile, outputFile) {
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. // TODO(haberman): minify this more aggressively.
// Will require proper externs/exports. // Will require proper externs/exports.
exec(getClosureBuilderCommand('commonjs/export.js', 'google-protobuf.js'), exec(getClosureBuilderCommand('commonjs/export.js', 'google-protobuf.js'),
...@@ -153,7 +153,7 @@ gulp.task('dist', ['genproto_wellknowntypes'], function (cb) { ...@@ -153,7 +153,7 @@ gulp.task('dist', ['genproto_wellknowntypes'], function (cb) {
console.log(stderr); console.log(stderr);
cb(err); cb(err);
}); });
}); }));
gulp.task('commonjs_asserts', function (cb) { gulp.task('commonjs_asserts', function (cb) {
exec('mkdir -p commonjs_out/test_node_modules && ' + exec('mkdir -p commonjs_out/test_node_modules && ' +
...@@ -179,7 +179,7 @@ gulp.task('commonjs_testdeps', function (cb) { ...@@ -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. // TODO(haberman): minify this more aggressively.
// Will require proper externs/exports. // Will require proper externs/exports.
var cmd = "mkdir -p commonjs_out/binary && mkdir -p commonjs_out/test_node_modules && "; 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 ...@@ -201,35 +201,35 @@ gulp.task('make_commonjs_out', ['dist', 'genproto_well_known_types_commonjs', 'g
console.log(stderr); console.log(stderr);
cb(err); 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', 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) { function (err, stdout, stderr) {
console.log(stdout); console.log(stdout);
console.log(stderr); console.log(stderr);
cb(err); 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', exec('JASMINE_CONFIG_PATH=jasmine.json ./node_modules/.bin/jasmine',
function (err, stdout, stderr) { function (err, stdout, stderr) {
console.log(stdout); console.log(stdout);
console.log(stderr); console.log(stderr);
cb(err); 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', exec('cd commonjs_out && JASMINE_CONFIG_PATH=jasmine.json NODE_PATH=test_node_modules ../node_modules/.bin/jasmine',
function (err, stdout, stderr) { function (err, stdout, stderr) {
console.log(stdout); console.log(stdout);
console.log(stderr); console.log(stderr);
cb(err); cb(err);
}); });
}); }));
gulp.task('test', ['test_closure', 'test_commonjs'], function(cb) { gulp.task('test', gulp.series(['test_closure', 'test_commonjs'], function(cb) {
cb(); cb();
}); }));
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"glob": "~6.0.4", "glob": "~6.0.4",
"google-closure-compiler": "~20190301.0.0", "google-closure-compiler": "~20190301.0.0",
"google-closure-library": "~20190301.0.0", "google-closure-library": "~20190301.0.0",
"gulp": "~3.9.0", "gulp": "~4.0.1",
"jasmine": "~2.4.1" "jasmine": "~2.4.1"
}, },
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment