mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 13:10:42 +01:00
Improvements to automate.py:
- Allow specification of the depot_tools directory via a "depot-tools" flag (issue #592). - Add ninja build support via a "ninja-build" flag (issue #922). - Allow relative paths for download directories (issue #942). - Add the ability to print commands without executing them via a "dry-run" flag. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1194 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
e98c1c41a8
commit
006ac136a8
@ -23,6 +23,7 @@ def run(command_line, working_dir, depot_tools_dir=None):
|
||||
|
||||
sys.stdout.write('-------- Running "'+command_line+'" in "'+\
|
||||
working_dir+'"...'+"\n")
|
||||
if not options.dryrun:
|
||||
args = shlex.split(command_line.replace('\\', '\\\\'))
|
||||
return subprocess.check_call(args, cwd=working_dir, env=env,
|
||||
shell=(sys.platform == 'win32'))
|
||||
@ -91,6 +92,8 @@ parser.add_option('--revision', dest='revision', type="int",
|
||||
help='CEF source revision')
|
||||
parser.add_option('--url', dest='url',
|
||||
help='CEF source URL')
|
||||
parser.add_option('--depot-tools', dest='depottools', metavar='DIR',
|
||||
help='download directory for depot_tools', default='')
|
||||
parser.add_option('--force-config',
|
||||
action='store_true', dest='forceconfig', default=False,
|
||||
help='force Chromium configuration')
|
||||
@ -118,6 +121,12 @@ parser.add_option('--no-release-build',
|
||||
parser.add_option('--no-distrib',
|
||||
action='store_true', dest='nodistrib', default=False,
|
||||
help="don't create the CEF binary distribution")
|
||||
parser.add_option('--ninja-build',
|
||||
action='store_true', dest='ninjabuild', default=False,
|
||||
help="build using ninja")
|
||||
parser.add_option('--dry-run',
|
||||
action='store_true', dest='dryrun', default=False,
|
||||
help="output commands without executing them")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# the downloaddir option is required
|
||||
@ -176,7 +185,7 @@ except Exception, e:
|
||||
compat_url+"\n")
|
||||
raise
|
||||
|
||||
download_dir = options.downloaddir
|
||||
download_dir = os.path.abspath(options.downloaddir)
|
||||
if not os.path.exists(download_dir):
|
||||
# create the download directory
|
||||
os.makedirs(download_dir)
|
||||
@ -197,6 +206,9 @@ else:
|
||||
script_ext = '.sh'
|
||||
|
||||
# check if the "depot_tools" directory exists
|
||||
if options.depottools != '':
|
||||
depot_tools_dir = os.path.abspath(options.depottools)
|
||||
else:
|
||||
depot_tools_dir = os.path.join(download_dir, 'depot_tools')
|
||||
if not os.path.exists(depot_tools_dir):
|
||||
# checkout depot_tools
|
||||
@ -291,6 +303,7 @@ if release_url_changed or chromium_url_changed or options.forceconfig:
|
||||
# run gclient config to create the .gclient file
|
||||
run('gclient config '+url, chromium_dir, depot_tools_dir)
|
||||
|
||||
if not options.dryrun:
|
||||
path = os.path.join(chromium_dir, '.gclient')
|
||||
if not os.path.exists(path):
|
||||
sys.stderr.write(".gclient file was not created\n")
|
||||
@ -327,6 +340,7 @@ if options.forceclean:
|
||||
# revert all Chromium changes and delete all unversioned files
|
||||
run('gclient revert -n', chromium_dir, depot_tools_dir)
|
||||
|
||||
if not options.dryrun:
|
||||
# remove the build output directories
|
||||
output_dirs = []
|
||||
if platform == 'windows':
|
||||
@ -337,6 +351,9 @@ if options.forceclean:
|
||||
elif platform == 'linux':
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
|
||||
|
||||
if options.ninjabuild:
|
||||
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
|
||||
|
||||
for output_dir in output_dirs:
|
||||
if os.path.exists(output_dir):
|
||||
shutil.rmtree(output_dir, onerror=onerror)
|
||||
@ -356,7 +373,7 @@ elif release_url_changed or options.forceupdate:
|
||||
run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir)
|
||||
|
||||
if not os.path.exists(cef_src_dir) or cef_url_changed:
|
||||
if cef_url_changed and os.path.exists(cef_src_dir):
|
||||
if not options.dryrun and cef_url_changed and os.path.exists(cef_src_dir):
|
||||
# delete the cef directory (it will be re-downloaded)
|
||||
shutil.rmtree(cef_src_dir)
|
||||
|
||||
@ -368,10 +385,23 @@ elif cef_rev_changed or options.forceupdate:
|
||||
|
||||
if any_changed or options.forceupdate:
|
||||
# create CEF projects
|
||||
if options.ninjabuild:
|
||||
os.environ['GYP_GENERATORS'] = 'ninja'
|
||||
path = os.path.join(cef_src_dir, 'cef_create_projects'+script_ext)
|
||||
run(path, cef_src_dir, depot_tools_dir)
|
||||
|
||||
if any_changed or options.forcebuild:
|
||||
if options.ninjabuild:
|
||||
command = 'ninja -C '
|
||||
target = ' cefclient'
|
||||
if not options.nodebugbuild:
|
||||
# make CEF Debug build
|
||||
run(command + os.path.join('out', 'Debug') + target, chromium_src_dir, depot_tools_dir)
|
||||
|
||||
if not options.noreleasebuild:
|
||||
# make CEF Release build
|
||||
run(command + os.path.join('out', 'Release') + target, chromium_src_dir, depot_tools_dir)
|
||||
else:
|
||||
path = os.path.join(cef_tools_dir, 'build_projects'+script_ext)
|
||||
|
||||
if not options.nodebugbuild:
|
||||
@ -386,4 +416,6 @@ if any_changed or options.forcedistrib:
|
||||
if not options.nodistrib:
|
||||
# make CEF binary distribution
|
||||
path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext)
|
||||
if options.ninjabuild:
|
||||
path = path + ' --ninja-build'
|
||||
run(path, cef_tools_dir, depot_tools_dir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user