| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 try: | 46 try: |
| 47 i = top.index(old) | 47 i = top.index(old) |
| 48 except ValueError: | 48 except ValueError: |
| 49 pass | 49 pass |
| 50 else: | 50 else: |
| 51 top[i] = new | 51 top[i] = new |
| 52 | 52 |
| 53 import __builtin__ | 53 import __builtin__ |
| 54 __builtin__.ChromeFileList = ChromeFileList | 54 __builtin__.ChromeFileList = ChromeFileList |
| 55 | 55 |
| 56 def compilable_files(sources): | 56 non_compilable_suffixes = { |
| 57 'LINUX' : set([ |
| 58 '.h', |
| 59 '.dat', |
| 60 '.rc', |
| 61 ]), |
| 62 'WINDOWS' : set([ |
| 63 '.h', |
| 64 '.dat', |
| 65 ]), |
| 66 } |
| 67 |
| 68 def compilable(env, file): |
| 69 base, ext = os.path.splitext(str(file)) |
| 70 if ext in non_compilable_suffixes[env['TARGET_PLATFORM']]: |
| 71 return False |
| 72 return True |
| 73 |
| 74 def compilable_files(env, sources): |
| 57 if not hasattr(sources, 'entries'): | 75 if not hasattr(sources, 'entries'): |
| 58 return [x for x in sources if not str(x).endswith('.h') | 76 return [x for x in sources if compilable(env, x)] |
| 59 and not str(x).endswith('.dat')] | |
| 60 result = [] | 77 result = [] |
| 61 for top, folders, nonfolders in MSVS.FileListWalk(sources): | 78 for top, folders, nonfolders in MSVS.FileListWalk(sources): |
| 62 result.extend([x for x in nonfolders if not str(x).endswith('.h') | 79 result.extend([x for x in nonfolders if compilable(env, x)]) |
| 63 and not str(x).endswith('.dat')]) | |
| 64 return result | 80 return result |
| 65 | 81 |
| 66 def ChromeProgram(env, target, source, *args, **kw): | 82 def ChromeProgram(env, target, source, *args, **kw): |
| 67 source = compilable_files(source) | 83 source = compilable_files(env, source) |
| 68 result = env.ComponentProgram(target, source, *args, **kw) | 84 result = env.ComponentProgram(target, source, *args, **kw) |
| 69 if env.get('INCREMENTAL'): | 85 if env.get('INCREMENTAL'): |
| 70 env.Precious(result) | 86 env.Precious(result) |
| 71 return result | 87 return result |
| 72 | 88 |
| 73 def ChromeTestProgram(env, target, source, *args, **kw): | 89 def ChromeTestProgram(env, target, source, *args, **kw): |
| 74 source = compilable_files(source) | 90 source = compilable_files(env, source) |
| 75 result = env.ComponentTestProgram(target, source, *args, **kw) | 91 result = env.ComponentTestProgram(target, source, *args, **kw) |
| 76 if env.get('INCREMENTAL'): | 92 if env.get('INCREMENTAL'): |
| 77 env.Precious(*result) | 93 env.Precious(*result) |
| 78 return result | 94 return result |
| 79 | 95 |
| 80 def ChromeLibrary(env, target, source, *args, **kw): | 96 def ChromeLibrary(env, target, source, *args, **kw): |
| 81 source = compilable_files(source) | 97 source = compilable_files(env, source) |
| 82 return env.ComponentLibrary(target, source, *args, **kw) | 98 return env.ComponentLibrary(target, source, *args, **kw) |
| 83 | 99 |
| 84 def ChromeStaticLibrary(env, target, source, *args, **kw): | 100 def ChromeStaticLibrary(env, target, source, *args, **kw): |
| 85 source = compilable_files(source) | 101 source = compilable_files(env, source) |
| 86 kw['COMPONENT_STATIC'] = True | 102 kw['COMPONENT_STATIC'] = True |
| 87 return env.ComponentLibrary(target, source, *args, **kw) | 103 return env.ComponentLibrary(target, source, *args, **kw) |
| 88 | 104 |
| 89 def ChromeSharedLibrary(env, target, source, *args, **kw): | 105 def ChromeSharedLibrary(env, target, source, *args, **kw): |
| 90 source = compilable_files(source) | 106 source = compilable_files(env, source) |
| 91 kw['COMPONENT_STATIC'] = False | 107 kw['COMPONENT_STATIC'] = False |
| 92 result = [env.ComponentLibrary(target, source, *args, **kw)[0]] | 108 result = [env.ComponentLibrary(target, source, *args, **kw)[0]] |
| 93 if env.get('INCREMENTAL'): | 109 if env.get('INCREMENTAL'): |
| 94 env.Precious(result) | 110 env.Precious(result) |
| 95 return result | 111 return result |
| 96 | 112 |
| 97 def ChromeObject(env, *args, **kw): | 113 def ChromeObject(env, *args, **kw): |
| 98 return env.ComponentObject(*args, **kw) | 114 return env.ComponentObject(*args, **kw) |
| 99 | 115 |
| 100 def ChromeMSVSFolder(env, *args, **kw): | 116 def ChromeMSVSFolder(env, *args, **kw): |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 env.AddMethod(ChromeLibrary) | 156 env.AddMethod(ChromeLibrary) |
| 141 env.AddMethod(ChromeStaticLibrary) | 157 env.AddMethod(ChromeStaticLibrary) |
| 142 env.AddMethod(ChromeSharedLibrary) | 158 env.AddMethod(ChromeSharedLibrary) |
| 143 env.AddMethod(ChromeObject) | 159 env.AddMethod(ChromeObject) |
| 144 env.AddMethod(ChromeMSVSFolder) | 160 env.AddMethod(ChromeMSVSFolder) |
| 145 env.AddMethod(ChromeMSVSProject) | 161 env.AddMethod(ChromeMSVSProject) |
| 146 env.AddMethod(ChromeMSVSSolution) | 162 env.AddMethod(ChromeMSVSSolution) |
| 147 | 163 |
| 148 def exists(env): | 164 def exists(env): |
| 149 return True | 165 return True |
| OLD | NEW |