custom_car.py (1348B)
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 transforms = TransformSequence() 8 9 CUSTOM_CAR_TASKS = [ 10 "linux64-custom-car", 11 "win64-custom-car", 12 "macosx-custom-car", 13 "macosx-arm64-custom-car", 14 "android-custom-car", 15 ] 16 17 18 @transforms.add 19 def add_custom_car_optimization(config, tasks): 20 for task in tasks: 21 if task.get("name") not in CUSTOM_CAR_TASKS: 22 yield task 23 continue 24 25 task_name = task["name"] 26 trust_domain = config.graph_config["trust-domain"] 27 level = config.params["level"] 28 29 index_route = f"{trust_domain}.cache.level-{level}.toolchain.{task_name}.latest" 30 full_index_route = f"index.{index_route}" 31 32 task.setdefault("routes", []).append(full_index_route) 33 34 if config.params["project"] == "try": 35 index_paths = [] 36 for search_level in reversed(range(int(level), 4)): 37 search_route = f"{trust_domain}.cache.level-{search_level}.toolchain.{task_name}.latest" 38 index_paths.append(search_route) 39 40 task["optimization"] = {"index-search": index_paths} 41 42 yield task