From e54832c051aa34708025f350e81d08bafd3025f7 Mon Sep 17 00:00:00 2001 From: Roger Zanoni Date: Thu, 30 Mar 2023 15:22:32 +0200 Subject: [PATCH 3/9] Add an option to use an alternative base output directory --- tools/gclient_hook.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py index c525984e3..3d4375ec0 100644 --- a/tools/gclient_hook.py +++ b/tools/gclient_hook.py @@ -6,12 +6,23 @@ from __future__ import absolute_import from __future__ import print_function from file_util import make_dir, write_file +from optparse import OptionParser from gclient_util import * from gn_args import GetAllPlatformConfigs, GetConfigFileContents import issue_1999 import os import sys +parser = OptionParser() + +parser.add_option( + '--base-out-path', + dest='baseoutpath', + default='', + help="Use an anternative base path for the generated gn outputs instead of using chromium source dir") + +(options, args) = parser.parse_args() + # The CEF directory is the parent directory of _this_ script. cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) # The src directory is the parent directory of the CEF directory. @@ -136,14 +147,18 @@ if platform == 'windows': configs = GetAllPlatformConfigs(gn_args) for dir, config in configs.items(): # Create out directories and write the args.gn file. - out_path = os.path.join(src_dir, 'out', dir) + base_out_dir = src_dir + if options.baseoutpath != '': + base_out_dir = options.baseoutpath + out_path = os.path.join(base_out_dir, 'out', dir) make_dir(out_path, False) args_gn_path = os.path.join(out_path, 'args.gn') args_gn_contents = GetConfigFileContents(config) write_file(args_gn_path, args_gn_contents) # Generate the Ninja config. - cmd = ['gn', 'gen', os.path.join('out', dir)] + cmd = ['gn', 'gen', os.path.join('out', out_path)] + if 'GN_ARGUMENTS' in os.environ.keys(): cmd.extend(os.environ['GN_ARGUMENTS'].split(' ')) RunAction(src_dir, cmd) -- 2.42.0