From b4cff2028eedc6a7206c1c747430dc2eb9d24ecf Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Mon, 27 Nov 2023 20:20:14 -0700 Subject: [PATCH] Bug 1876041 - add android-l10n tasks. r=ahal,releng-reviewers,taskgraph-reviewers Differential Revision: https://phabricator.services.mozilla.com/D201480 --- .cron.yml | 8 +++ taskcluster/ci/android-l10n/kind.yml | 55 +++++++++++++++++++ taskcluster/ci/config.yml | 1 + taskcluster/docs/kinds.rst | 4 ++ taskcluster/gecko_taskgraph/target_tasks.py | 5 ++ .../gecko_taskgraph/transforms/task.py | 49 +++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 taskcluster/ci/android-l10n/kind.yml diff --git a/.cron.yml b/.cron.yml index 95665f7e97eb..fb77a946c7fd 100644 --- a/.cron.yml +++ b/.cron.yml @@ -399,3 +399,11 @@ jobs: - mozilla-central - oak when: [] # hook only + + - name: android-l10n-import + job: + type: decision-task + treeherder-symbol: android-l10n-import + target-tasks-method: android-l10n-import + run-on-projects: [oak] + when: [] # hook only diff --git a/taskcluster/ci/android-l10n/kind.yml b/taskcluster/ci/android-l10n/kind.yml new file mode 100644 index 000000000000..36dcf9c15fee --- /dev/null +++ b/taskcluster/ci/android-l10n/kind.yml @@ -0,0 +1,55 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +--- +loader: gecko_taskgraph.loader.transform:loader + +transforms: + - gecko_taskgraph.transforms.task:transforms + +job-defaults: + run-on-projects: [] + treeherder: + kind: build + platform: fenix-android-all/opt + tier: 1 + worker-type: tree + worker: + implementation: treescript + tags: [] + bump: false + dontbuild: false + ignore-closed-tree: true + push: true + +jobs: + import: + name: android_l10n_import + description: Import strings from android-l10n repo + treeherder: + symbol: android-l10n(I) + worker: + source-repo: https://hg.mozilla.org/projects/oak + android-l10n-import-info: + from-repo-url: https://github.com/mozilla-l10n/android-l10n + toml-info: + - toml-path: mozilla-mobile/fenix/l10n.toml + dest-path: mobile/android/fenix + - toml-path: mozilla-mobile/focus-android/l10n.toml + dest-path: mobile/android/focus-android + - toml-path: mozilla-mobile/android-components/l10n.toml + dest-path: mobile/android/android-components + + sync: + name: android_l10n_sync + description: Sync android-l10n strings from central to beta + treeherder: + symbol: android-l10n(S) + worker: + source-repo: https://hg.mozilla.org/releases/mozilla-beta + android-l10n-sync-info: + from-repo-url: https://hg.mozilla.org/mozilla-central + toml-info: + - toml-path: mobile/android/fenix/l10n.toml + - toml-path: mobile/android/focus-android/l10n.toml + - toml-path: mobile/android/android-components/l10n.toml diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index 824b6cfe24bd..e2d45239b39c 100644 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -242,6 +242,7 @@ treeherder: 'wc': 'webcompat' 'Boot': 'Bootstrap' 'Attr-L10n': 'Build Attribution' + 'android-l10n': 'Import strings from android-l10n repo' # The below symbols are from firefox-android (fenix/focus/android-components) 'buildconfig': 'Make sure the content of .buildconfig.yml matches what gradle knows about its projects' diff --git a/taskcluster/docs/kinds.rst b/taskcluster/docs/kinds.rst index 59a6c832be38..52334dd933f2 100644 --- a/taskcluster/docs/kinds.rst +++ b/taskcluster/docs/kinds.rst @@ -883,3 +883,7 @@ Push Focus and Fenix AABs to Google Play. push-bundle ----------- Push Focus and Fenix AABs to Google Play. + +android-l10n +------------ +Update android string resources from android-l10n repo. diff --git a/taskcluster/gecko_taskgraph/target_tasks.py b/taskcluster/gecko_taskgraph/target_tasks.py index f3cd3d00001c..952b28d77d8e 100644 --- a/taskcluster/gecko_taskgraph/target_tasks.py +++ b/taskcluster/gecko_taskgraph/target_tasks.py @@ -1660,3 +1660,8 @@ def target_tasks_nightly_android(full_task_graph, parameters, graph_config): return [] return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)] + + +@_target_task("android-l10n-import") +def target_tasks_android_l10n_import(full_task_graph, parameters, graph_config): + return [l for l, t in full_task_graph.tasks.items() if l == "android-l10n-import"] diff --git a/taskcluster/gecko_taskgraph/transforms/task.py b/taskcluster/gecko_taskgraph/transforms/task.py index 71c063c773c8..8eafe76eb9d7 100644 --- a/taskcluster/gecko_taskgraph/transforms/task.py +++ b/taskcluster/gecko_taskgraph/transforms/task.py @@ -1350,6 +1350,23 @@ def build_push_addons_payload(config, task, task_def): ], }, Optional("merge-info"): object, + Optional("android-l10n-import-info"): { + Required("from-repo-url"): str, + Required("toml-info"): [ + { + Required("toml-path"): str, + Required("dest-path"): str, + } + ], + }, + Optional("android-l10n-sync-info"): { + Required("from-repo-url"): str, + Required("toml-info"): [ + { + Required("toml-path"): str, + } + ], + }, }, ) def build_treescript_payload(config, task, task_def): @@ -1413,6 +1430,38 @@ def build_treescript_payload(config, task, task_def): task_def["payload"]["merge_info"] = merge_info actions.append("merge_day") + if worker.get("android-l10n-import-info"): + android_l10n_import_info = {} + for k, v in worker["android-l10n-import-info"].items(): + android_l10n_import_info[k.replace("-", "_")] = worker[ + "android-l10n-import-info" + ][k] + android_l10n_import_info["toml_info"] = [ + { + param_name.replace("-", "_"): param_value + for param_name, param_value in entry.items() + } + for entry in worker["android-l10n-import-info"]["toml-info"] + ] + task_def["payload"]["android_l10n_import_info"] = android_l10n_import_info + actions.append("android_l10n_import") + + if worker.get("android-l10n-sync-info"): + android_l10n_sync_info = {} + for k, v in worker["android-l10n-sync-info"].items(): + android_l10n_sync_info[k.replace("-", "_")] = worker[ + "android-l10n-sync-info" + ][k] + android_l10n_sync_info["toml_info"] = [ + { + param_name.replace("-", "_"): param_value + for param_name, param_value in entry.items() + } + for entry in worker["android-l10n-sync-info"]["toml-info"] + ] + task_def["payload"]["android_l10n_sync_info"] = android_l10n_sync_info + actions.append("android_l10n_sync") + if worker["push"]: actions.append("push")