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 |
| 11 from SCons.Script import * |
| 12 |
11 import SCons.Node | 13 import SCons.Node |
12 import _Node_MSVS as MSVS | 14 import _Node_MSVS as MSVS |
13 | 15 |
14 class Null(object): | 16 class Null(object): |
15 def __new__(cls, *args, **kwargs): | 17 def __new__(cls, *args, **kwargs): |
16 if '_inst' not in vars(cls): | 18 if '_inst' not in vars(cls): |
17 cls._inst = super(type, cls).__new__(cls, *args, **kwargs) | 19 cls._inst = super(type, cls).__new__(cls, *args, **kwargs) |
18 return cls._inst | 20 return cls._inst |
19 def __init__(self, *args, **kwargs): pass | 21 def __init__(self, *args, **kwargs): pass |
20 def __call__(self, *args, **kwargs): return self | 22 def __call__(self, *args, **kwargs): return self |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return env.ComponentObject(*args, **kw) | 98 return env.ComponentObject(*args, **kw) |
97 | 99 |
98 def ChromeMSVSFolder(env, *args, **kw): | 100 def ChromeMSVSFolder(env, *args, **kw): |
99 if not env.Bit('msvs'): | 101 if not env.Bit('msvs'): |
100 return Null() | 102 return Null() |
101 return env.MSVSFolder(*args, **kw) | 103 return env.MSVSFolder(*args, **kw) |
102 | 104 |
103 def ChromeMSVSProject(env, *args, **kw): | 105 def ChromeMSVSProject(env, *args, **kw): |
104 if not env.Bit('msvs'): | 106 if not env.Bit('msvs'): |
105 return Null() | 107 return Null() |
106 return env.MSVSProject(*args, **kw) | 108 try: |
| 109 dest = kw['dest'] |
| 110 except KeyError: |
| 111 dest = None |
| 112 else: |
| 113 del kw['dest'] |
| 114 result = env.MSVSProject(*args, **kw) |
| 115 env.AlwaysBuild(result) |
| 116 if dest: |
| 117 i = env.Command(dest, result, Copy('$TARGET', '$SOURCE')) |
| 118 Alias('msvs', i) |
| 119 return result |
107 | 120 |
108 def ChromeMSVSSolution(env, *args, **kw): | 121 def ChromeMSVSSolution(env, *args, **kw): |
109 if not env.Bit('msvs'): | 122 if not env.Bit('msvs'): |
110 return Null() | 123 return Null() |
111 return env.MSVSSolution(*args, **kw) | 124 try: |
| 125 dest = kw['dest'] |
| 126 except KeyError: |
| 127 dest = None |
| 128 else: |
| 129 del kw['dest'] |
| 130 result = env.MSVSSolution(*args, **kw) |
| 131 env.AlwaysBuild(result) |
| 132 if dest: |
| 133 i = env.Command(dest, result, Copy('$TARGET', '$SOURCE')) |
| 134 Alias('msvs', i) |
| 135 return result |
112 | 136 |
113 def generate(env): | 137 def generate(env): |
114 env.AddMethod(ChromeProgram) | 138 env.AddMethod(ChromeProgram) |
115 env.AddMethod(ChromeTestProgram) | 139 env.AddMethod(ChromeTestProgram) |
116 env.AddMethod(ChromeLibrary) | 140 env.AddMethod(ChromeLibrary) |
117 env.AddMethod(ChromeStaticLibrary) | 141 env.AddMethod(ChromeStaticLibrary) |
118 env.AddMethod(ChromeSharedLibrary) | 142 env.AddMethod(ChromeSharedLibrary) |
119 env.AddMethod(ChromeObject) | 143 env.AddMethod(ChromeObject) |
120 env.AddMethod(ChromeMSVSFolder) | 144 env.AddMethod(ChromeMSVSFolder) |
121 env.AddMethod(ChromeMSVSProject) | 145 env.AddMethod(ChromeMSVSProject) |
122 env.AddMethod(ChromeMSVSSolution) | 146 env.AddMethod(ChromeMSVSSolution) |
123 | 147 |
124 def exists(env): | 148 def exists(env): |
125 return True | 149 return True |
OLD | NEW |