forked from mozilla-mobile/android-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
83 lines (67 loc) · 3.47 KB
/
Copy pathbuild.gradle
File metadata and controls
83 lines (67 loc) · 3.47 KB
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
/* 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/. */
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion config.compileSdkVersion
defaultConfig {
minSdkVersion config.minSdkVersion
targetSdkVersion config.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations {
// There's an interaction between Gradle's resolution of dependencies with different types
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
// what's happening is that @aar type in `implementation` resolves to the @jar type in
// `testImplementation`, and that it wins the dependency resolution battle.
//
// A workaround is to add a new configuration which depends on the @jar type and to reference
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
// Success!
jnaForTest
// Robolectric, through `com.google.android.apps.common.testing.accessibility.framework`
// depends on an old version of protobuf that conflict with the Application Services one.
// See: https://github.com/mozilla/application-services/issues/2952
all*.exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
dependencies {
// These dependencies are part of this module's public API.
api(Dependencies.mozilla_places) {
// Use our own version of the Glean dependency,
// which might be different from the version declared by A-S.
exclude group: 'org.mozilla.components', module: 'service-glean'
}
api Dependencies.mozilla_remote_tabs
api project(':concept-storage')
api project(':concept-sync')
implementation project(':support-utils')
implementation project(':support-sync-telemetry')
implementation Dependencies.kotlin_stdlib
testImplementation project(':support-test')
testImplementation Dependencies.androidx_test_core
testImplementation Dependencies.androidx_test_junit
testImplementation Dependencies.testing_robolectric
testImplementation Dependencies.testing_mockito
jnaForTest Dependencies.thirdparty_jna
testImplementation files(configurations.jnaForTest.copyRecursive().files)
testImplementation Dependencies.mozilla_places
testImplementation Dependencies.mozilla_remote_tabs
testImplementation Dependencies.testing_mockwebserver
testImplementation Dependencies.mozilla_full_megazord_forUnitTests
testImplementation Dependencies.mozilla_glean_forUnitTests
}
apply from: '../../../publish.gradle'
ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)