Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: tools/gn/bootstrap/bootstrap.py

Issue 1149413005: Add GN bootstrap step to continuous integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/scripts/gn_bootstrap.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/bootstrap/bootstrap.py
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 373883f8e348e1dd536d4b7f410776d6f25fa02b..2dc2a03e769238d889502ca1c2d5fb487a1f5407 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -11,6 +11,7 @@ it with its own BUILD.gn to the final destination.
import contextlib
import errno
+import json
import logging
import optparse
import os
@@ -56,8 +57,14 @@ def main(argv):
help='place output in PATH', metavar='PATH')
parser.add_option('-s', '--no-rebuild', action='store_true',
help='Do not rebuild GN with GN.')
+ parser.add_option('--temp-build-dir', action='store_true',
+ help='Build GN in temporary directory')
+ parser.add_option('--use-bundled-clang', action='store_true',
+ help='Use bundled clang compiler (e.g. when host toolchain '
+ 'is too old to support C++11)')
parser.add_option('-v', '--verbose', action='store_true',
help='Log more details')
+ parser.add_option('--json')
options, args = parser.parse_args(argv)
if args:
@@ -69,29 +76,38 @@ def main(argv):
build_rel = os.path.join('out', 'Debug')
else:
build_rel = os.path.join('out', 'Release')
- build_root = os.path.join(SRC_ROOT, build_rel)
+
+ failures = []
try:
with scoped_tempdir() as tempdir:
print 'Building gn manually in a temporary directory for bootstrapping...'
build_gn_with_ninja_manually(tempdir, options)
temp_gn = os.path.join(tempdir, 'gn')
+ if options.temp_build_dir:
+ build_root = os.path.join(tempdir, 'build_root')
+ else:
+ build_root = os.path.join(SRC_ROOT, build_rel)
out_gn = os.path.join(build_root, 'gn')
if options.no_rebuild:
mkdir_p(build_root)
shutil.copy2(temp_gn, out_gn)
else:
- print 'Building gn using itself to %s...' % build_rel
- build_gn_with_gn(temp_gn, build_rel, options)
+ print 'Building gn using itself to %s...' % build_root
+ build_gn_with_gn(temp_gn, build_root, options)
if options.output:
# Preserve the executable permission bit.
shutil.copy2(out_gn, options.output)
except subprocess.CalledProcessError as e:
print >> sys.stderr, str(e)
- return 1
- return 0
+ failures.append(str(e))
+
+ if options.json:
+ with open(options.json, 'w') as f:
+ json.dump(failures, f)
+ return 1 if failures else 0
def build_gn_with_ninja_manually(tempdir, options):
@@ -103,8 +119,15 @@ def build_gn_with_ninja_manually(tempdir, options):
check_call(cmd)
def write_ninja(path, options):
- cc = os.environ.get('CC', '')
- cxx = os.environ.get('CXX', '')
+ default_cc = ''
+ default_cxx = ''
+ if options.use_bundled_clang:
+ clang_dir = os.path.join(
+ SRC_ROOT, 'third_party', 'llvm-build', 'Release+Asserts', 'bin')
+ default_cc = os.path.join(clang_dir, 'clang')
+ default_cxx = os.path.join(clang_dir, 'clang++')
+ cc = os.environ.get('CC', default_cc)
+ cxx = os.environ.get('CXX', default_cxx)
cflags = os.environ.get('CFLAGS', '').split()
cflags_cc = os.environ.get('CXXFLAGS', '').split()
ld = os.environ.get('LD', cxx)
@@ -227,10 +250,13 @@ def write_ninja(path, options):
'base/time/time.cc',
'base/timer/elapsed_timer.cc',
'base/timer/timer.cc',
+ 'base/trace_event/category_filter.cc',
+ 'base/trace_event/trace_config.cc',
'base/trace_event/trace_event_impl.cc',
'base/trace_event/trace_event_impl_constants.cc',
'base/trace_event/trace_event_memory.cc',
'base/trace_event/trace_event_synthetic_delay.cc',
+ 'base/trace_event/trace_options.cc',
'base/tracked_objects.cc',
'base/tracking_info.cc',
'base/values.cc',
« no previous file with comments | « testing/scripts/gn_bootstrap.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698