Bug 1951190 - Put gradle 'build' folders in TOPOBJDIR for top-level builds. r=android-reviewers,adhingra
For consistency with the rest of the build system, have gradle build folders be created in TOPOBJDR. Put the logic in shared-settings.gradle and apply it to all projects. Existing gradle and taskcluster configuration uses the 'gradle/build' prefix, so continue using that for now. Only apply this when building top-level for now since a fair bit of automation of fenix/focus/a-c projects expects build artifacts in the source directory. Plugins are compiled as "composite builds" so they somewhat exist in their own world. For simplicity, just manually specify the `buildDir` for each plugin. Differential Revision: https://phabricator.services.mozilla.com/D240116
This commit is contained in:
@@ -201,8 +201,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build"
|
||||
|
||||
import org.gradle.api.services.BuildServiceParameters
|
||||
abstract class MozconfigService implements BuildService<MozconfigService.Params>, AutoCloseable {
|
||||
interface Params extends BuildServiceParameters {
|
||||
|
||||
@@ -6,6 +6,8 @@ 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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ 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 {
|
||||
|
||||
@@ -6,6 +6,8 @@ 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 {
|
||||
|
||||
@@ -7,10 +7,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
}
|
||||
|
||||
if (findProject(":geckoview") != null) {
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/samples-browser"
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/annotations"
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -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/outputs/apk/fenix/debug``
|
||||
``gradle/build/mobile/android/fenix/app/outputs/apk/fenix/debug``
|
||||
|
||||
To sign your release builds with your debug key automatically, add the following to `<proj-root>/local.properties`:
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/examples/messaging_example"
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
@@ -2,8 +2,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/examples/port_messaging_example"
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/exoplayer2"
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -25,10 +25,6 @@ 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'
|
||||
|
||||
@@ -6,6 +6,8 @@ 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 {
|
||||
|
||||
@@ -4,10 +4,6 @@ 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'
|
||||
|
||||
@@ -2,8 +2,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
|
||||
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
@@ -2,8 +2,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
@@ -177,4 +177,29 @@ 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build/mobile/android/test_runner"
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
@@ -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/outputs/apk/fenix/debug/fenix-fenix-x86-debug.apk
|
||||
path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/fenix/app/outputs/apk/fenix/debug/fenix-fenix-arm64-v8a-debug.apk
|
||||
type: file
|
||||
run:
|
||||
custom-build-variant-cfg: aarch64-fenix-debug
|
||||
|
||||
Reference in New Issue
Block a user