Represents information about a group of builds. For now builds are grouped into matrices based on which ACE/TAO they use.
| 236 | |
| 237 | |
| 238 | class Matrix: |
| 239 | '''Represents information about a group of builds. |
| 240 | |
| 241 | For now builds are grouped into matrices based on which ACE/TAO they use. |
| 242 | ''' |
| 243 | |
| 244 | def __init__(self, name, mark=None, url=None, **default_flags): |
| 245 | self.name = name |
| 246 | self.mark = name[0] if mark is None else mark |
| 247 | self.url = url |
| 248 | self.ndks = [] |
| 249 | self.builds = [] |
| 250 | self.builds_by_ndk = {} |
| 251 | self.apis = [] |
| 252 | self.default_flags = default_default_flags.copy() |
| 253 | self.default_flags.update(default_flags) |
| 254 | |
| 255 | def archs_for_build(self, ndk, api): |
| 256 | archs = set() |
| 257 | for build in matrix.builds_by_ndk[ndk]: |
| 258 | if build.api == api: |
| 259 | archs.add(build.arch) |
| 260 | return archs |
| 261 | |
| 262 | def has_build_for(self, ndk, api): |
| 263 | if ndk in self.builds_by_ndk: |
| 264 | for build in self.builds_by_ndk[ndk]: |
| 265 | if build.api == api: |
| 266 | return True |
| 267 | return False |
| 268 | |
| 269 | def add_ndk(self, ndk, *args, api_range=None, default_flags={}, flags_on_edges={}): |
| 270 | '''Adds a build or set of builds for an NDK. |
| 271 | |
| 272 | `ndk` can be an `Ndk` object, the name of the NDK ("r23") or a nickname |
| 273 | ("latest_stable"). |
| 274 | `args` Are the Android API Levels to build. They can be a single API level |
| 275 | numbers, or a `str` nickname of a single or series of API levels associated |
| 276 | with the NDK. The nicknames are: |
| 277 | "min": The minimum API level supported by the NDK. |
| 278 | "max": The maximum API level supported by the NDK. |
| 279 | "minmax": Equivalent to `"min", "max"`. |
| 280 | "all": All the API levels supported by the NDK. |
| 281 | These are combined with `api_range` if also passed. |
| 282 | `api_range` is a tuple of two `int`s for a range of API levels to use. |
| 283 | These are combined with `args` if also passed. |
| 284 | `default_flags` are the flags to use on the builds. |
| 285 | `flags_on_edges` are the flags to override `default_flags` on the builds |
| 286 | with minimum and maximum API levels. |
| 287 | ''' |
| 288 | |
| 289 | tmp_ndk = Ndk.get(ndk) |
| 290 | if tmp_ndk is None: |
| 291 | print("Skipping {} {} {}: No such NDK at the moment".format(ndk, args, api_range)); |
| 292 | return |
| 293 | ndk = tmp_ndk |
| 294 | name = str(ndk) |
| 295 | new_ndk = name not in self.ndks |