tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

build_schedules.py (1727B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 from taskgraph.transforms.base import TransformSequence
      6 
      7 from gecko_taskgraph.util.platforms import platform_family
      8 
      9 transforms = TransformSequence()
     10 
     11 
     12 @transforms.add
     13 def set_build_schedules_optimization(config, tasks):
     14    """Set the `build` optimization based on the build platform."""
     15    for task in tasks:
     16        # don't add an optimization if there's already one defined
     17        if "when" in task or "optimization" in task:
     18            yield task
     19            continue
     20 
     21        schedules = []
     22        if config.kind in (
     23            "build-components",
     24            "build-samples-browser",
     25            "test-components",
     26        ):
     27            # These are Android components builds and can only impact Fenix or Focus.
     28            schedules = ["android", "fenix", "focus-android"]
     29 
     30        elif config.kind in ("build-apk", "build-bundle", "test-apk", "ui-test-apk"):
     31            # These are APK builds for Fenix or Focus
     32            schedules = ["android"]
     33 
     34            if "fenix" in task["name"]:
     35                schedules.append("fenix")
     36            elif "focus" in task["name"] or "klar" in task["name"]:
     37                schedules.append("focus-android")
     38 
     39        else:
     40            family = platform_family(task["attributes"]["build_platform"])
     41            schedules = [family]
     42 
     43            if "android" not in family:
     44                # These are not GeckoView builds, so are associated with Firefox.
     45                schedules.append("firefox")
     46 
     47        task["optimization"] = {"build": schedules}
     48        yield task