Bug 1965484 - Build android-components in topobjdir r=aaronmt,geckoview-reviewers,nalexander
Use the $TOPOBJDIR to build android-components in since mozilla-central convention is to not build into source tree. This also updates the ui-test scripts to understand these new paths. Differential Revision: https://phabricator.services.mozilla.com/D248625
This commit is contained in:
committed by
tcampbell@mozilla.com
parent
8541cac1e2
commit
221b7f2e3b
@@ -155,27 +155,23 @@ gradle.projectsLoaded { ->
|
||||
}
|
||||
|
||||
// Initialize all project buildDirs to be in ${topobjdir} to follow
|
||||
// conventions of mozilla-central build system. Android Components
|
||||
// subproject continues to build in source tree to avoid breaking
|
||||
// automation.
|
||||
if (!rootDir.toString().endsWith("android-components")) {
|
||||
gradle.rootProject.allprojects { project ->
|
||||
def topSrcPath = file(gradle.mozconfig.topsrcdir).toPath()
|
||||
def topObjPath = file(gradle.mozconfig.topobjdir).toPath()
|
||||
// conventions of mozilla-central build system.
|
||||
gradle.rootProject.allprojects { project ->
|
||||
def topSrcPath = file(gradle.mozconfig.topsrcdir).toPath()
|
||||
def topObjPath = file(gradle.mozconfig.topobjdir).toPath()
|
||||
|
||||
def sourcePath = project.getBuildFile().toPath().getParent()
|
||||
def relativePath = topSrcPath.relativize(sourcePath)
|
||||
def sourcePath = project.getBuildFile().toPath().getParent()
|
||||
def relativePath = topSrcPath.relativize(sourcePath)
|
||||
|
||||
if (relativePath.startsWith("..")) {
|
||||
// The project doesn't appear to be in topsrcdir so leave the
|
||||
// buildDir alone.
|
||||
} else {
|
||||
// Transplant the project path into "${topobjdir}/gradle/build".
|
||||
// This is consistent with existing gradle / taskcluster
|
||||
// configurations but less consistent with the result of the
|
||||
// non-gradle build system.
|
||||
buildDir = topObjPath.resolve("gradle/build").resolve(relativePath)
|
||||
}
|
||||
if (relativePath.startsWith("..")) {
|
||||
// The project doesn't appear to be in topsrcdir so leave the
|
||||
// buildDir alone.
|
||||
} else {
|
||||
// Transplant the project path into "${topobjdir}/gradle/build".
|
||||
// This is consistent with existing gradle / taskcluster
|
||||
// configurations but less consistent with the result of the
|
||||
// non-gradle build system.
|
||||
buildDir = topObjPath.resolve("gradle/build").resolve(relativePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# 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/.
|
||||
|
||||
import os
|
||||
|
||||
from taskgraph.transforms.base import TransformSequence
|
||||
|
||||
transforms = TransformSequence()
|
||||
@@ -31,6 +33,15 @@ def set_component_attribute(config, tasks):
|
||||
|
||||
@transforms.add
|
||||
def define_ui_test_command_line(config, tasks):
|
||||
def apk_path(component_fragment, variant, apk_filename):
|
||||
return os.path.join(
|
||||
"/builds/worker/workspace/obj-build",
|
||||
"gradle/build",
|
||||
f"mobile/android/android-components/{component_fragment}",
|
||||
f"outputs/apk/{variant}",
|
||||
apk_filename,
|
||||
)
|
||||
|
||||
for task in tasks:
|
||||
component = task["attributes"]["component"]
|
||||
device_type = "arm" # This maps to existing Flank configurations in automation/taskcluster/androidTest (e.g, flank-arm.yml)
|
||||
@@ -39,27 +50,49 @@ def define_ui_test_command_line(config, tasks):
|
||||
|
||||
if component == "samples-browser":
|
||||
# Case 2: Exact match for "samples-browser" – gecko paths with "-debug"
|
||||
apk_app = "./samples/browser/build/outputs/apk/gecko/debug/samples-browser-gecko-debug.apk"
|
||||
apk_test = "./samples/browser/build/outputs/apk/androidTest/gecko/debug/samples-browser-gecko-debug-androidTest.apk"
|
||||
apk_app = apk_path(
|
||||
"samples/browser", "gecko/debug", "samples-browser-gecko-debug.apk"
|
||||
)
|
||||
apk_test = apk_path(
|
||||
"samples/browser",
|
||||
"androidTest/gecko/debug",
|
||||
"samples-browser-gecko-debug-androidTest.apk",
|
||||
)
|
||||
|
||||
elif component.startswith("samples-"):
|
||||
# Case 3: Other samples-* (e.g., samples-glean)
|
||||
sample = component.replace("samples-", "")
|
||||
apk_app = (
|
||||
f"./samples/{sample}/build/outputs/apk/debug/samples-{sample}-debug.apk"
|
||||
apk_app = apk_path(
|
||||
f"samples/{sample}", "debug", f"samples-{sample}-debug.apk"
|
||||
)
|
||||
apk_test = apk_path(
|
||||
f"samples/{sample}",
|
||||
"androidTest/debug",
|
||||
f"samples-{sample}-debug-androidTest.apk",
|
||||
)
|
||||
apk_test = f"./samples/{sample}/build/outputs/apk/androidTest/debug/samples-{sample}-debug-androidTest.apk"
|
||||
|
||||
elif "-" in component:
|
||||
# Case 1a: Component with dash (e.g., feature-share → components/feature/share)
|
||||
category, submodule = component.split("-", 1)
|
||||
apk_app = "./samples/browser/build/outputs/apk/gecko/debug/samples-browser-gecko-debug.apk"
|
||||
apk_test = f"./components/{category}/{submodule}/build/outputs/apk/androidTest/debug/{component}-debug-androidTest.apk"
|
||||
apk_app = apk_path(
|
||||
"samples/browser", "gecko/debug", "samples-browser-gecko-debug.apk"
|
||||
)
|
||||
apk_test = apk_path(
|
||||
f"components/{category}/{submodule}",
|
||||
"androidTest/debug",
|
||||
f"{component}-debug-androidTest.apk",
|
||||
)
|
||||
|
||||
else:
|
||||
# Case 1b: Component with no dash (e.g., browser → components/browser/engine-gecko)
|
||||
apk_app = "./samples/browser/build/outputs/apk/gecko/debug/samples-browser-gecko-debug.apk"
|
||||
apk_test = f"./components/{component}/engine-gecko/build/outputs/apk/androidTest/debug/browser-engine-gecko-debug-androidTest.apk"
|
||||
apk_app = apk_path(
|
||||
"samples/browser", "gecko/debug", "samples-browser-gecko-debug.apk"
|
||||
)
|
||||
apk_test = apk_path(
|
||||
f"components/{component}/engine-gecko",
|
||||
"androidTest/debug",
|
||||
"browser-engine-gecko-debug-androidTest.apk",
|
||||
)
|
||||
|
||||
run = task.setdefault("run", {})
|
||||
post_gradlew = run.setdefault("post-gradlew", [])
|
||||
|
||||
@@ -25,15 +25,15 @@ task-defaults:
|
||||
tests-artifact-template:
|
||||
type: directory
|
||||
name: public/reports/tests
|
||||
path: '/builds/worker/checkouts/gecko/mobile/android/android-components/{component_path}/build/reports/tests'
|
||||
path: '/builds/worker/workspace/obj-build/gradle/build/mobile/android/android-components/{component_path}/reports/tests'
|
||||
lint-artifact-template:
|
||||
type: file
|
||||
name: public/reports/lint-results-release.html
|
||||
path: '/builds/worker/checkouts/gecko/mobile/android/android-components/{component_path}/build/reports/lint-results-release.html'
|
||||
path: '/builds/worker/workspace/obj-build/gradle/build/mobile/android/android-components/{component_path}/reports/lint-results-release.html'
|
||||
jacoco-coverage-template:
|
||||
type: directory
|
||||
name: public/reports/jacoco
|
||||
path: '/builds/worker/checkouts/gecko/mobile/android/android-components/{component_path}/build/reports/jacoco'
|
||||
path: '/builds/worker/workspace/obj-build/gradle/build/mobile/android/android-components/{component_path}/reports/jacoco'
|
||||
description: Execute Gradle tasks for component "{component}"
|
||||
fetches:
|
||||
toolchain:
|
||||
|
||||
Reference in New Issue
Block a user