Skip to content

Commit 168867d

Browse files
committed
Update automate.py - fix ninja jobs and add option to force Chromium update.
The --ninja-jobs flag wasn't applied. Sometimes Chromium gclient sync may fail, some files are missing and must re-run. Add new flag --force-chromium-update to do this.
1 parent 8ea37ec commit 168867d

File tree

3 files changed

+89
-26
lines changed

3 files changed

+89
-26
lines changed

tools/automate-git.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,14 @@ def onerror(func, path, exc_info):
539539
(options.nocefupdate and options.forceupdate) or \
540540
(options.nobuild and options.forcebuild) or \
541541
(options.nodistrib and options.forcedistrib):
542-
print "Invalid combination of options."
543-
parser.print_help(sys.stderr)
544-
sys.exit()
542+
# -- CEF Python modification below
543+
if (options.nocefupdate and options.forceupdate):
544+
pass
545+
else:
546+
print "Invalid combination of options."
547+
parser.print_help(sys.stderr)
548+
sys.exit()
549+
# --
545550

546551
if (options.noreleasebuild and \
547552
(options.minimaldistrib or options.minimaldistribonly or \

tools/automate-git.py.patch

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git automate-git.py automate-git.py
2-
index 5c67e17..b7a59d9 100644
2+
index 1f0be0b..a6abb94 100644
33
--- automate-git.py
44
+++ automate-git.py
55
@@ -1,3 +1,91 @@
@@ -94,7 +94,57 @@ index 5c67e17..b7a59d9 100644
9494
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
9595
# reserved. Use of this source code is governed by a BSD-style license that
9696
# can be found in the LICENSE file.
97-
@@ -789,7 +877,7 @@ else:
97+
@@ -451,9 +539,14 @@ if (options.nochromiumupdate and options.forceupdate) or \
98+
(options.nocefupdate and options.forceupdate) or \
99+
(options.nobuild and options.forcebuild) or \
100+
(options.nodistrib and options.forcedistrib):
101+
- print "Invalid combination of options."
102+
- parser.print_help(sys.stderr)
103+
- sys.exit()
104+
+ # -- CEF Python modification below
105+
+ if (options.nocefupdate and options.forceupdate):
106+
+ pass
107+
+ else:
108+
+ print "Invalid combination of options."
109+
+ parser.print_help(sys.stderr)
110+
+ sys.exit()
111+
+ # --
112+
113+
if (options.noreleasebuild and \
114+
(options.minimaldistrib or options.minimaldistribonly or \
115+
@@ -463,13 +556,6 @@ if (options.noreleasebuild and \
116+
parser.print_help(sys.stderr)
117+
sys.exit()
118+
119+
-if (options.clientdistrib or options.clientdistribonly) and \
120+
- options.buildtarget.find('cefclient') == -1:
121+
- print "A client distribution cannot be generated if --build-target "+\
122+
- "excludes cefclient."
123+
- parser.print_help(sys.stderr)
124+
- sys.exit()
125+
-
126+
# Operating system.
127+
if options.dryrun and options.dryrunplatform is not None:
128+
platform = options.dryrunplatform
129+
@@ -492,6 +578,17 @@ if platform == 'windows':
130+
else:
131+
script_ext = '.sh'
132+
133+
+if options.clientdistrib or options.clientdistribonly:
134+
+ if platform == 'linux':
135+
+ client_app = 'cefsimple'
136+
+ else:
137+
+ client_app = 'cefclient'
138+
+ if options.buildtarget.find(client_app) == -1:
139+
+ print 'A client distribution cannot be generated if --build-target '+\
140+
+ 'excludes %s.' % client_app
141+
+ parser.print_help(sys.stderr)
142+
+ sys.exit()
143+
+
144+
if options.x64build and platform != 'windows' and platform != 'macosx':
145+
print 'The x64 build option is only used on Windows and Mac OS X.'
146+
sys.exit()
147+
@@ -785,7 +882,7 @@ else:
98148
# Delete the existing src/cef directory. It will be re-copied from the download
99149
# directory later.
100150
if cef_checkout_changed and os.path.exists(cef_src_dir):
@@ -103,7 +153,7 @@ index 5c67e17..b7a59d9 100644
103153

104154
# Delete the existing src/out directory if requested.
105155
if options.forceclean and os.path.exists(out_src_dir):
106-
@@ -892,6 +980,12 @@ if not options.nobuild and (chromium_checkout_changed or \
156+
@@ -888,6 +985,12 @@ if not options.nobuild and (chromium_checkout_changed or \
107157
command = 'ninja -C '
108158
if options.verbosebuild:
109159
command = 'ninja -v -C'

tools/automate.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
77
Usage:
88
automate.py (--prebuilt-cef | --build-cef)
9+
[--force-chromium-update FORCECHROMIUMUPDATE]
910
[--cef-branch BRANCH] [--cef-commit COMMIT]
1011
[--build-dir BUILDDIR] [--cef-build-dir CEFBUILDDIR]
1112
[--ninja-jobs JOBS] [--gyp-generators GENERATORS]
1213
[--gyp-msvs-version MSVS]
1314
automate.py (-h | --help) [type -h to show full description for options]
1415
1516
Options:
16-
-h --help Show this help message.
17-
--prebuilt-cef Whether to use prebuilt CEF binaries. Prebuilt
18-
binaries for Linux are built on Ubuntu.
19-
--build-cef Whether to build CEF from sources with the cefpython
20-
patches applied.
21-
--cef-branch=<b> CEF branch. Defaults to CHROME_VERSION_BUILD from
22-
"src/version/cef_version_{platform}.h" (TODO).
23-
--cef-commit=<c> CEF revision. Defaults to CEF_COMMIT_HASH from
24-
"src/version/cef_version_{platform}.h" (TODO).
25-
--build-dir=<dir1> Build directory.
26-
--cef-build-dir=<dir2> CEF build directory. By default same
27-
as --build-dir.
28-
--ninja-jobs=<jobs> How many CEF jobs to run in parallel. To speed up
29-
building set it to number of cores in your CPU.
30-
By default set to cpu_count / 2.
31-
--gyp-generators=<gen> Set GYP_GENERATORS [default: ninja].
32-
--gyp-msvs-version=<v> Set GYP_MSVS_VERSION.
17+
-h --help Show this help message.
18+
--prebuilt-cef Whether to use prebuilt CEF binaries. Prebuilt
19+
binaries for Linux are built on Ubuntu.
20+
--build-cef Whether to build CEF from sources with the
21+
cefpython patches applied.
22+
--force-chromium-update Force Chromium update (gclient sync etc).
23+
--cef-branch=<b> CEF branch. Defaults to CHROME_VERSION_BUILD from
24+
"src/version/cef_version_{platform}.h" (TODO).
25+
--cef-commit=<c> CEF revision. Defaults to CEF_COMMIT_HASH from
26+
"src/version/cef_version_{platform}.h" (TODO).
27+
--build-dir=<dir1> Build directory.
28+
--cef-build-dir=<dir2> CEF build directory. By default same
29+
as --build-dir.
30+
--ninja-jobs=<jobs> How many CEF jobs to run in parallel. To speed up
31+
building set it to number of cores in your CPU.
32+
By default set to cpu_count / 2.
33+
--gyp-generators=<gen> Set GYP_GENERATORS [default: ninja].
34+
--gyp-msvs-version=<v> Set GYP_MSVS_VERSION.
3335
3436
"""
3537

@@ -87,6 +89,7 @@ class Options(object):
8789
# From command-line
8890
prebuilt_cef = False
8991
build_cef = False
92+
force_chromium_update = False
9093
cef_branch = ""
9194
cef_commit = ""
9295
build_dir = ""
@@ -179,9 +182,10 @@ def setup_options(docopt_args):
179182
# cpu_count() returns number of CPU threads, not CPU cores.
180183
# On i5 with 2 cores and 4 cpu threads the default of 4 ninja
181184
# jobs slows down computer significantly.
182-
Options.ninja_jobs = int(multiprocessing.cpu_count() / 2)
183-
if Options.ninja_jobs < 1:
184-
Options.ninja_jobs = 1
185+
if not Options.ninja_jobs:
186+
Options.ninja_jobs = int(multiprocessing.cpu_count() / 2)
187+
if Options.ninja_jobs < 1:
188+
Options.ninja_jobs = 1
185189

186190

187191
def build_cef():
@@ -515,6 +519,10 @@ def run_automate_git():
515519
# We clone cef repository ourselves and update cef patches with ours,
516520
# so don't fetch/update CEF repo.
517521
args.append("--no-cef-update")
522+
# Force Chromium update so that gclient sync is called. It may fail
523+
# sometimes with files missing and must re-run to fix.
524+
if Options.force_chromium_update:
525+
args.append("--force-update")
518526
args.append("--no-distrib-archive")
519527
if platform.system() == "Linux":
520528
# Building cefclient target isn't supported on Linux when

0 commit comments

Comments
 (0)