]> khamidou — GitHub mirrors - electron.git/commitdiff
Rewrite build script in python.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 24 Jun 2013 07:36:38 +0000 (15:36 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 24 Jun 2013 07:36:38 +0000 (15:36 +0800)
script/build [deleted file]
script/build.py [new file with mode: 0755]

diff --git a/script/build b/script/build
deleted file mode 100755 (executable)
index 06a34af..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-set -e
-
-MODE=Release
-if [ ! -z $1 ]; then
-  MODE=$1
-fi
-
-cd "$(dirname "$0")/.."
-
-xcodebuild -configuration ${MODE} -target atom
diff --git a/script/build.py b/script/build.py
new file mode 100755 (executable)
index 0000000..2f9974a
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import subprocess
+import sys
+
+
+CONFIGURATIONS = ['Release', 'Debug']
+
+
+def main():
+  args = parse_args()
+  for config in args.configuration:
+    build_path = os.path.join('out', config)
+    subprocess.check_call(['ninja', '-C', build_path])
+
+
+def parse_args():
+  parser = argparse.ArgumentParser(description='Build atom-shell')
+  parser.add_argument('-c', '--configuration',
+                      help='Build with Release or Debug configuration',
+                      nargs='+',
+                      default=CONFIGURATIONS,
+                      required=False)
+  return parser.parse_args()
+
+
+if __name__ == '__main__':
+  sys.exit(main())