diff --git a/build.gradle b/build.gradle index 1b83703bdb7b..e8faf444b7f9 100644 --- a/build.gradle +++ b/build.gradle @@ -201,6 +201,8 @@ allprojects { } } +buildDir "${topobjdir}/gradle/build" + import org.gradle.api.services.BuildServiceParameters abstract class MozconfigService implements BuildService, AutoCloseable { interface Params extends BuildServiceParameters { diff --git a/mobile/android/android-components/plugins/config/build.gradle b/mobile/android/android-components/plugins/config/build.gradle index f1ad8dcd3446..e4302437d731 100644 --- a/mobile/android/android-components/plugins/config/build.gradle +++ b/mobile/android/android-components/plugins/config/build.gradle @@ -6,8 +6,6 @@ plugins { id "org.gradle.kotlin.kotlin-dsl" version "5.1.2" } -buildDir "${gradle.mozconfig.topobjdir}/gradle/build/mobile/android/android-components/plugins/config" - repositories { gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository -> maven { diff --git a/mobile/android/android-components/plugins/dependencies/build.gradle b/mobile/android/android-components/plugins/dependencies/build.gradle index 957c42c06d42..c9866094ec44 100644 --- a/mobile/android/android-components/plugins/dependencies/build.gradle +++ b/mobile/android/android-components/plugins/dependencies/build.gradle @@ -6,8 +6,6 @@ plugins { id "org.gradle.kotlin.kotlin-dsl" version "5.1.2" } -buildDir "${gradle.mozconfig.topobjdir}/gradle/build/mobile/android/android-components/plugins/dependencies" - repositories { gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository -> maven { diff --git a/mobile/android/android-components/plugins/publicsuffixlist/build.gradle b/mobile/android/android-components/plugins/publicsuffixlist/build.gradle index 65a2fadca09f..3a0f23008a89 100644 --- a/mobile/android/android-components/plugins/publicsuffixlist/build.gradle +++ b/mobile/android/android-components/plugins/publicsuffixlist/build.gradle @@ -6,8 +6,6 @@ plugins { id "org.gradle.kotlin.kotlin-dsl" version "5.1.2" } -buildDir "${gradle.mozconfig.topobjdir}/gradle/build/mobile/android/android-components/plugins/publicsuffixlist" - repositories { gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository -> maven { diff --git a/mobile/android/android-components/samples/browser/build.gradle b/mobile/android/android-components/samples/browser/build.gradle index 9d6d8488ab38..af390933ab0a 100644 --- a/mobile/android/android-components/samples/browser/build.gradle +++ b/mobile/android/android-components/samples/browser/build.gradle @@ -7,6 +7,10 @@ plugins { alias(libs.plugins.kotlin.compose) } +if (findProject(":geckoview") != null) { + buildDir "${topobjdir}/gradle/build/mobile/android/samples-browser" +} + apply plugin: 'com.android.application' android { diff --git a/mobile/android/annotations/build.gradle b/mobile/android/annotations/build.gradle index 1afdde715f15..8c1b6685be38 100644 --- a/mobile/android/annotations/build.gradle +++ b/mobile/android/annotations/build.gradle @@ -1,3 +1,5 @@ +buildDir "${topobjdir}/gradle/build/mobile/android/annotations" + apply plugin: 'java' dependencies { diff --git a/mobile/android/docs/fenix.rst b/mobile/android/docs/fenix.rst index c687e4bdf70b..b71c23d2d7c9 100644 --- a/mobile/android/docs/fenix.rst +++ b/mobile/android/docs/fenix.rst @@ -32,7 +32,7 @@ From the root mozilla-central directory, build Fenix: ./mach gradle clean fenix:assembleDebug You can then find the generated debug apks in objdir under -``gradle/build/mobile/android/fenix/app/outputs/apk/fenix/debug`` +``gradle/build/mobile/android/fenix/outputs/apk/fenix/debug`` To sign your release builds with your debug key automatically, add the following to `/local.properties`: diff --git a/mobile/android/examples/messaging_example/app/build.gradle b/mobile/android/examples/messaging_example/app/build.gradle index 999d4751bac1..1a66cced7f26 100644 --- a/mobile/android/examples/messaging_example/app/build.gradle +++ b/mobile/android/examples/messaging_example/app/build.gradle @@ -2,6 +2,8 @@ plugins { alias(libs.plugins.kotlin.android) } +buildDir "${topobjdir}/gradle/build/mobile/android/examples/messaging_example" + apply plugin: 'com.android.application' android { diff --git a/mobile/android/examples/port_messaging_example/app/build.gradle b/mobile/android/examples/port_messaging_example/app/build.gradle index 5d792a5e1e85..b6c5250bee0c 100644 --- a/mobile/android/examples/port_messaging_example/app/build.gradle +++ b/mobile/android/examples/port_messaging_example/app/build.gradle @@ -2,6 +2,8 @@ plugins { alias(libs.plugins.kotlin.android) } +buildDir "${topobjdir}/gradle/build/mobile/android/examples/port_messaging_example" + apply plugin: 'com.android.application' android { diff --git a/mobile/android/exoplayer2/build.gradle b/mobile/android/exoplayer2/build.gradle index e58953297194..8f52dc5d1bc3 100644 --- a/mobile/android/exoplayer2/build.gradle +++ b/mobile/android/exoplayer2/build.gradle @@ -1,3 +1,5 @@ +buildDir "${topobjdir}/gradle/build/mobile/android/exoplayer2" + apply plugin: 'com.android.library' dependencies { diff --git a/mobile/android/fenix/app/build.gradle b/mobile/android/fenix/app/build.gradle index 80208ed8e3bd..56d09f45220f 100644 --- a/mobile/android/fenix/app/build.gradle +++ b/mobile/android/fenix/app/build.gradle @@ -25,6 +25,10 @@ plugins { id "com.google.protobuf" version "$protobuf_plugin" } +if (findProject(":geckoview") != null) { + buildDir "${topobjdir}/gradle/build/mobile/android/fenix" +} + apply plugin: 'com.android.application' apply plugin: 'kotlin-parcelize' apply plugin: 'jacoco' diff --git a/mobile/android/fenix/plugins/apksize/build.gradle b/mobile/android/fenix/plugins/apksize/build.gradle index 04ed51f995d5..f253620622bb 100644 --- a/mobile/android/fenix/plugins/apksize/build.gradle +++ b/mobile/android/fenix/plugins/apksize/build.gradle @@ -6,8 +6,6 @@ plugins { id "org.gradle.kotlin.kotlin-dsl" version "5.1.2" } -buildDir "${gradle.mozconfig.topobjdir}/gradle/build/mobile/android/fenix/plugins/apksize" - repositories { gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository -> maven { diff --git a/mobile/android/focus-android/app/build.gradle b/mobile/android/focus-android/app/build.gradle index 45facba394db..a9b971db360f 100644 --- a/mobile/android/focus-android/app/build.gradle +++ b/mobile/android/focus-android/app/build.gradle @@ -4,6 +4,10 @@ plugins { id "com.jetbrains.python.envs" version "$python_envs_plugin" } +if (findProject(":geckoview") != null) { + buildDir "${topobjdir}/gradle/build/mobile/android/focus-android" +} + apply plugin: 'com.android.application' apply plugin: 'kotlin-parcelize' apply plugin: 'jacoco' diff --git a/mobile/android/geckoview/build.gradle b/mobile/android/geckoview/build.gradle index e73c4df96b22..a36de64443e2 100644 --- a/mobile/android/geckoview/build.gradle +++ b/mobile/android/geckoview/build.gradle @@ -2,6 +2,8 @@ plugins { alias(libs.plugins.kotlin.android) } +buildDir "${topobjdir}/gradle/build/mobile/android/geckoview" + import groovy.json.JsonOutput apply plugin: 'com.android.library' diff --git a/mobile/android/geckoview_example/build.gradle b/mobile/android/geckoview_example/build.gradle index dd372ddefb3f..9b0549404720 100644 --- a/mobile/android/geckoview_example/build.gradle +++ b/mobile/android/geckoview_example/build.gradle @@ -2,6 +2,8 @@ plugins { alias(libs.plugins.kotlin.android) } +buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example" + apply plugin: 'com.android.application' android { diff --git a/mobile/android/shared-settings.gradle b/mobile/android/shared-settings.gradle index 8115c320140f..442f3039b677 100644 --- a/mobile/android/shared-settings.gradle +++ b/mobile/android/shared-settings.gradle @@ -177,29 +177,4 @@ gradle.projectsLoaded { -> } } } - - // If we are doing a top-level build, initialize all project buildDirs to be - // in ${topobjdir} to follow conventions of mozilla-central build system. - // Specific subproject builds like fenix continue to build in source tree to - // avoiding breaking existing automation. - if (findProject(":geckoview") != null) { - 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) - - 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) - } - } - } } diff --git a/mobile/android/test_runner/build.gradle b/mobile/android/test_runner/build.gradle index b78e8e8d90ca..4cb589a7d162 100644 --- a/mobile/android/test_runner/build.gradle +++ b/mobile/android/test_runner/build.gradle @@ -2,6 +2,8 @@ plugins { alias(libs.plugins.kotlin.android) } +buildDir "${topobjdir}/gradle/build/mobile/android/test_runner" + apply plugin: 'com.android.application' android { diff --git a/taskcluster/kinds/build/fenix.yml b/taskcluster/kinds/build/fenix.yml index b1885f78f07e..e987d5bbc636 100644 --- a/taskcluster/kinds/build/fenix.yml +++ b/taskcluster/kinds/build/fenix.yml @@ -50,7 +50,7 @@ android-aarch64-fenix/debug: TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest" artifacts: - name: public/build/fenix.apk - path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/debug/fenix-fenix-arm64-v8a-debug.apk + path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/fenix/outputs/apk/fenix/debug/fenix-fenix-x86-debug.apk type: file run: custom-build-variant-cfg: aarch64-fenix-debug