forked from mirrors/gecko-dev
This is effectively a no-op because we're already picking it up implicitly from other AC modules, but it's better to be explicit to avoid unexpected problems down the road if that situation happens to change. Differential Revision: https://phabricator.services.mozilla.com/D208009
194 lines
7.1 KiB
Groovy
194 lines
7.1 KiB
Groovy
/* 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_core_ktx
|
|
implementation ComponentsDependencies.androidx_paging
|
|
implementation ComponentsDependencies.androidx_datastore_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()}"
|
|
}
|