From 1e371ab39e0c723b5bc4308939da8a5b167d498a Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Tue, 20 Dec 2022 14:47:51 +0100 Subject: [PATCH] Bug 1806601 - part 1: Run `sample-browser` jobs by factorizing optimization in `gradle_optimization` --- .../android_taskgraph/transforms/build.py | 1 - .../transforms/gradle_optimization.py | 24 ++++++++++++++++++++++ .../taskcluster/ci/build-components/kind.yml | 12 ----------- .../taskcluster/ci/test-components/kind.yml | 6 ------ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/mobile/android/taskcluster/android_taskgraph/transforms/build.py b/mobile/android/taskcluster/android_taskgraph/transforms/build.py index 21a52815d027..27d0d5f828f7 100644 --- a/mobile/android/taskcluster/android_taskgraph/transforms/build.py +++ b/mobile/android/taskcluster/android_taskgraph/transforms/build.py @@ -23,7 +23,6 @@ def resolve_keys(config, tasks): 'attributes.code-review', 'expose-artifacts', 'include-coverage', - 'optimization', 'shipping-phase', 'run-on-tasks-for', 'run.gradlew', diff --git a/mobile/android/taskcluster/android_taskgraph/transforms/gradle_optimization.py b/mobile/android/taskcluster/android_taskgraph/transforms/gradle_optimization.py index 1347fe82fb3a..1127a04eb06f 100644 --- a/mobile/android/taskcluster/android_taskgraph/transforms/gradle_optimization.py +++ b/mobile/android/taskcluster/android_taskgraph/transforms/gradle_optimization.py @@ -7,6 +7,30 @@ transforms = TransformSequence() @transforms.add +def add_components_optimization(config, tasks): + for task in tasks: + if _is_task_related_to_android_components(task): + build_type = task["attributes"]["build-type"] + if build_type not in ("nightly", "release"): + optimization = task.setdefault("optimization", {}) + skip_unless_changed = optimization.setdefault("skip-unless-changed", []) + skip_unless_changed.extend([ + "android-components/build.gradle", + "android-components/settings.gradle", + "android-components/buildSrc.*", + "android-components/gradle.properties", + "android-components/gradle/wrapper/gradle-wrapper.properties", + "android-components/plugins/dependencies/**", + ]) + + yield task + + +def _is_task_related_to_android_components(task): + return bool(task.get("attributes", {}).get("component", "")) + + +@transforms.add def extend_optimization_if_one_already_exists(config, tasks): deps_per_component = get_upstream_deps_for_all_gradle_projects() diff --git a/mobile/android/taskcluster/ci/build-components/kind.yml b/mobile/android/taskcluster/ci/build-components/kind.yml index a2d4ac95a709..5bf814458ec6 100644 --- a/mobile/android/taskcluster/ci/build-components/kind.yml +++ b/mobile/android/taskcluster/ci/build-components/kind.yml @@ -59,18 +59,6 @@ task-defaults: release: false nightly: false default: true - optimization: - by-build-type: - (nightly|release): {} - default: - skip-unless-changed: - - android-components/build.gradle - - android-components/settings.gradle - - android-components/buildSrc.* - - android-components/gradle.properties - - android-components/gradle/wrapper/gradle-wrapper.properties - - android-components/plugins/dependencies/** - # More paths are dynamically added by transforms run: gradlew: by-build-type: diff --git a/mobile/android/taskcluster/ci/test-components/kind.yml b/mobile/android/taskcluster/ci/test-components/kind.yml index eeffe3adc931..d5d68524fdc7 100644 --- a/mobile/android/taskcluster/ci/test-components/kind.yml +++ b/mobile/android/taskcluster/ci/test-components/kind.yml @@ -54,12 +54,6 @@ task-defaults: max-run-time: 2400 optimization: skip-unless-changed: - - android-components/build.gradle - - android-components/settings.gradle - - android-components/buildSrc.* - - android-components/gradle.properties - - android-components/gradle/wrapper/gradle-wrapper.properties - - android-components/plugins/dependencies/** - android-components/automation/taskcluster/androidTest/ui-test.sh # More paths are dynamically added by transforms -- 2.11.4.GIT