A class that understands the gyp 'xcode_settings' object.
| 146 | |
| 147 | |
| 148 | class XcodeSettings: |
| 149 | """A class that understands the gyp 'xcode_settings' object.""" |
| 150 | |
| 151 | # Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached |
| 152 | # at class-level for efficiency. |
| 153 | _sdk_path_cache = {} |
| 154 | _platform_path_cache = {} |
| 155 | _sdk_root_cache = {} |
| 156 | |
| 157 | # Populated lazily by GetExtraPlistItems(). Shared by all XcodeSettings, so |
| 158 | # cached at class-level for efficiency. |
| 159 | _plist_cache = {} |
| 160 | |
| 161 | # Populated lazily by GetIOSPostbuilds. Shared by all XcodeSettings, so |
| 162 | # cached at class-level for efficiency. |
| 163 | _codesigning_key_cache = {} |
| 164 | |
| 165 | def __init__(self, spec): |
| 166 | self.spec = spec |
| 167 | |
| 168 | self.isIOS = False |
| 169 | self.mac_toolchain_dir = None |
| 170 | self.header_map_path = None |
| 171 | |
| 172 | # Per-target 'xcode_settings' are pushed down into configs earlier by gyp. |
| 173 | # This means self.xcode_settings[config] always contains all settings |
| 174 | # for that config -- the per-target settings as well. Settings that are |
| 175 | # the same for all configs are implicitly per-target settings. |
| 176 | self.xcode_settings = {} |
| 177 | configs = spec["configurations"] |
| 178 | for configname, config in configs.items(): |
| 179 | self.xcode_settings[configname] = config.get("xcode_settings", {}) |
| 180 | self._ConvertConditionalKeys(configname) |
| 181 | if self.xcode_settings[configname].get("IPHONEOS_DEPLOYMENT_TARGET", None): |
| 182 | self.isIOS = True |
| 183 | |
| 184 | # This is only non-None temporarily during the execution of some methods. |
| 185 | self.configname = None |
| 186 | |
| 187 | # Used by _AdjustLibrary to match .a and .dylib entries in libraries. |
| 188 | self.library_re = re.compile(r"^lib([^/]+)\.(a|dylib)$") |
| 189 | |
| 190 | def _ConvertConditionalKeys(self, configname): |
| 191 | """Converts or warns on conditional keys. Xcode supports conditional keys, |
| 192 | such as CODE_SIGN_IDENTITY[sdk=iphoneos*]. This is a partial implementation |
| 193 | with some keys converted while the rest force a warning.""" |
| 194 | settings = self.xcode_settings[configname] |
| 195 | conditional_keys = [key for key in settings if key.endswith("]")] |
| 196 | for key in conditional_keys: |
| 197 | # If you need more, speak up at http://crbug.com/122592 |
| 198 | if key.endswith("[sdk=iphoneos*]"): |
| 199 | if configname.endswith("iphoneos"): |
| 200 | new_key = key.split("[")[0] |
| 201 | settings[new_key] = settings[key] |
| 202 | else: |
| 203 | print( |
| 204 | "Warning: Conditional keys not implemented, ignoring:", |
| 205 | " ".join(conditional_keys), |
no outgoing calls
searching dependent graphs…