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

Unified Diff: build/android/gyp/create_tool_script.py

Issue 1663103004: Create wrapper scripts that set --output-directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adb_gdb-explicit
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/BUILD.gn ('k') | third_party/android_platform/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/create_tool_script.py
diff --git a/build/android/gyp/create_tool_script.py b/build/android/gyp/create_tool_script.py
new file mode 100755
index 0000000000000000000000000000000000000000..7e4a293f2abebf6f094fd40310cd0d64f5387cb1
--- /dev/null
+++ b/build/android/gyp/create_tool_script.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
jbudorick 2016/02/03 19:46:27 It'd be nice if this could share logic with the ex
agrieve 2016/02/04 19:27:00 Just spent some time attempting this. Looked at: -
jbudorick 2016/02/08 16:14:18 :( ok
+#
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Creates a simple wrapper script that passes the correct --output-directory.
+"""
+
+import argparse
+import os
+
+from util import build_utils
+
+# The java command must be executed in the current directory because there may
jbudorick 2016/02/03 19:46:27 ...? I'm not sure I follow the requirements implie
agrieve 2016/02/04 19:27:00 Whoops, left over from create_java_binary_script.p
+# be user-supplied paths in the args. The script receives the classpath relative
+# to the directory that the script is written in and then, when run, must
+# recalculate the paths relative to the current directory.
+_TEMPLATE = """\
+#!/usr/bin/env python
+#
+# This file was generated by //build/android/gyp/create_tool_script.py
+
+import os
+import sys
+
+args = ['--output-directory={output_directory}'] + sys.argv[1:]
+os.execv('{cmd}', args)
+"""
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--output', help='Output path for executable script.')
+ parser.add_argument('--target', help='Path to script being wrapped.')
+ parser.add_argument('--output-directory', help='Value for --output-directory')
+ args = parser.parse_args()
+
+ with open(args.output, 'w') as script:
+ script.write(_TEMPLATE.format(
+ cmd=os.path.abspath(args.target),
+ output_directory=os.path.abspath(args.output_directory)))
+
+ os.chmod(args.output, 0750)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « build/android/BUILD.gn ('k') | third_party/android_platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698