summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/components/browser/engine-gecko/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/android-components/components/browser/engine-gecko/build.gradle')
-rw-r--r--mobile/android/android-components/components/browser/engine-gecko/build.gradle193
1 files changed, 193 insertions, 0 deletions
diff --git a/mobile/android/android-components/components/browser/engine-gecko/build.gradle b/mobile/android/android-components/components/browser/engine-gecko/build.gradle
new file mode 100644
index 0000000000..4e5c2fda65
--- /dev/null
+++ b/mobile/android/android-components/components/browser/engine-gecko/build.gradle
@@ -0,0 +1,193 @@
+/* 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/. */
+
+buildscript {
+ repositories {
+ gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
+ maven {
+ url repository
+ if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
+ allowInsecureProtocol = true
+ }
+ }
+ }
+ }
+
+ dependencies {
+ classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
+ classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
+ }
+}
+
+plugins {
+ id "com.jetbrains.python.envs" version "$python_envs_plugin"
+}
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+android {
+ defaultConfig {
+ minSdkVersion config.minSdkVersion
+ compileSdk config.compileSdkVersion
+ targetSdkVersion config.targetSdkVersion
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ packagingOptions {
+ resources {
+ excludes += ['META-INF/proguard/androidx-annotations.pro']
+ }
+ }
+
+ buildFeatures {
+ buildConfig true
+ }
+
+ namespace 'mozilla.components.browser.engine.gecko'
+}
+
+// Set configuration for the Glean parser to extract metrics.yaml
+// file from AAR dependencies of this project rather than look
+// for it into the project directory.
+ext.allowMetricsFromAAR = true
+
+dependencies {
+ implementation project(':concept-engine')
+ implementation project(':concept-fetch')
+ implementation project(':support-ktx')
+ implementation project(':support-utils')
+ implementation(project(':service-nimbus')) {
+ exclude group: 'org.mozilla.telemetry', module: 'glean-native'
+ }
+ implementation ComponentsDependencies.kotlin_coroutines
+
+ if (findProject(":geckoview") != null) {
+ api project(':geckoview')
+ } else {
+ api getGeckoViewDependency()
+ }
+
+ implementation ComponentsDependencies.androidx_paging
+ implementation ComponentsDependencies.androidx_data_store_preferences
+ implementation ComponentsDependencies.androidx_lifecycle_livedata
+
+ testImplementation ComponentsDependencies.androidx_test_core
+ testImplementation ComponentsDependencies.androidx_test_junit
+ testImplementation ComponentsDependencies.testing_robolectric
+ testImplementation ComponentsDependencies.testing_coroutines
+ testImplementation ComponentsDependencies.testing_mockwebserver
+ testImplementation project(':support-test')
+ testImplementation project(':tooling-fetch-tests')
+
+ // We only compile against Glean. It's up to the app to add those dependencies
+ // if it wants to collect GeckoView telemetry through the Glean SDK.
+ compileOnly project(":service-glean")
+ testImplementation project(":service-glean")
+ testImplementation ComponentsDependencies.androidx_work_testing
+
+ androidTestImplementation ComponentsDependencies.androidx_test_core
+ androidTestImplementation ComponentsDependencies.androidx_test_runner
+ androidTestImplementation ComponentsDependencies.androidx_test_rules
+ androidTestImplementation project(':tooling-fetch-tests')
+}
+
+apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
+apply from: '../../../android-lint.gradle'
+apply from: '../../../publish.gradle'
+apply plugin: "org.mozilla.appservices.nimbus-gradle-plugin"
+nimbus {
+ // The path to the Nimbus feature manifest file
+ manifestFile = "geckoview.fml.yaml"
+
+ channels = [
+ debug: "debug",
+ release: "release",
+ ]
+
+ // This is an optional value, and updates the plugin to use a copy of application
+ // services. The path should be relative to the root project directory.
+ // *NOTE*: This example will not work for all projects, but should work for Fenix, Focus, and Android Components
+ applicationServicesDir = gradle.hasProperty('localProperties.autoPublish.application-services.dir')
+ ? gradle.getProperty('localProperties.autoPublish.application-services.dir') : null
+}
+ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)
+
+// Non-official versions are like "61.0a1", where "a1" is the milestone.
+// This simply strips that off, leaving "61.0" in this example.
+def getAppVersionWithoutMilestone() {
+ return gradle.mozconfig.substs.MOZ_APP_VERSION.replaceFirst(/a[0-9]/, "")
+}
+
+// Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
+def getBuildId() {
+ if (System.env.MOZ_BUILD_DATE) {
+ if (System.env.MOZ_BUILD_DATE.length() == 14) {
+ return System.env.MOZ_BUILD_DATE
+ }
+ logger.warn("Ignoring invalid MOZ_BUILD_DATE: ${System.env.MOZ_BUILD_DATE}")
+ }
+ return file("${gradle.mozconfig.topobjdir}/buildid.h").getText('utf-8').split()[2]
+}
+
+def getVersionNumber() {
+ def appVersion = getAppVersionWithoutMilestone()
+ def parts = appVersion.split('\\.')
+ def version = parts[0] + "." + parts[1] + "." + getBuildId()
+
+ if (!gradle.mozconfig.substs.MOZILLA_OFFICIAL && !gradle.mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
+ // Use -SNAPSHOT versions locally to enable the local GeckoView substitution flow.
+ version += "-SNAPSHOT"
+ }
+
+ return version
+}
+
+def getArtifactSuffix() {
+ def suffix = ""
+
+ // Release artifacts don't specify the channel, for the sake of simplicity.
+ if (gradle.mozconfig.substs.MOZ_UPDATE_CHANNEL != 'release') {
+ suffix += "-${gradle.mozconfig.substs.MOZ_UPDATE_CHANNEL}"
+ }
+
+ return suffix
+}
+
+def getArtifactId() {
+ def id = "geckoview" + getArtifactSuffix()
+
+ if (!gradle.mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE) {
+ id += "-omni"
+ }
+
+ if (gradle.mozconfig.substs.MOZILLA_OFFICIAL && !gradle.mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
+ // In automation, per-architecture artifacts identify
+ // the architecture; multi-architecture artifacts don't.
+ // When building locally, we produce a "skinny AAR" with
+ // one target architecture masquerading as a "fat AAR"
+ // to enable Gradle composite builds to substitute this
+ // project into consumers easily.
+ id += "-${gradle.mozconfig.substs.ANDROID_CPU_ARCH}"
+ }
+
+ return id
+}
+
+def getGeckoViewDependency() {
+ // on try, relax geckoview version pin to allow for --use-existing-task
+ if ('https://hg.mozilla.org/try' == System.env.GECKO_HEAD_REPOSITORY) {
+ rootProject.logger.lifecycle("Getting geckoview on try: ${getArtifactId()}:+")
+ return "org.mozilla.geckoview:${getArtifactId()}:+"
+ }
+ rootProject.logger.lifecycle("Getting geckoview: ${getArtifactId()}:${getVersionNumber()}")
+ return "org.mozilla.geckoview:${getArtifactId()}:${getVersionNumber()}"
+}