1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/* 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()}"
}
|