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

Side by Side Diff: scripts/slave/compile.py

Issue 14602020: Add an AOSP builder recipe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A tool to build chrome, executed by buildbot. 6 """A tool to build chrome, executed by buildbot.
7 7
8 When this is run, the current directory (cwd) should be the outer build 8 When this is run, the current directory (cwd) should be the outer build
9 directory (e.g., chrome-release/build/). 9 directory (e.g., chrome-release/build/).
10 10
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 target_command = command + ['BUILDTYPE=' + options.target] 693 target_command = command + ['BUILDTYPE=' + options.target]
694 result = chromium_utils.RunCommand(target_command, env=env) 694 result = chromium_utils.RunCommand(target_command, env=env)
695 if result and not options.clobber: 695 if result and not options.clobber:
696 clobber() 696 clobber()
697 697
698 goma_teardown(options, env) 698 goma_teardown(options, env)
699 699
700 return result 700 return result
701 701
702 def main_make_android(options, args):
703 """Interprets options, clobbers object files, and calls make.
704 """
705
706 env = EchoDict(os.environ)
707 goma_ready = goma_setup(options, env)
708 if not goma_ready:
709 assert options.compiler not in ('goma', 'goma-clang')
710 assert options.goma_dir is None
711
712 options.build_dir = os.path.abspath(options.build_dir)
713
714 if goma_ready:
715 command = [os.path.join(options.goma_dir, 'goma-android-make')]
716 else:
717 command = ['make']
718
719 working_dir = options.src_dir
720
721 os.chdir(working_dir)
722
723 # V=1 prints the actual executed command
724 if options.verbose:
725 command.extend(['V=1'])
726 command.extend(options.build_args + args)
727
728 # Run the build.
729 env.print_overrides()
730 result = 0
731
732 def clobber():
733 print('Removing %s' % options.target_output_dir)
734 chromium_utils.RemoveDirectory(options.target_output_dir)
735
736 if options.clobber:
737 clobber()
738
739 result = chromium_utils.RunCommand(command, env=env)
740 if result and not options.clobber:
741 clobber()
742
743 goma_teardown(options, env)
744
745 return result
702 746
703 def main_ninja(options, args): 747 def main_ninja(options, args):
704 """Interprets options, clobbers object files, and calls ninja.""" 748 """Interprets options, clobbers object files, and calls ninja."""
705 749
706 # Prepare environment. 750 # Prepare environment.
707 env = EchoDict(os.environ) 751 env = EchoDict(os.environ)
708 orig_compiler = options.compiler 752 orig_compiler = options.compiler
709 goma_ready = goma_setup(options, env) 753 goma_ready = goma_setup(options, env)
710 if not goma_ready: 754 if not goma_ready:
711 assert options.compiler not in ('goma', 'goma-clang') 755 assert options.compiler not in ('goma', 'goma-clang')
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1105
1062 1106
1063 def get_target_build_dir(build_tool, src_dir, target, is_iphone=False): 1107 def get_target_build_dir(build_tool, src_dir, target, is_iphone=False):
1064 """Keep this function in sync with src/build/landmines.py""" 1108 """Keep this function in sync with src/build/landmines.py"""
1065 ret = None 1109 ret = None
1066 if build_tool == 'xcode': 1110 if build_tool == 'xcode':
1067 ret = os.path.join(src_dir, 'xcodebuild', 1111 ret = os.path.join(src_dir, 'xcodebuild',
1068 target + ('-iphoneos' if is_iphone else '')) 1112 target + ('-iphoneos' if is_iphone else ''))
1069 elif build_tool == 'make': 1113 elif build_tool == 'make':
1070 ret = os.path.join(src_dir, 'out', target) 1114 ret = os.path.join(src_dir, 'out', target)
1115 elif build_tool == 'make-android':
1116 ret = os.path.join(src_dir, 'out')
1071 elif build_tool == 'ninja': 1117 elif build_tool == 'ninja':
1072 ret = os.path.join(src_dir, 'out', target) 1118 ret = os.path.join(src_dir, 'out', target)
1073 elif build_tool in ['msvs', 'vs', 'ib']: 1119 elif build_tool in ['msvs', 'vs', 'ib']:
1074 ret = os.path.join(src_dir, 'build', target) 1120 ret = os.path.join(src_dir, 'build', target)
1075 elif build_tool == 'scons': 1121 elif build_tool == 'scons':
1076 ret = os.path.join(src_dir, 'sconsbuild', target) 1122 ret = os.path.join(src_dir, 'sconsbuild', target)
1077 else: 1123 else:
1078 raise NotImplementedError() 1124 raise NotImplementedError()
1079 return os.path.abspath(ret) 1125 return os.path.abspath(ret)
1080 1126
(...skipping 15 matching lines...) Expand all
1096 help='build target (Debug or Release)') 1142 help='build target (Debug or Release)')
1097 option_parser.add_option('', '--arch', default=None, 1143 option_parser.add_option('', '--arch', default=None,
1098 help='target architecture (ia32, x64, ...') 1144 help='target architecture (ia32, x64, ...')
1099 option_parser.add_option('', '--solution', default=None, 1145 option_parser.add_option('', '--solution', default=None,
1100 help='name of solution/sub-project to build') 1146 help='name of solution/sub-project to build')
1101 option_parser.add_option('', '--project', default=None, 1147 option_parser.add_option('', '--project', default=None,
1102 help='name of project to build') 1148 help='name of project to build')
1103 option_parser.add_option('', '--build-dir', default='build', 1149 option_parser.add_option('', '--build-dir', default='build',
1104 help='path to directory containing solution and in ' 1150 help='path to directory containing solution and in '
1105 'which the build output will be placed') 1151 'which the build output will be placed')
1152 option_parser.add_option('', '--src-dir', default=None,
1153 help='path to directory containing the root of the '
1154 'source tree')
1155 option_parser.add_option('', '--target-output-dir', default=None,
1156 help='path to directory containing the root of the '
1157 'output folder')
1106 option_parser.add_option('', '--mode', default='dev', 1158 option_parser.add_option('', '--mode', default='dev',
1107 help='build mode (dev or official) controlling ' 1159 help='build mode (dev or official) controlling '
1108 'environment variables set during build') 1160 'environment variables set during build')
1109 option_parser.add_option('', '--build-tool', default=None, 1161 option_parser.add_option('', '--build-tool', default=None,
1110 help='specify build tool (ib, vs, scons, xcode)') 1162 help='specify build tool (ib, vs, scons, xcode)')
1111 option_parser.add_option('', '--build-args', action='append', default=[], 1163 option_parser.add_option('', '--build-args', action='append', default=[],
1112 help='arguments to pass to the build tool') 1164 help='arguments to pass to the build tool')
1113 option_parser.add_option('', '--compiler', default=None, 1165 option_parser.add_option('', '--compiler', default=None,
1114 help='specify alternative compiler (e.g. clang)') 1166 help='specify alternative compiler (e.g. clang)')
1115 if chromium_utils.IsWindows(): 1167 if chromium_utils.IsWindows():
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 main = main_make 1200 main = main_make
1149 options.build_tool = 'make' 1201 options.build_tool = 'make'
1150 else: 1202 else:
1151 print('Please specify --build-tool.') 1203 print('Please specify --build-tool.')
1152 return 1 1204 return 1
1153 else: 1205 else:
1154 build_tool_map = { 1206 build_tool_map = {
1155 'ib' : main_win, 1207 'ib' : main_win,
1156 'vs' : main_win, 1208 'vs' : main_win,
1157 'make' : main_make, 1209 'make' : main_make,
1210 'make-android' : main_make_android,
1158 'ninja' : main_ninja, 1211 'ninja' : main_ninja,
1159 'scons' : main_scons, 1212 'scons' : main_scons,
1160 'xcode' : main_xcode, 1213 'xcode' : main_xcode,
1161 } 1214 }
1162 main = build_tool_map.get(options.build_tool) 1215 main = build_tool_map.get(options.build_tool)
1163 if not main: 1216 if not main:
1164 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool)) 1217 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool))
1165 return 2 1218 return 2
1166 1219
1167 options.build_dir = os.path.abspath(options.build_dir) 1220 options.build_dir = os.path.abspath(options.build_dir)
1168 options.src_dir = os.path.join(slave_utils.SlaveBaseDir( 1221 if not options.src_dir:
1169 os.path.abspath(options.build_dir)), 'build', 'src') 1222 options.src_dir = os.path.join(slave_utils.SlaveBaseDir(
1223 os.path.abspath(options.build_dir)), 'build', 'src')
1170 options.target_output_dir = get_target_build_dir(options.build_tool, 1224 options.target_output_dir = get_target_build_dir(options.build_tool,
1171 options.src_dir, options.target, 'iphoneos' in args) 1225 options.src_dir, options.target, 'iphoneos' in args)
1172 options.clobber = (options.clobber or 1226 options.clobber = (options.clobber or
1173 landmines_triggered(options.target_output_dir)) 1227 landmines_triggered(options.target_output_dir))
1174 1228
1175 return main(options, args) 1229 return main(options, args)
1176 1230
1177 1231
1178 if '__main__' == __name__: 1232 if '__main__' == __name__:
1179 sys.exit(real_main()) 1233 sys.exit(real_main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698