Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: third_party/protobuf/js/gulpfile.js

Issue 2599263002: third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Address comments Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/protobuf/js/debug_test.js ('k') | third_party/protobuf/js/jasmine.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var gulp = require('gulp'); 1 var gulp = require('gulp');
2 var execFile = require('child_process').execFile; 2 var execFile = require('child_process').execFile;
3 var glob = require('glob'); 3 var glob = require('glob');
4 4
5 function exec(command, cb) { 5 function exec(command, cb) {
6 execFile('sh', ['-c', command], cb); 6 execFile('sh', ['-c', command], cb);
7 } 7 }
8 8
9 var protoc = process.env.PROTOC || '../src/protoc'; 9 var protoc = process.env.PROTOC || '../src/protoc';
10 10
11 var wellKnownTypes = [
12 '../src/google/protobuf/any.proto',
13 '../src/google/protobuf/api.proto',
14 '../src/google/protobuf/compiler/plugin.proto',
15 '../src/google/protobuf/descriptor.proto',
16 '../src/google/protobuf/duration.proto',
17 '../src/google/protobuf/empty.proto',
18 '../src/google/protobuf/field_mask.proto',
19 '../src/google/protobuf/source_context.proto',
20 '../src/google/protobuf/struct.proto',
21 '../src/google/protobuf/timestamp.proto',
22 '../src/google/protobuf/type.proto',
23 '../src/google/protobuf/wrappers.proto',
24 ];
25
11 gulp.task('genproto_closure', function (cb) { 26 gulp.task('genproto_closure', function (cb) {
12 exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.pro to ../src/google/protobuf/descriptor.proto', 27 exec(protoc + ' --js_out=library=testproto_libs,binary:. -I ../src -I . *.pro to && ' + protoc + ' --js_out=one_output_file_per_input_file,binary:. -I ../src -I . ' + wellKnownTypes.join(' '),
13 function (err, stdout, stderr) { 28 function (err, stdout, stderr) {
14 console.log(stdout); 29 console.log(stdout);
15 console.log(stderr); 30 console.log(stderr);
16 cb(err); 31 cb(err);
17 }); 32 });
18 }); 33 });
19 34
20 gulp.task('genproto_commonjs', function (cb) { 35 gulp.task('genproto_commonjs', function (cb) {
21 exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,b inary:commonjs_out -I ../src -I commonjs -I . *.proto commonjs/test*/*.proto ../ src/google/protobuf/descriptor.proto', 36 exec('mkdir -p commonjs_out && ' + protoc + ' --js_out=import_style=commonjs,b inary:commonjs_out -I ../src -I commonjs -I . *.proto commonjs/test*/*.proto ' + wellKnownTypes.join(' '),
22 function (err, stdout, stderr) { 37 function (err, stdout, stderr) {
23 console.log(stdout); 38 console.log(stdout);
24 console.log(stderr); 39 console.log(stderr);
40 cb(err);
41 });
42 });
43
44 gulp.task('genproto_commonjs_wellknowntypes', function (cb) {
45 exec('mkdir -p commonjs_out/node_modules/google-protobuf && ' + protoc + ' --j s_out=import_style=commonjs,binary:commonjs_out/node_modules/google-protobuf -I ../src ' + wellKnownTypes.join(' '),
46 function (err, stdout, stderr) {
47 console.log(stdout);
48 console.log(stderr);
49 cb(err);
50 });
51 });
52
53 gulp.task('genproto_wellknowntypes', function (cb) {
54 exec(protoc + ' --js_out=import_style=commonjs,binary:. -I ../src ' + wellKnow nTypes.join(' '),
55 function (err, stdout, stderr) {
56 console.log(stdout);
57 console.log(stderr);
25 cb(err); 58 cb(err);
26 }); 59 });
27 }); 60 });
28 61
29 gulp.task('dist', function (cb) { 62 gulp.task('dist', ['genproto_wellknowntypes'], function (cb) {
30 // TODO(haberman): minify this more aggressively. 63 // TODO(haberman): minify this more aggressively.
31 // Will require proper externs/exports. 64 // Will require proper externs/exports.
32 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_m odules/google-closure-library/closure -o compiled --compiler_jar node_modules/go ogle-closure-compiler/compiler.jar > google-protobuf.js', 65 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_m odules/google-closure-library/closure -o compiled --compiler_jar node_modules/go ogle-closure-compiler/compiler.jar > google-protobuf.js',
33 function (err, stdout, stderr) { 66 function (err, stdout, stderr) {
34 console.log(stdout); 67 console.log(stdout);
35 console.log(stderr); 68 console.log(stderr);
36 cb(err); 69 cb(err);
37 }); 70 });
38 }); 71 });
39 72
40 gulp.task('commonjs_asserts', function (cb) { 73 gulp.task('commonjs_asserts', function (cb) {
41 exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure -library/closure/bin/calcdeps.py -i commonjs/export_asserts.js -p . -p node_modu les/google-closure-library/closure -o compiled --compiler_jar node_modules/googl e-closure-compiler/compiler.jar > commonjs_out/test_node_modules/closure_asserts _commonjs.js', 74 exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure -library/closure/bin/calcdeps.py -i commonjs/export_asserts.js -p . -p node_modu les/google-closure-library/closure -o compiled --compiler_jar node_modules/googl e-closure-compiler/compiler.jar > commonjs_out/test_node_modules/closure_asserts _commonjs.js',
42 function (err, stdout, stderr) { 75 function (err, stdout, stderr) {
43 console.log(stdout); 76 console.log(stdout);
44 console.log(stderr); 77 console.log(stderr);
45 cb(err); 78 cb(err);
46 }); 79 });
47 }); 80 });
48 81
49 gulp.task('commonjs_testdeps', function (cb) { 82 gulp.task('commonjs_testdeps', function (cb) {
50 exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure -library/closure/bin/calcdeps.py -i commonjs/export_testdeps.js -p . -p node_mod ules/google-closure-library/closure -o compiled --compiler_jar node_modules/goog le-closure-compiler/compiler.jar > commonjs_out/test_node_modules/testdeps_commo njs.js', 83 exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure -library/closure/bin/calcdeps.py -i commonjs/export_testdeps.js -p . -p node_mod ules/google-closure-library/closure -o compiled --compiler_jar node_modules/goog le-closure-compiler/compiler.jar > commonjs_out/test_node_modules/testdeps_commo njs.js',
51 function (err, stdout, stderr) { 84 function (err, stdout, stderr) {
52 console.log(stdout); 85 console.log(stdout);
53 console.log(stderr); 86 console.log(stderr);
54 cb(err); 87 cb(err);
55 }); 88 });
56 }); 89 });
57 90
58 gulp.task('make_commonjs_out', ['dist', 'genproto_commonjs', 'commonjs_asserts', 'commonjs_testdeps'], function (cb) { 91 gulp.task('make_commonjs_out', ['dist', 'genproto_commonjs', 'genproto_commonjs_ wellknowntypes', 'commonjs_asserts', 'commonjs_testdeps'], function (cb) {
59 // TODO(haberman): minify this more aggressively. 92 // TODO(haberman): minify this more aggressively.
60 // Will require proper externs/exports. 93 // Will require proper externs/exports.
61 var cmd = "mkdir -p commonjs_out/binary && mkdir -p commonjs_out/test_node_mod ules && "; 94 var cmd = "mkdir -p commonjs_out/binary && mkdir -p commonjs_out/test_node_mod ules && ";
62 function addTestFile(file) { 95 function addTestFile(file) {
63 cmd += 'node commonjs/rewrite_tests_for_commonjs.js < ' + file + 96 cmd += 'node commonjs/rewrite_tests_for_commonjs.js < ' + file +
64 ' > commonjs_out/' + file + '&& '; 97 ' > commonjs_out/' + file + '&& ';
65 } 98 }
66 99
67 glob.sync('*_test.js').forEach(addTestFile); 100 glob.sync('*_test.js').forEach(addTestFile);
68 glob.sync('binary/*_test.js').forEach(addTestFile); 101 glob.sync('binary/*_test.js').forEach(addTestFile);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 function (err, stdout, stderr) { 134 function (err, stdout, stderr) {
102 console.log(stdout); 135 console.log(stdout);
103 console.log(stderr); 136 console.log(stderr);
104 cb(err); 137 cb(err);
105 }); 138 });
106 }); 139 });
107 140
108 gulp.task('test', ['test_closure', 'test_commonjs'], function(cb) { 141 gulp.task('test', ['test_closure', 'test_commonjs'], function(cb) {
109 cb(); 142 cb();
110 }); 143 });
OLDNEW
« no previous file with comments | « third_party/protobuf/js/debug_test.js ('k') | third_party/protobuf/js/jasmine.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698