diff --git automate-git.py automate-git.py index 1f0be0b..a6abb94 100644 --- automate-git.py +++ automate-git.py @@ -1,3 +1,91 @@ +""" See automate.py. This script is for internal usage only, don't +call it directly. This is a modified copy of automate-git.py from +upstream CEF. + +Some modifications were applied for CEF Python specific use case. +There is a patch file with the same name as this script that contains +differences from the original file. + +-------- + +Usage: automate-git.py [options] + + This utility implements automation for the download, update, build and +distribution of CEF. + +Options: + -h, --help show this help message and exit + --download-dir=DIR Download directory with no spaces [required]. + --depot-tools-dir=DIR + Download directory for depot_tools. + --depot-tools-archive=DEPOTTOOLSARCHIVE + Zip archive file that contains a single top-level + depot_tools directory. + --branch=BRANCH Branch of CEF to build (trunk, 1916, ...). This will + be used to name the CEF download directory and to + identify the correct URL if --url is not specified. + The default value is trunk. + --url=URL CEF download URL. If not specified the default URL + will be used. + --chromium-url=CHROMIUMURL + Chromium download URL. If not specified the default + URL will be used. + --checkout=CHECKOUT Version of CEF to checkout. If not specified the most + recent remote version of the branch will be used. + --chromium-checkout=CHROMIUMCHECKOUT + Version of Chromium to checkout (Git branch/hash/tag). + This overrides the value specified by CEF in + CHROMIUM_BUILD_COMPATIBILITY.txt. + --force-config Force creation of a new gclient config file. + --force-clean Force a clean checkout of Chromium and CEF. This will + trigger a new update, build and distribution. + --force-clean-deps Force a clean checkout of Chromium dependencies. Used + in combination with --force-clean. + --dry-run Output commands without executing them. + --dry-run-platform=DRYRUNPLATFORM + Simulate a dry run on the specified platform (windows, + macosx, linux). Must be used in combination with the + --dry-run flag. + --force-update Force a Chromium and CEF update. This will trigger a + new build and distribution. + --no-update Do not update Chromium or CEF. Pass --force-build or + --force-distrib if you desire a new build or + distribution. + --no-cef-update Do not update CEF. Pass --force-build or --force- + distrib if you desire a new build or distribution. + --no-chromium-update Do not update Chromium. + --no-depot-tools-update + Do not update depot_tools. + --force-build Force CEF debug and release builds. This builds + [build-target] on all platforms and chrome_sandbox on + Linux. + --no-build Do not build CEF. + --build-target=BUILDTARGET + Target name(s) to build (defaults to "cefclient"). + --build-tests Also build the cef_unittests target. + --no-debug-build Don't perform the CEF debug build. + --no-release-build Don't perform the CEF release build. + --verbose-build Show all command lines while building. + --build-log-file Write build logs to file. The file will be named + "build-[branch]-[debug|release].log" in the download + directory. + --x64-build Build for 64-bit systems (Windows and Mac OS X only). + --force-distrib Force creation of a CEF binary distribution. + --no-distrib Don't create a CEF binary distribution. + --minimal-distrib Create a minimal CEF binary distribution. + --minimal-distrib-only + Create a minimal CEF binary distribution only. + --client-distrib Create a client CEF binary distribution. + --client-distrib-only + Create a client CEF binary distribution only. + --no-distrib-docs Don't create CEF documentation. + --no-distrib-archive Don't create archives for output directories. + --clean-artifacts Clean the artifacts output directory. + --distrib-subdir=DISTRIBSUBDIR + CEF distrib dir name, child of + chromium/src/cef/binary_distrib +""" + # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file. @@ -451,9 +539,14 @@ if (options.nochromiumupdate and options.forceupdate) or \ (options.nocefupdate and options.forceupdate) or \ (options.nobuild and options.forcebuild) or \ (options.nodistrib and options.forcedistrib): - print "Invalid combination of options." - parser.print_help(sys.stderr) - sys.exit() + # -- CEF Python modification below + if (options.nocefupdate and options.forceupdate): + pass + else: + print "Invalid combination of options." + parser.print_help(sys.stderr) + sys.exit() + # -- if (options.noreleasebuild and \ (options.minimaldistrib or options.minimaldistribonly or \ @@ -463,13 +556,6 @@ if (options.noreleasebuild and \ parser.print_help(sys.stderr) sys.exit() -if (options.clientdistrib or options.clientdistribonly) and \ - options.buildtarget.find('cefclient') == -1: - print "A client distribution cannot be generated if --build-target "+\ - "excludes cefclient." - parser.print_help(sys.stderr) - sys.exit() - # Operating system. if options.dryrun and options.dryrunplatform is not None: platform = options.dryrunplatform @@ -492,6 +578,17 @@ if platform == 'windows': else: script_ext = '.sh' +if options.clientdistrib or options.clientdistribonly: + if platform == 'linux': + client_app = 'cefsimple' + else: + client_app = 'cefclient' + if options.buildtarget.find(client_app) == -1: + print 'A client distribution cannot be generated if --build-target '+\ + 'excludes %s.' % client_app + parser.print_help(sys.stderr) + sys.exit() + if options.x64build and platform != 'windows' and platform != 'macosx': print 'The x64 build option is only used on Windows and Mac OS X.' sys.exit() @@ -785,7 +882,7 @@ else: # Delete the existing src/cef directory. It will be re-copied from the download # directory later. if cef_checkout_changed and os.path.exists(cef_src_dir): - delete_directory(cef_src_dir) + delete_directory(cef_src_dir) # Delete the existing src/out directory if requested. if options.forceclean and os.path.exists(out_src_dir): @@ -888,6 +985,12 @@ if not options.nobuild and (chromium_checkout_changed or \ command = 'ninja -C ' if options.verbosebuild: command = 'ninja -v -C' + + # -- CEF Python modification below + assert os.environ['CEFPYTHON_NINJA_JOBS'] + command = 'ninja -v -j' + os.environ['CEFPYTHON_NINJA_JOBS'] + ' -C' + # -- + target = ' ' + options.buildtarget if options.buildtests: target = target + ' cef_unittests'