Bug 1822393 - Support Android Components consuming GeckoView directly. r=nalexander...
[gecko.git] / mobile / android / android-components / components / browser / engine-gecko / build.gradle
blob1eef5ef762e670e76a14b4d8d15abb635f2ced9f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 buildscript {
6     repositories {
7         maven {
8             url "https://maven.mozilla.org/maven2"
9         }
10     }
12     dependencies {
13         classpath "${ApplicationServicesConfig.groupId}:tooling-nimbus-gradle:${ApplicationServicesConfig.version}"
14         classpath "org.mozilla.telemetry:glean-gradle-plugin:${Versions.mozilla_glean}"
15     }
18 plugins {
19     id "com.jetbrains.python.envs" version "$python_envs_plugin"
22 apply plugin: 'com.android.library'
23 apply plugin: 'kotlin-android'
25 android {
26     defaultConfig {
27         minSdkVersion config.minSdkVersion
28         compileSdk config.compileSdkVersion
29         targetSdkVersion config.targetSdkVersion
30         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
31     }
33     buildTypes {
34         release {
35             minifyEnabled false
36             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37         }
38     }
40     packagingOptions {
41         resources {
42             excludes += ['META-INF/proguard/androidx-annotations.pro']
43         }
44     }
46     buildFeatures {
47         buildConfig true
48     }
50     namespace  'mozilla.components.browser.engine.gecko'
53 // Set configuration for the Glean parser to extract metrics.yaml
54 // file from AAR dependencies of this project rather than look
55 // for it into the project directory.
56 ext.allowMetricsFromAAR = true
58 dependencies {
59     implementation project(':concept-engine')
60     implementation project(':concept-fetch')
61     implementation project(':support-ktx')
62     implementation project(':support-utils')
63     implementation(project(':service-nimbus')) {
64         exclude group: 'org.mozilla.telemetry', module: 'glean-native'
65     }
66     implementation ComponentsDependencies.kotlin_coroutines
68     if (findProject(":geckoview") != null) {
69         api project(':geckoview')
70     } else {
71         api ComponentsDependencies.mozilla_geckoview
72     }
74     implementation ComponentsDependencies.androidx_paging
75     implementation ComponentsDependencies.androidx_data_store_preferences
76     implementation ComponentsDependencies.androidx_lifecycle_livedata
78     testImplementation ComponentsDependencies.androidx_test_core
79     testImplementation ComponentsDependencies.androidx_test_junit
80     testImplementation ComponentsDependencies.testing_robolectric
81     testImplementation ComponentsDependencies.testing_coroutines
82     testImplementation ComponentsDependencies.testing_mockwebserver
83     testImplementation project(':support-test')
84     testImplementation project(':tooling-fetch-tests')
86     // We only compile against Glean. It's up to the app to add those dependencies
87     // if it wants to collect GeckoView telemetry through the Glean SDK.
88     compileOnly project(":service-glean")
89     testImplementation project(":service-glean")
90     testImplementation ComponentsDependencies.androidx_work_testing
92     androidTestImplementation ComponentsDependencies.androidx_test_core
93     androidTestImplementation ComponentsDependencies.androidx_test_runner
94     androidTestImplementation ComponentsDependencies.androidx_test_rules
95     androidTestImplementation project(':tooling-fetch-tests')
98 apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
99 apply from: '../../../android-lint.gradle'
100 apply from: '../../../publish.gradle'
101 apply plugin: "org.mozilla.appservices.nimbus-gradle-plugin"
102 nimbus {
103     // The path to the Nimbus feature manifest file
104     manifestFile = "geckoview.fml.yaml"
106     channels = [
107             debug: "debug",
108             release: "release",
109     ]
111     // This is an optional value, and updates the plugin to use a copy of application
112     // services. The path should be relative to the root project directory.
113     // *NOTE*: This example will not work for all projects, but should work for Fenix, Focus, and Android Components
114     applicationServicesDir = gradle.hasProperty('localProperties.autoPublish.application-services.dir')
115             ? gradle.getProperty('localProperties.autoPublish.application-services.dir') : null
117 ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)