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/.
5 from taskgraph
.transforms
.base
import TransformSequence
6 from taskgraph
.util
.dependencies
import get_dependencies
8 from android_taskgraph
.util
.scriptworker
import generate_beetmover_upstream_artifacts
10 transforms
= TransformSequence()
13 def _get_task_type(dep_kind
):
14 if dep_kind
.startswith("build-"):
16 elif dep_kind
.startswith("signing-"):
22 def build_upstream_artifacts(config
, tasks
):
25 "upstream-artifacts": [],
27 if "artifact_map" in task
["attributes"]:
28 # Beetmover-apk tasks use declarative artifacts.
29 locale
= task
["attributes"].get("locale")
30 build_type
= task
["attributes"]["build-type"]
33 ] = generate_beetmover_upstream_artifacts(config
, task
, build_type
, locale
)
35 for dep
in get_dependencies(config
, task
):
36 paths
= list(dep
.attributes
.get("artifacts", {}).values())
40 for apk_metadata
in dep
.attributes
.get("apks", {}).values()
43 if dep
.attributes
.get("aab"):
44 paths
.extend([dep
.attributes
.get("aab")])
46 worker_definition
["upstream-artifacts"].append(
48 "taskId": {"task-reference": f
"<{dep.kind}>"},
49 "taskType": _get_task_type(dep
.kind
),
50 "paths": sorted(paths
),
54 task
.setdefault("worker", {}).update(worker_definition
)