| OLD | NEW |
| 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 Tool module for adding, to a construction environment, Chromium-specific | 6 Tool module for adding, to a construction environment, Chromium-specific |
| 7 wrappers around Hammer builders. This gives us a central place for any | 7 wrappers around Hammer builders. This gives us a central place for any |
| 8 customization we need to make to the different things we build. | 8 customization we need to make to the different things we build. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return [x for x in sources if compilable(env, x)] | 184 return [x for x in sources if compilable(env, x)] |
| 185 result = [] | 185 result = [] |
| 186 for top, folders, nonfolders in FileListWalk(sources): | 186 for top, folders, nonfolders in FileListWalk(sources): |
| 187 result.extend([x for x in nonfolders if compilable(env, x)]) | 187 result.extend([x for x in nonfolders if compilable(env, x)]) |
| 188 return result | 188 return result |
| 189 | 189 |
| 190 def ChromeProgram(env, target, source, *args, **kw): | 190 def ChromeProgram(env, target, source, *args, **kw): |
| 191 source = compilable_files(env, source) | 191 source = compilable_files(env, source) |
| 192 if env.get('_GYP'): | 192 if env.get('_GYP'): |
| 193 prog = env.Program(target, source, *args, **kw) | 193 prog = env.Program(target, source, *args, **kw) |
| 194 result = env.Install('$TOP_BUILDDIR', prog) | 194 result = env.ChromeInstall('$TOP_BUILDDIR', prog) |
| 195 else: | 195 else: |
| 196 result = env.ComponentProgram(target, source, *args, **kw) | 196 result = env.ComponentProgram(target, source, *args, **kw) |
| 197 if env.get('INCREMENTAL'): | 197 if env.get('INCREMENTAL'): |
| 198 env.Precious(result) | 198 env.Precious(result) |
| 199 return result | 199 return result |
| 200 | 200 |
| 201 def ChromeTestProgram(env, target, source, *args, **kw): | 201 def ChromeTestProgram(env, target, source, *args, **kw): |
| 202 source = compilable_files(env, source) | 202 source = compilable_files(env, source) |
| 203 if env.get('_GYP'): | 203 if env.get('_GYP'): |
| 204 prog = env.Program(target, source, *args, **kw) | 204 prog = env.Program(target, source, *args, **kw) |
| 205 result = env.Install('$TOP_BUILDDIR', prog) | 205 result = env.ChromeInstall('$TOP_BUILDDIR', prog) |
| 206 else: | 206 else: |
| 207 result = env.ComponentTestProgram(target, source, *args, **kw) | 207 result = env.ComponentTestProgram(target, source, *args, **kw) |
| 208 if env.get('INCREMENTAL'): | 208 if env.get('INCREMENTAL'): |
| 209 env.Precious(*result) | 209 env.Precious(*result) |
| 210 return result | 210 return result |
| 211 | 211 |
| 212 def ChromeLibrary(env, target, source, *args, **kw): | 212 def ChromeLibrary(env, target, source, *args, **kw): |
| 213 source = compilable_files(env, source) | 213 source = compilable_files(env, source) |
| 214 if env.get('_GYP'): | 214 if env.get('_GYP'): |
| 215 lib = env.Library(target, source, *args, **kw) | 215 lib = env.Library(target, source, *args, **kw) |
| 216 result = env.Install('$LIB_DIR', lib) | 216 result = env.ChromeInstall('$LIB_DIR', lib) |
| 217 else: | 217 else: |
| 218 result = env.ComponentLibrary(target, source, *args, **kw) | 218 result = env.ComponentLibrary(target, source, *args, **kw) |
| 219 return result | 219 return result |
| 220 | 220 |
| 221 def ChromeLoadableModule(env, target, source, *args, **kw): | 221 def ChromeLoadableModule(env, target, source, *args, **kw): |
| 222 source = compilable_files(env, source) | 222 source = compilable_files(env, source) |
| 223 if env.get('_GYP'): | 223 if env.get('_GYP'): |
| 224 result = env.LoadableModule(target, source, *args, **kw) | 224 result = env.LoadableModule(target, source, *args, **kw) |
| 225 else: | 225 else: |
| 226 kw['COMPONENT_STATIC'] = True | 226 kw['COMPONENT_STATIC'] = True |
| 227 result = env.LoadableModule(target, source, *args, **kw) | 227 result = env.LoadableModule(target, source, *args, **kw) |
| 228 return result | 228 return result |
| 229 | 229 |
| 230 def ChromeStaticLibrary(env, target, source, *args, **kw): | 230 def ChromeStaticLibrary(env, target, source, *args, **kw): |
| 231 source = compilable_files(env, source) | 231 source = compilable_files(env, source) |
| 232 if env.get('_GYP'): | 232 if env.get('_GYP'): |
| 233 lib = env.StaticLibrary(target, source, *args, **kw) | 233 lib = env.StaticLibrary(target, source, *args, **kw) |
| 234 result = env.Install('$LIB_DIR', lib) | 234 result = env.ChromeInstall('$LIB_DIR', lib) |
| 235 else: | 235 else: |
| 236 kw['COMPONENT_STATIC'] = True | 236 kw['COMPONENT_STATIC'] = True |
| 237 result = env.ComponentLibrary(target, source, *args, **kw) | 237 result = env.ComponentLibrary(target, source, *args, **kw) |
| 238 return result | 238 return result |
| 239 | 239 |
| 240 def ChromeSharedLibrary(env, target, source, *args, **kw): | 240 def ChromeSharedLibrary(env, target, source, *args, **kw): |
| 241 source = compilable_files(env, source) | 241 source = compilable_files(env, source) |
| 242 if env.get('_GYP'): | 242 if env.get('_GYP'): |
| 243 lib = env.SharedLibrary(target, source, *args, **kw) | 243 lib = env.SharedLibrary(target, source, *args, **kw) |
| 244 result = env.Install('$LIB_DIR', lib) | 244 result = env.ChromeInstall('$LIB_DIR', lib) |
| 245 else: | 245 else: |
| 246 kw['COMPONENT_STATIC'] = False | 246 kw['COMPONENT_STATIC'] = False |
| 247 result = [env.ComponentLibrary(target, source, *args, **kw)[0]] | 247 result = [env.ComponentLibrary(target, source, *args, **kw)[0]] |
| 248 if env.get('INCREMENTAL'): | 248 if env.get('INCREMENTAL'): |
| 249 env.Precious(result) | 249 env.Precious(result) |
| 250 return result | 250 return result |
| 251 | 251 |
| 252 def ChromeObject(env, *args, **kw): | 252 def ChromeObject(env, *args, **kw): |
| 253 if env.get('_GYP'): | 253 if env.get('_GYP'): |
| 254 result = env.Object(target, source, *args, **kw) | 254 result = env.Object(target, source, *args, **kw) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 dest = None | 286 dest = None |
| 287 else: | 287 else: |
| 288 del kw['dest'] | 288 del kw['dest'] |
| 289 result = env.MSVSSolution(*args, **kw) | 289 result = env.MSVSSolution(*args, **kw) |
| 290 env.AlwaysBuild(result) | 290 env.AlwaysBuild(result) |
| 291 if dest: | 291 if dest: |
| 292 i = env.Command(dest, result, Copy('$TARGET', '$SOURCE')) | 292 i = env.Command(dest, result, Copy('$TARGET', '$SOURCE')) |
| 293 Alias('msvs', i) | 293 Alias('msvs', i) |
| 294 return result | 294 return result |
| 295 | 295 |
| 296 def ChromeInstall(env, target, source): |
| 297 """ |
| 298 Replacement for the stock SCons Install() builder to use the |
| 299 external cp utility instead of Python internals. |
| 300 """ |
| 301 result = [] |
| 302 copy_action = Action('cp $SOURCE $TARGET', 'Copying $TARGET') |
| 303 for s in source: |
| 304 dest = str(target) + '/' + os.path.split(str(s))[1] |
| 305 result.extend(env.Command(dest, s, copy_action) |
| 306 return result |
| 307 |
| 296 def generate(env): | 308 def generate(env): |
| 297 env.AddMethod(ChromeProgram) | 309 env.AddMethod(ChromeProgram) |
| 298 env.AddMethod(ChromeTestProgram) | 310 env.AddMethod(ChromeTestProgram) |
| 299 env.AddMethod(ChromeLibrary) | 311 env.AddMethod(ChromeLibrary) |
| 300 env.AddMethod(ChromeLoadableModule) | 312 env.AddMethod(ChromeLoadableModule) |
| 301 env.AddMethod(ChromeStaticLibrary) | 313 env.AddMethod(ChromeStaticLibrary) |
| 302 env.AddMethod(ChromeSharedLibrary) | 314 env.AddMethod(ChromeSharedLibrary) |
| 303 env.AddMethod(ChromeObject) | 315 env.AddMethod(ChromeObject) |
| 304 env.AddMethod(ChromeMSVSFolder) | 316 env.AddMethod(ChromeMSVSFolder) |
| 305 env.AddMethod(ChromeMSVSProject) | 317 env.AddMethod(ChromeMSVSProject) |
| 306 env.AddMethod(ChromeMSVSSolution) | 318 env.AddMethod(ChromeMSVSSolution) |
| 319 env.AddMethod(ChromeInstall) |
| 307 | 320 |
| 308 env.AddMethod(FilterOut) | 321 env.AddMethod(FilterOut) |
| 309 | 322 |
| 310 # Add the grit tool to the base environment because we use this a lot. | 323 # Add the grit tool to the base environment because we use this a lot. |
| 311 sys.path.append(env.Dir('$SRC_DIR/tools/grit').abspath) | 324 sys.path.append(env.Dir('$SRC_DIR/tools/grit').abspath) |
| 312 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/grit/grit')]) | 325 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/grit/grit')]) |
| 313 | 326 |
| 314 # Add the repack python script tool that we use in multiple places. | 327 # Add the repack python script tool that we use in multiple places. |
| 315 sys.path.append(env.Dir('$SRC_DIR/tools/data_pack').abspath) | 328 sys.path.append(env.Dir('$SRC_DIR/tools/data_pack').abspath) |
| 316 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/data_pack/')]) | 329 env.Tool('scons', toolpath=[env.Dir('$SRC_DIR/tools/data_pack/')]) |
| 317 | 330 |
| 318 def exists(env): | 331 def exists(env): |
| 319 return True | 332 return True |
| OLD | NEW |