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

Unified Diff: tools/build_command_buffer.py

Issue 1699273002: Add a script to build and copy the command buffer shared library. This script will be used by the b… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/build_command_buffer.py
diff --git a/tools/build_command_buffer.py b/tools/build_command_buffer.py
new file mode 100755
index 0000000000000000000000000000000000000000..b733e850d618f3058830d097033e696339d1a659
--- /dev/null
+++ b/tools/build_command_buffer.py
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Script to build the command buffer shared library and copy it to Skia tree
+"""
+
+import argparse
+import os
+import shutil
+import sys
+
borenet 2016/02/17 12:26:14 Style nits: 2 lines between top-level blocks, 2-sp
bsalomon 2016/02/17 15:53:23 Done.
+def main():
+ parser = argparse.ArgumentParser(description=("Builds command_buffer_gles2 "
+ "library and copies it"))
+ parser.add_argument('-c', '--chrome-src', required=True, help=
+ 'path to Chromium checkout (directory containing .gclient)')
borenet 2016/02/17 12:26:15 The "-src" is a little misleading since that's als
bsalomon 2016/02/17 15:53:23 Changed to chrome-dir
+ parser.add_argument('-o', '--output-dir', default='.',
+ help='path to copy the command buffer shared library to')
+ parser.add_argument('--make-output-dir', default=False, action='store_true',
+ help='Makes the output directory if it does not already exist.')
+ parser.add_argument('-f', '--fetch', action='store_true',
+ help=('Create Chromium src directory and fetch chromium checkout (if '
+ 'directory does not already exist)'))
+ parser.add_argument('--chrome-build-type', default='Release',
+ help='Type of build for the command buffer (e.g. Debug or Release)')
+ parser.add_argument('--extra-ninja-args', default='',
+ help=('Extra arguments to pass to ninja when building the command '
+ 'buffer shared library'))
+ parser.add_argument('--chrome-revision', default='lkgr',
+ help='Revision (hash, branch tag) of Chromium to use.')
+ parser.add_argument('--no-sync', action='store_true', default=False,
+ help="Don't run git fetch or gclient sync in the Chromium tree")
+ args = parser.parse_args()
+
+ args.chrome_src = os.path.abspath(args.chrome_src)
+ args.output_dir = os.path.abspath(args.output_dir)
+
+ if not os.path.isdir(args.chrome_src):
+ if args.fetch:
+ os.mkdir(args.chrome_src)
borenet 2016/02/17 12:26:14 Probably want os.makedirs here, which is equivalen
bsalomon 2016/02/17 15:53:23 Done.
+ if not os.path.isdir(args.chrome_src):
+ sys.exit('Could not create ' + args.chrome_src)
+ os.chdir(args.chrome_src)
+ if os.system('fetch chromium'):
borenet 2016/02/17 12:26:14 This would be safer and avoid the chdir: subproce
bsalomon 2016/02/17 15:53:23 Done.
+ sys.exit('Error fetching chromium at ' + args.chrome_src)
+ else:
+ sys.exit('Invalid Chromium src directory: ' + args.chrome_src)
+
+ if not os.path.isdir(args.chrome_src + '/src'):
+ sys.exit(args.chrome_src + '/src' + ' does not exist')
borenet 2016/02/17 12:26:14 Use os.path.join(args.chrome_src, 'src'), here and
bsalomon 2016/02/17 15:53:23 Done.
+
+ if not os.path.isdir(args.output_dir):
+ if args.make_output_dir:
+ os.makedirs(args.output_dir)
+
+ if not os.path.isdir(args.output_dir):
+ sys.exit('Invalid output directory: ' + args.output_dir)
+
+ os.chdir(args.chrome_src + '/src')
+
+ chrome_target_dir = (os.path.abspath(args.chrome_src) + '/src/out/' +
+ args.chrome_build_type)
+
+ if not args.no_sync:
+ if os.system('git fetch'):
+ sys.exit('Error in git fetch.')
+
+ if os.system('git checkout origin/lkgr'):
+ sys.exit('Error checking out origin/lkgr.')
+
+ if not args.no_sync:
+ if os.system('gclient sync'):
+ sys.exit('Error in gclient sync.')
+
+ if os.system('ninja ' + args.extra_ninja_args + ' -C out/' +
+ args.chrome_build_type + ' command_buffer_gles2'):
+ sys.exit('Error building command_buffer_gles2.')
+
+ shared_lib_src = chrome_target_dir + '/lib/libcommand_buffer_gles2.so'
+ shared_lib_dst = args.output_dir + '/libcommand_buffer_gles2.so'
+
+ if not os.path.isfile(shared_lib_src):
+ sys.exit('Command buffer shared library not at expected location: ' +
+ shared_lib_src)
+
+ shutil.copy2(shared_lib_src, shared_lib_dst)
+
+ if not os.path.isfile(shared_lib_dst):
+ sys.exit('Command buffer library not copied to ' + shared_lib_dst)
+
+ print('Command buffer library copied to ' + shared_lib_dst)
+
+if __name__ == '__main__':
+ main()
+
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698