Improve development workflow with built libchromiumcontent
- Add `--debug_libchromiumcontent` to build libchromiumcontent for debugging (shared library build). - By default, only invoke `gclient sync` the first time to checkout chromium source tree. Add `--force_update_libchromiumcontent` switch to force updating. - Document new options. The goal is to allow faster edit/compile cycles when debugging/making changes to libchromiumcontent.
This commit is contained in:
parent
b81aab9eae
commit
d6fbf5f1bb
7 changed files with 144 additions and 25 deletions
|
@ -6,13 +6,29 @@ import sys
|
|||
|
||||
from lib.config import enable_verbose_mode, get_target_arch
|
||||
from lib.util import execute_stdout
|
||||
from bootstrap import get_libchromiumcontent_commit
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
LIBCC_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent')
|
||||
GCLIENT_DONE_MARKER = os.path.join(SOURCE_ROOT, '.gclient_done')
|
||||
LIBCC_COMMIT = get_libchromiumcontent_commit()
|
||||
|
||||
|
||||
def update_gclient_done_marker():
|
||||
with open(GCLIENT_DONE_MARKER, 'wb') as f:
|
||||
f.write(LIBCC_COMMIT)
|
||||
|
||||
|
||||
def libchromiumcontent_outdated():
|
||||
if not os.path.exists(GCLIENT_DONE_MARKER):
|
||||
return True
|
||||
with open(GCLIENT_DONE_MARKER, 'rb') as f:
|
||||
return f.read() != LIBCC_COMMIT
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
os.chdir(LIBCC_DIR)
|
||||
|
||||
args = parse_args()
|
||||
if args.verbose:
|
||||
|
@ -22,18 +38,25 @@ def main():
|
|||
# ./script/update -t x64 --defines=''
|
||||
# ./script/build --no_shared_library -t x64
|
||||
# ./script/create-dist -c static_library -t x64 --no_zip
|
||||
script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent',
|
||||
'script')
|
||||
script_dir = os.path.join(LIBCC_DIR, 'script')
|
||||
bootstrap = os.path.join(script_dir, 'bootstrap')
|
||||
update = os.path.join(script_dir, 'update')
|
||||
build = os.path.join(script_dir, 'build')
|
||||
create_dist = os.path.join(script_dir, 'create-dist')
|
||||
execute_stdout([sys.executable, bootstrap])
|
||||
execute_stdout([sys.executable, update, '-t', args.target_arch,
|
||||
'--defines', args.defines])
|
||||
execute_stdout([sys.executable, build, '-R', '-t', args.target_arch])
|
||||
execute_stdout([sys.executable, create_dist, '-c', 'static_library',
|
||||
'--no_zip', '-t', args.target_arch])
|
||||
if args.force_update or libchromiumcontent_outdated():
|
||||
execute_stdout([sys.executable, bootstrap])
|
||||
execute_stdout([sys.executable, update, '-t', args.target_arch,
|
||||
'--defines', args.defines])
|
||||
update_gclient_done_marker()
|
||||
if args.debug:
|
||||
execute_stdout([sys.executable, build, '-D', '-t', args.target_arch])
|
||||
execute_stdout([sys.executable, create_dist, '-c', 'shared_library',
|
||||
'--no_zip', '--keep-debug-symbols',
|
||||
'-t', args.target_arch])
|
||||
else:
|
||||
execute_stdout([sys.executable, build, '-R', '-t', args.target_arch])
|
||||
execute_stdout([sys.executable, create_dist, '-c', 'static_library',
|
||||
'--no_zip', '-t', args.target_arch])
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -44,6 +67,10 @@ def parse_args():
|
|||
help='The definetions passed to gyp')
|
||||
parser.add_argument('-v', '--verbose', action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
parser.add_argument('-d', '--debug', action='store_true',
|
||||
help='Build libchromiumcontent for debugging')
|
||||
parser.add_argument('--force-update', default=False, action='store_true',
|
||||
help='Force gclient to update libchromiumcontent')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue