aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/protobuf.js/generate_pbjs_files.js
diff options
context:
space:
mode:
authorYilun Chong <yilunchong@google.com>2018-08-08 11:24:09 -0700
committerYilun Chong <yilunchong@google.com>2018-08-08 11:24:09 -0700
commit5a95666f6e3f1cae3fdd790d992a45c0b64c3b13 (patch)
tree0b5f23413cb4bc2f60606d4a38a127d16aa38d3f /benchmarks/protobuf.js/generate_pbjs_files.js
parenta7071291c750fe2b1b8a20c155f4e3dd5a38db24 (diff)
downloadprotobuf-5a95666f6e3f1cae3fdd790d992a45c0b64c3b13.tar.gz
protobuf-5a95666f6e3f1cae3fdd790d992a45c0b64c3b13.tar.bz2
protobuf-5a95666f6e3f1cae3fdd790d992a45c0b64c3b13.zip
fix filename and newline
Diffstat (limited to 'benchmarks/protobuf.js/generate_pbjs_files.js')
-rw-r--r--benchmarks/protobuf.js/generate_pbjs_files.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/benchmarks/protobuf.js/generate_pbjs_files.js b/benchmarks/protobuf.js/generate_pbjs_files.js
new file mode 100644
index 00000000..11945bf9
--- /dev/null
+++ b/benchmarks/protobuf.js/generate_pbjs_files.js
@@ -0,0 +1,25 @@
+var pbjs = require("./protobuf.js/cli").pbjs
+
+var argv = [];
+var protoFiles = [];
+var prefix = "";
+process.argv.forEach(function(val, index) {
+ var arg = val;
+ if (arg.length > 6 && arg.substring(arg.length - 6) == ".proto") {
+ protoFiles.push(arg);
+ } else if (arg.length > 15 && arg.substring(0, 15) == "--include_path=") {
+ prefix = arg.substring(15);
+ } else if (index >= 2) {
+ argv.push(arg);
+ }
+});
+protoFiles.forEach(function(val) {
+ argv.push(prefix + "/" + val);
+});
+
+pbjs.main(argv, function(err, output){
+ if (err) {
+ console.log(err);
+ }
+});
+