Index: third_party/protobuf/js/gulpfile.js |
diff --git a/third_party/protobuf/js/gulpfile.js b/third_party/protobuf/js/gulpfile.js |
index c5220153b5bd7da95dbdad8d429a06e184c02e2e..5f1b1d93f608156dd8d0025b7231aeff41c5fe1a 100644 |
--- a/third_party/protobuf/js/gulpfile.js |
+++ b/third_party/protobuf/js/gulpfile.js |
@@ -8,8 +8,23 @@ function exec(command, cb) { |
var protoc = process.env.PROTOC || '../src/protoc'; |
+var wellKnownTypes = [ |
+ '../src/google/protobuf/any.proto', |
+ '../src/google/protobuf/api.proto', |
+ '../src/google/protobuf/compiler/plugin.proto', |
+ '../src/google/protobuf/descriptor.proto', |
+ '../src/google/protobuf/duration.proto', |
+ '../src/google/protobuf/empty.proto', |
+ '../src/google/protobuf/field_mask.proto', |
+ '../src/google/protobuf/source_context.proto', |
+ '../src/google/protobuf/struct.proto', |
+ '../src/google/protobuf/timestamp.proto', |
+ '../src/google/protobuf/type.proto', |
+ '../src/google/protobuf/wrappers.proto', |
+]; |
+ |
gulp.task('genproto_closure', function (cb) { |
- exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.proto ../src/google/protobuf/descriptor.proto', |
+ exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.proto && ' + protoc + ' --js_out=one_output_file_per_input_file,binary:. -I ../src -I . ' + wellKnownTypes.join(' '), |
function (err, stdout, stderr) { |
console.log(stdout); |
console.log(stderr); |
@@ -18,7 +33,25 @@ gulp.task('genproto_closure', function (cb) { |
}); |
gulp.task('genproto_commonjs', function (cb) { |
- exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,binary:commonjs_out -I ../src -I commonjs -I . *.proto commonjs/test*/*.proto ../src/google/protobuf/descriptor.proto', |
+ exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,binary:commonjs_out -I ../src -I commonjs -I . *.proto commonjs/test*/*.proto ' + wellKnownTypes.join(' '), |
+ function (err, stdout, stderr) { |
+ console.log(stdout); |
+ console.log(stderr); |
+ cb(err); |
+ }); |
+}); |
+ |
+gulp.task('genproto_commonjs_wellknowntypes', function (cb) { |
+ exec('mkdir -p commonjs_out/node_modules/google-protobuf && ' + protoc + ' --js_out=import_style=commonjs,binary:commonjs_out/node_modules/google-protobuf -I ../src ' + wellKnownTypes.join(' '), |
+ function (err, stdout, stderr) { |
+ console.log(stdout); |
+ console.log(stderr); |
+ cb(err); |
+ }); |
+}); |
+ |
+gulp.task('genproto_wellknowntypes', function (cb) { |
+ exec(protoc + ' --js_out=import_style=commonjs,binary:. -I ../src ' + wellKnownTypes.join(' '), |
function (err, stdout, stderr) { |
console.log(stdout); |
console.log(stderr); |
@@ -26,7 +59,7 @@ gulp.task('genproto_commonjs', function (cb) { |
}); |
}); |
-gulp.task('dist', function (cb) { |
+gulp.task('dist', ['genproto_wellknowntypes'], function (cb) { |
// TODO(haberman): minify this more aggressively. |
// Will require proper externs/exports. |
exec('./node_modules/google-closure-library/closure/bin/calcdeps.py -i message.js -i binary/reader.js -i binary/writer.js -i commonjs/export.js -p . -p node_modules/google-closure-library/closure -o compiled --compiler_jar node_modules/google-closure-compiler/compiler.jar > google-protobuf.js', |
@@ -55,7 +88,7 @@ gulp.task('commonjs_testdeps', function (cb) { |
}); |
}); |
-gulp.task('make_commonjs_out', ['dist', 'genproto_commonjs', 'commonjs_asserts', 'commonjs_testdeps'], function (cb) { |
+gulp.task('make_commonjs_out', ['dist', 'genproto_commonjs', 'genproto_commonjs_wellknowntypes', 'commonjs_asserts', 'commonjs_testdeps'], 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 && "; |