Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / node_modules / protobufjs / scripts / build.js
diff --git a/legacy-libs/grpc/node_modules/protobufjs/scripts/build.js b/legacy-libs/grpc/node_modules/protobufjs/scripts/build.js
new file mode 100644 (file)
index 0000000..db3ab95
--- /dev/null
@@ -0,0 +1,53 @@
+/*\r
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ */\r
+\r
+var MetaScript = require("metascript"),\r
+    path = require("path"),\r
+    fs = require("fs");\r
+\r
+var rootDir = path.join(__dirname, ".."),\r
+    srcDir  = path.join(rootDir, "src"),\r
+    distDir = path.join(rootDir, "dist"),\r
+    pkg = require(path.join(rootDir, "package.json")),\r
+    filename;\r
+\r
+var scope = {\r
+    VERSION: pkg.version,           // Version\r
+    DOTPROTO: true                  // Whether to include the ProtoBuf.DotProto package for .proto syntax support\r
+};\r
+\r
+// Make full build\r
+console.log("Building protobuf.js with scope", JSON.stringify(scope, null, 2));\r
+fs.writeFileSync(\r
+    path.join(distDir, "protobuf.js"),\r
+    MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir)\r
+);\r
+\r
+// Make light build\r
+scope.DOTPROTO = false;\r
+console.log("Building protobuf-light.js with scope", JSON.stringify(scope, null, 2));\r
+fs.writeFileSync(\r
+    path.join(distDir, "protobuf-light.js"),\r
+    MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir)\r
+);\r
+\r
+// Update bower.json\r
+scope = { VERSION: pkg.version };\r
+console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2));\r
+fs.writeFileSync(\r
+    path.join(rootDir, "bower.json"),\r
+    MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json.in")), filename, scope, srcDir)\r
+);\r