Gilad Arnold | 6eccc53 | 2012-05-17 15:44:22 -0700 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 5 | import os |
| 6 | |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 7 | # Protobuffer compilation |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 8 | def ProtocolBufferEmitter(target, source, env): |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 9 | """ Inputs: |
| 10 | target: list of targets to compile to |
| 11 | source: list of sources to compile |
| 12 | env: the scons environment in which we are compiling |
| 13 | Outputs: |
| 14 | target: the list of targets we'll emit |
| 15 | source: the list of sources we'll compile""" |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 16 | output = str(source[0]) |
| 17 | output = output[0:output.rfind('.proto')] |
| 18 | target = [ |
| 19 | output + '.pb.cc', |
| 20 | output + '.pb.h', |
| 21 | ] |
| 22 | return target, source |
| 23 | |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 24 | def ProtocolBufferGenerator(source, target, env, for_signature): |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 25 | """ Inputs: |
| 26 | source: list of sources to process |
| 27 | target: list of targets to generate |
| 28 | env: scons environment in which we are working |
| 29 | for_signature: unused |
| 30 | Outputs: a list of commands to execute to generate the targets from |
| 31 | the sources.""" |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 32 | commands = [ |
| 33 | '/usr/bin/protoc ' |
| 34 | ' --proto_path . ${SOURCES} --cpp_out .'] |
| 35 | return commands |
| 36 | |
| 37 | proto_builder = Builder(generator = ProtocolBufferGenerator, |
| 38 | emitter = ProtocolBufferEmitter, |
| 39 | single_source = 1, |
| 40 | suffix = '.pb.cc') |
| 41 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 42 | def DbusBindingsEmitter(target, source, env): |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 43 | """ Inputs: |
| 44 | target: unused |
| 45 | source: list containing the source .xml file |
| 46 | env: the scons environment in which we are compiling |
| 47 | Outputs: |
| 48 | target: the list of targets we'll emit |
| 49 | source: the list of sources we'll process""" |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 50 | output = str(source[0]) |
| 51 | output = output[0:output.rfind('.xml')] |
| 52 | target = [ |
| 53 | output + '.dbusserver.h', |
| 54 | output + '.dbusclient.h' |
| 55 | ] |
| 56 | return target, source |
| 57 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 58 | def DbusBindingsGenerator(source, target, env, for_signature): |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 59 | """ Inputs: |
| 60 | source: list of sources to process |
| 61 | target: list of targets to generate |
| 62 | env: scons environment in which we are working |
| 63 | for_signature: unused |
| 64 | Outputs: a list of commands to execute to generate the targets from |
| 65 | the sources.""" |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 66 | commands = [] |
| 67 | for target_file in target: |
| 68 | if str(target_file).endswith('.dbusserver.h'): |
| 69 | mode_flag = '--mode=glib-server ' |
| 70 | else: |
| 71 | mode_flag = '--mode=glib-client ' |
| 72 | cmd = '/usr/bin/dbus-binding-tool %s --prefix=update_engine_service ' \ |
| 73 | '%s > %s' % (mode_flag, str(source[0]), str(target_file)) |
| 74 | commands.append(cmd) |
| 75 | return commands |
| 76 | |
| 77 | dbus_bindings_builder = Builder(generator = DbusBindingsGenerator, |
| 78 | emitter = DbusBindingsEmitter, |
| 79 | single_source = 1, |
| 80 | suffix = 'dbusclient.h') |
| 81 | |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 82 | def GlibMarshalEmitter(target, source, env): |
| 83 | """ Inputs: |
| 84 | target: unused |
| 85 | source: list containing the source .list file |
| 86 | env: the scons environment in which we are compiling |
| 87 | Outputs: |
| 88 | target: the list of targets we'll emit |
| 89 | source: the list of sources we'll process""" |
| 90 | output = str(source[0]) |
| 91 | output = output[0:output.rfind('.list')] |
| 92 | target = [ |
| 93 | output + '.glibmarshal.c', |
| 94 | output + '.glibmarshal.h' |
| 95 | ] |
| 96 | return target, source |
| 97 | |
| 98 | def GlibMarshalGenerator(source, target, env, for_signature): |
| 99 | """ Inputs: |
| 100 | source: list of sources to process |
| 101 | target: list of targets to generate |
| 102 | env: scons environment in which we are working |
| 103 | for_signature: unused |
| 104 | Outputs: a list of commands to execute to generate the targets from |
| 105 | the sources.""" |
| 106 | commands = [] |
| 107 | for target_file in target: |
| 108 | if str(target_file).endswith('.glibmarshal.h'): |
| 109 | mode_flag = '--header ' |
| 110 | else: |
| 111 | mode_flag = '--body ' |
| 112 | cmd = '/usr/bin/glib-genmarshal %s --prefix=update_engine ' \ |
| 113 | '%s > %s' % (mode_flag, str(source[0]), str(target_file)) |
| 114 | commands.append(cmd) |
| 115 | return commands |
| 116 | |
| 117 | glib_marshal_builder = Builder(generator = GlibMarshalGenerator, |
| 118 | emitter = GlibMarshalEmitter, |
| 119 | single_source = 1, |
| 120 | suffix = 'glibmarshal.c') |
| 121 | |
Darin Petkov | d7061ab | 2010-10-06 14:37:09 -0700 | [diff] [blame] | 122 | # Public key generation |
| 123 | def PublicKeyEmitter(target, source, env): |
| 124 | """ Inputs: |
| 125 | target: list of targets to compile to |
| 126 | source: list of sources to compile |
| 127 | env: the scons environment in which we are compiling |
| 128 | Outputs: |
| 129 | target: the list of targets we'll emit |
| 130 | source: the list of sources we'll compile""" |
| 131 | targets = [] |
| 132 | for source_file in source: |
| 133 | output = str(source_file) |
| 134 | output = output[0:output.rfind('.pem')] |
| 135 | output += '.pub.pem' |
| 136 | targets.append(output) |
| 137 | return targets, source |
| 138 | |
| 139 | def PublicKeyGenerator(source, target, env, for_signature): |
| 140 | """ Inputs: |
| 141 | source: list of sources to process |
| 142 | target: list of targets to generate |
| 143 | env: scons environment in which we are working |
| 144 | for_signature: unused |
| 145 | Outputs: a list of commands to execute to generate the targets from |
| 146 | the sources.""" |
| 147 | commands = [] |
| 148 | for source_file in source: |
| 149 | output = str(source_file) |
| 150 | output = output[0:output.rfind('.pem')] |
| 151 | output += '.pub.pem' |
| 152 | cmd = '/usr/bin/openssl rsa -in %s -pubout -out %s' % (source_file, output) |
| 153 | commands.append(cmd) |
| 154 | return commands |
| 155 | |
| 156 | public_key_builder = Builder(generator = PublicKeyGenerator, |
| 157 | emitter = PublicKeyEmitter, |
| 158 | suffix = '.pub.pem') |
| 159 | |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 160 | env = Environment() |
Andrew de los Reyes | 08c4e27 | 2010-04-15 14:02:17 -0700 | [diff] [blame] | 161 | for key in Split('CC CXX AR RANLIB LD NM'): |
| 162 | value = os.environ.get(key) |
| 163 | if value != None: |
| 164 | env[key] = value |
| 165 | for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'): |
| 166 | value = os.environ.get(key) |
| 167 | if value != None: |
| 168 | env[key] = Split(value) |
| 169 | |
| 170 | for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): |
| 171 | if os.environ.has_key(key): |
| 172 | env['ENV'][key] = os.environ[key] |
| 173 | |
| 174 | |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 175 | env['CCFLAGS'] = ' '.join("""-g |
| 176 | -fno-exceptions |
Andrew de los Reyes | 08c4e27 | 2010-04-15 14:02:17 -0700 | [diff] [blame] | 177 | -fno-strict-aliasing |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 178 | -Wall |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 179 | -Wclobbered |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 180 | -Wclobbered |
| 181 | -Wempty-body |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 182 | -Wempty-body |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 183 | -Werror |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 184 | -Wignored-qualifiers |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 185 | -Wignored-qualifiers |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 186 | -Wmissing-field-initializers |
Han Shen | 2643cb7 | 2012-06-26 14:45:33 -0700 | [diff] [blame] | 187 | -Wno-format |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 188 | -Wsign-compare |
| 189 | -Wtype-limits |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 190 | -Wtype-limits |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 191 | -Wuninitialized |
Andrew de los Reyes | 08c4e27 | 2010-04-15 14:02:17 -0700 | [diff] [blame] | 192 | -D__STDC_FORMAT_MACROS=1 |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 193 | -D_FILE_OFFSET_BITS=64 |
| 194 | -I/usr/include/libxml2""".split()); |
Andrew de los Reyes | 08c4e27 | 2010-04-15 14:02:17 -0700 | [diff] [blame] | 195 | env['CCFLAGS'] += (' ' + ' '.join(env['CFLAGS'])) |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 196 | |
Don Garrett | d186e63 | 2012-06-13 13:40:21 -0700 | [diff] [blame] | 197 | BASE_VER = os.environ.get('BASE_VER', '125070') |
Mike Frysinger | dd465db | 2012-03-09 11:59:31 -0500 | [diff] [blame] | 198 | env['LIBS'] = Split("""bz2 |
Raymes Khoury | e3d8d4c | 2010-09-17 10:35:54 -0700 | [diff] [blame] | 199 | crypto |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 200 | curl |
Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 201 | ext2fs |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 202 | gflags |
| 203 | glib-2.0 |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 204 | gthread-2.0 |
| 205 | libpcrecpp |
Darin Petkov | 9d65b7b | 2010-07-20 09:13:01 -0700 | [diff] [blame] | 206 | metrics |
Mike Frysinger | dd465db | 2012-03-09 11:59:31 -0500 | [diff] [blame] | 207 | policy-%s |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 208 | protobuf |
| 209 | pthread |
Will Drewry | 8f71da8 | 2010-08-30 14:07:11 -0500 | [diff] [blame] | 210 | rootdev |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 211 | ssl |
Gilad Arnold | 28e2f39 | 2012-02-09 14:36:46 -0800 | [diff] [blame] | 212 | udev |
Mike Frysinger | dd465db | 2012-03-09 11:59:31 -0500 | [diff] [blame] | 213 | xml2""" % BASE_VER) |
Andrew de los Reyes | b70e33d | 2010-08-12 21:49:02 -0700 | [diff] [blame] | 214 | env['CPPPATH'] = ['..'] |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 215 | env['BUILDERS']['ProtocolBuffer'] = proto_builder |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 216 | env['BUILDERS']['DbusBindings'] = dbus_bindings_builder |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 217 | env['BUILDERS']['GlibMarshal'] = glib_marshal_builder |
Darin Petkov | d7061ab | 2010-10-06 14:37:09 -0700 | [diff] [blame] | 218 | env['BUILDERS']['PublicKey'] = public_key_builder |
Colin Watson | f2c29ec | 2010-01-08 18:50:56 +0000 | [diff] [blame] | 219 | |
| 220 | # Fix issue with scons not passing pkg-config vars through the environment. |
| 221 | for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'): |
| 222 | if os.environ.has_key(key): |
| 223 | env['ENV'][key] = os.environ[key] |
| 224 | |
Diego Elio Pettenò | 8707b5b | 2011-05-15 18:22:29 +0200 | [diff] [blame] | 225 | pkgconfig = os.environ.get('PKG_CONFIG', 'pkg-config') |
| 226 | |
| 227 | env.ParseConfig(pkgconfig + ' --cflags --libs ' |
Mike Frysinger | dd465db | 2012-03-09 11:59:31 -0500 | [diff] [blame] | 228 | 'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0 libchrome-%s ' |
| 229 | 'libchromeos-%s' % (BASE_VER, BASE_VER)) |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 230 | env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') |
Darin Petkov | d7061ab | 2010-10-06 14:37:09 -0700 | [diff] [blame] | 231 | env.PublicKey('unittest_key.pub.pem', 'unittest_key.pem') |
Andrew de los Reyes | c24e3f3 | 2011-08-30 15:45:20 -0700 | [diff] [blame] | 232 | env.PublicKey('unittest_key2.pub.pem', 'unittest_key2.pem') |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 233 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 234 | env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml') |
| 235 | |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 236 | env.GlibMarshal('marshal.glibmarshal.c', 'marshal.list') |
| 237 | |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 238 | if ARGUMENTS.get('debug', 0): |
Andrew de los Reyes | 819fef2 | 2010-12-17 11:33:58 -0800 | [diff] [blame] | 239 | env['CCFLAGS'] += ['-fprofile-arcs', '-ftest-coverage'] |
Andrew de los Reyes | 8006106 | 2010-02-04 14:25:00 -0800 | [diff] [blame] | 240 | env['LIBS'] += ['bz2', 'gcov'] |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 241 | |
| 242 | sources = Split("""action_processor.cc |
Andrew de los Reyes | d2135f3 | 2010-03-11 16:00:28 -0800 | [diff] [blame] | 243 | bzip.cc |
Andrew de los Reyes | 8006106 | 2010-02-04 14:25:00 -0800 | [diff] [blame] | 244 | bzip_extent_writer.cc |
Bruno Rocha | 7f9aea2 | 2011-09-12 14:31:24 -0700 | [diff] [blame] | 245 | certificate_checker.cc |
Andrew de los Reyes | 000d895 | 2011-03-02 15:21:14 -0800 | [diff] [blame] | 246 | chrome_browser_proxy_resolver.cc |
Andrew de los Reyes | 9cd120d | 2010-11-18 17:50:03 -0800 | [diff] [blame] | 247 | chrome_proxy_resolver.cc |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 248 | connection_manager.cc |
Andrew de los Reyes | 35a7af1 | 2010-03-10 16:33:26 -0800 | [diff] [blame] | 249 | cycle_breaker.cc |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 250 | dbus_service.cc |
Andrew de los Reyes | 09e56d6 | 2010-04-23 13:45:53 -0700 | [diff] [blame] | 251 | delta_diff_generator.cc |
| 252 | delta_performer.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 253 | download_action.cc |
Andrew de los Reyes | b4025e6 | 2010-02-23 17:47:03 -0800 | [diff] [blame] | 254 | extent_mapper.cc |
Andrew de los Reyes | 5fdae4a | 2010-10-05 10:47:42 -0700 | [diff] [blame] | 255 | extent_ranges.cc |
Andrew de los Reyes | 8006106 | 2010-02-04 14:25:00 -0800 | [diff] [blame] | 256 | extent_writer.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 257 | filesystem_copier_action.cc |
| 258 | filesystem_iterator.cc |
Gilad Arnold | 11c066f | 2012-05-10 14:37:25 -0700 | [diff] [blame] | 259 | file_descriptor.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 260 | file_writer.cc |
Darin Petkov | 7a22d79 | 2010-11-08 14:10:00 -0800 | [diff] [blame] | 261 | full_update_generator.cc |
Gilad Arnold | 1ebd813 | 2012-03-05 10:19:29 -0800 | [diff] [blame] | 262 | gpio_handler.cc |
Andrew de los Reyes | 0ce161b | 2010-02-22 15:27:01 -0800 | [diff] [blame] | 263 | graph_utils.cc |
Gilad Arnold | 9bedeb5 | 2011-11-17 16:19:57 -0800 | [diff] [blame] | 264 | http_common.cc |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame] | 265 | http_fetcher.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 266 | libcurl_http_fetcher.cc |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 267 | marshal.glibmarshal.c |
Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 268 | metadata.cc |
Andrew de los Reyes | 819fef2 | 2010-12-17 11:33:58 -0800 | [diff] [blame] | 269 | multi_range_http_fetcher.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 270 | omaha_hash_calculator.cc |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 271 | omaha_request_action.cc |
Darin Petkov | a4a8a8c | 2010-07-15 22:21:12 -0700 | [diff] [blame] | 272 | omaha_request_params.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 273 | omaha_response_handler_action.cc |
Andrew de los Reyes | 0c44005 | 2010-08-20 11:25:54 -0700 | [diff] [blame] | 274 | payload_signer.cc |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 275 | payload_state.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 276 | postinstall_runner_action.cc |
Darin Petkov | 3003059 | 2010-07-27 13:53:20 -0700 | [diff] [blame] | 277 | prefs.cc |
Andrew de los Reyes | 9cd120d | 2010-11-18 17:50:03 -0800 | [diff] [blame] | 278 | proxy_resolver.cc |
Andrew de los Reyes | 785bc35 | 2010-05-26 12:34:53 -0700 | [diff] [blame] | 279 | simple_key_value_store.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 280 | subprocess.cc |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 281 | system_state.cc |
Andrew de los Reyes | 81ebcd8 | 2010-03-09 15:56:18 -0800 | [diff] [blame] | 282 | tarjan.cc |
Darin Petkov | 9c0baf8 | 2010-10-07 13:44:48 -0700 | [diff] [blame] | 283 | terminator.cc |
Andrew de los Reyes | 5815155 | 2010-03-10 20:07:08 -0800 | [diff] [blame] | 284 | topological_sort.cc |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 285 | update_attempter.cc |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 286 | update_check_scheduler.cc |
Andrew de los Reyes | 82d8679 | 2010-06-30 17:00:44 -0700 | [diff] [blame] | 287 | update_metadata.pb.cc |
| 288 | utils.cc""") |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 289 | main = ['main.cc'] |
| 290 | |
| 291 | unittest_sources = Split("""action_unittest.cc |
| 292 | action_pipe_unittest.cc |
| 293 | action_processor_unittest.cc |
Andrew de los Reyes | 8006106 | 2010-02-04 14:25:00 -0800 | [diff] [blame] | 294 | bzip_extent_writer_unittest.cc |
Bruno Rocha | 7f9aea2 | 2011-09-12 14:31:24 -0700 | [diff] [blame] | 295 | certificate_checker_unittest.cc |
Andrew de los Reyes | 000d895 | 2011-03-02 15:21:14 -0800 | [diff] [blame] | 296 | chrome_browser_proxy_resolver_unittest.cc |
Andrew de los Reyes | 9cd120d | 2010-11-18 17:50:03 -0800 | [diff] [blame] | 297 | chrome_proxy_resolver_unittest.cc |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 298 | connection_manager_unittest.cc |
Andrew de los Reyes | 35a7af1 | 2010-03-10 16:33:26 -0800 | [diff] [blame] | 299 | cycle_breaker_unittest.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 300 | delta_diff_generator_unittest.cc |
Andrew de los Reyes | 09e56d6 | 2010-04-23 13:45:53 -0700 | [diff] [blame] | 301 | delta_performer_unittest.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 302 | download_action_unittest.cc |
Andrew de los Reyes | b4025e6 | 2010-02-23 17:47:03 -0800 | [diff] [blame] | 303 | extent_mapper_unittest.cc |
Andrew de los Reyes | 5fdae4a | 2010-10-05 10:47:42 -0700 | [diff] [blame] | 304 | extent_ranges_unittest.cc |
Andrew de los Reyes | 8006106 | 2010-02-04 14:25:00 -0800 | [diff] [blame] | 305 | extent_writer_unittest.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 306 | file_writer_unittest.cc |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 307 | filesystem_copier_action_unittest.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 308 | filesystem_iterator_unittest.cc |
Darin Petkov | 7a22d79 | 2010-11-08 14:10:00 -0800 | [diff] [blame] | 309 | full_update_generator_unittest.cc |
Gilad Arnold | 4d740eb | 2012-05-15 08:48:13 -0700 | [diff] [blame] | 310 | gpio_handler_unittest.cc |
Gilad Arnold | 6eccc53 | 2012-05-17 15:44:22 -0700 | [diff] [blame] | 311 | gpio_mock_file_descriptor.cc |
Gilad Arnold | 4d740eb | 2012-05-15 08:48:13 -0700 | [diff] [blame] | 312 | gpio_mock_udev_interface.cc |
Andrew de los Reyes | 0ce161b | 2010-02-22 15:27:01 -0800 | [diff] [blame] | 313 | graph_utils_unittest.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 314 | http_fetcher_unittest.cc |
Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 315 | metadata_unittest.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 316 | mock_http_fetcher.cc |
Jay Srinivasan | 55f50c2 | 2013-01-10 19:24:35 -0800 | [diff] [blame] | 317 | mock_system_state.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 318 | omaha_hash_calculator_unittest.cc |
Darin Petkov | 6a5b322 | 2010-07-13 14:55:28 -0700 | [diff] [blame] | 319 | omaha_request_action_unittest.cc |
Darin Petkov | a4a8a8c | 2010-07-15 22:21:12 -0700 | [diff] [blame] | 320 | omaha_request_params_unittest.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 321 | omaha_response_handler_action_unittest.cc |
Andrew de los Reyes | 0c44005 | 2010-08-20 11:25:54 -0700 | [diff] [blame] | 322 | payload_signer_unittest.cc |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 323 | payload_state_unittest.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 324 | postinstall_runner_action_unittest.cc |
Darin Petkov | 3003059 | 2010-07-27 13:53:20 -0700 | [diff] [blame] | 325 | prefs_unittest.cc |
Andrew de los Reyes | 785bc35 | 2010-05-26 12:34:53 -0700 | [diff] [blame] | 326 | simple_key_value_store_unittest.cc |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 327 | subprocess_unittest.cc |
Andrew de los Reyes | 81ebcd8 | 2010-03-09 15:56:18 -0800 | [diff] [blame] | 328 | tarjan_unittest.cc |
Darin Petkov | 80f1956 | 2010-11-19 12:00:15 -0800 | [diff] [blame] | 329 | terminator_unittest.cc |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 330 | test_utils.cc |
Andrew de los Reyes | 5815155 | 2010-03-10 20:07:08 -0800 | [diff] [blame] | 331 | topological_sort_unittest.cc |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 332 | update_attempter_unittest.cc |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 333 | update_check_scheduler_unittest.cc |
Andrew de los Reyes | d2135f3 | 2010-03-11 16:00:28 -0800 | [diff] [blame] | 334 | utils_unittest.cc |
| 335 | zip_unittest.cc""") |
rspangler@google.com | 49fdf18 | 2009-10-10 00:57:34 +0000 | [diff] [blame] | 336 | unittest_main = ['testrunner.cc'] |
| 337 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 338 | client_main = ['update_engine_client.cc'] |
| 339 | |
Andrew de los Reyes | 4fe15d0 | 2009-12-10 19:01:36 -0800 | [diff] [blame] | 340 | delta_generator_main = ['generate_delta_main.cc'] |
| 341 | |
Andrew de los Reyes | 82d8679 | 2010-06-30 17:00:44 -0700 | [diff] [blame] | 342 | # Hack to generate header files first. They are generated as a side effect |
| 343 | # of generating other files (usually their corresponding .c(c) files), |
| 344 | # so we make all sources depend on those other files. |
| 345 | all_sources = [] |
| 346 | all_sources.extend(sources) |
| 347 | all_sources.extend(unittest_sources) |
| 348 | all_sources.extend(main) |
| 349 | all_sources.extend(unittest_main) |
| 350 | all_sources.extend(client_main) |
| 351 | all_sources.extend(delta_generator_main) |
| 352 | for source in all_sources: |
Darin Petkov | d7061ab | 2010-10-06 14:37:09 -0700 | [diff] [blame] | 353 | if source.endswith('_unittest.cc'): |
| 354 | env.Depends(source, 'unittest_key.pub.pem') |
Andrew de los Reyes | 82d8679 | 2010-06-30 17:00:44 -0700 | [diff] [blame] | 355 | if source.endswith('.glibmarshal.c') or source.endswith('.pb.cc'): |
| 356 | continue |
| 357 | env.Depends(source, 'update_metadata.pb.cc') |
| 358 | env.Depends(source, 'marshal.glibmarshal.c') |
| 359 | env.Depends(source, 'update_engine.dbusclient.h') |
Andrew de los Reyes | 4fe15d0 | 2009-12-10 19:01:36 -0800 | [diff] [blame] | 360 | |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 361 | update_engine_core = env.Library('update_engine_core', sources) |
| 362 | env.Prepend(LIBS=[update_engine_core]) |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 363 | |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 364 | env.Program('update_engine', main) |
| 365 | |
| 366 | client_cmd = env.Program('update_engine_client', client_main); |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 367 | |
| 368 | delta_generator_cmd = env.Program('delta_generator', |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 369 | delta_generator_main) |
adlr@google.com | c98a7ed | 2009-12-04 18:54:03 +0000 | [diff] [blame] | 370 | |
| 371 | http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 372 | |
| 373 | unittest_env = env.Clone() |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 374 | unittest_env.Append(LIBS=['gmock', 'gtest']) |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 375 | unittest_cmd = unittest_env.Program('update_engine_unittests', |
| 376 | unittest_sources + unittest_main) |
| 377 | Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + |
Andrew de los Reyes | 819fef2 | 2010-12-17 11:33:58 -0800 | [diff] [blame] | 378 | Split('html app.info')) |