Skip to content

Commit 92c1b9e

Browse files
rvandermeulenmergify[bot]
authored andcommitted
Bug 1823532 - Remove jnaForTest from project Gradle build files.
Also remove the now-unneeded jna dependency inclusion.
1 parent 281ee0b commit 92c1b9e

File tree

7 files changed

+0
-85
lines changed

7 files changed

+0
-85
lines changed

android-components/build.gradle

-22
Original file line numberDiff line numberDiff line change
@@ -245,28 +245,6 @@ subprojects {
245245
}
246246
}
247247

248-
configurations {
249-
// There's an interaction between Gradle's resolution of dependencies with different types
250-
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
251-
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
252-
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
253-
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
254-
// what's happening is that @aar type in `implementation` resolves to the @jar type in
255-
// `testImplementation`, and that it wins the dependency resolution battle.
256-
//
257-
// A workaround is to add a new configuration which depends on the @jar type and to reference
258-
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
259-
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
260-
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
261-
// Success!
262-
jnaForTest
263-
}
264-
265-
dependencies {
266-
jnaForTest ComponentsDependencies.thirdparty_jna
267-
testImplementation files(configurations.jnaForTest.copyRecursive().files)
268-
}
269-
270248
if (project.hasProperty("coverage") && project.name != "support-test") {
271249
android.buildTypes.all { buildType ->
272250
tasks.withType(Test).configureEach() {

android-components/components/service/glean/build.gradle

-17
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,6 @@ android {
2323
namespace 'mozilla.components.service.glean'
2424
}
2525

26-
configurations {
27-
// There's an interaction between Gradle's resolution of dependencies with different types
28-
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
29-
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
30-
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
31-
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
32-
// what's happening is that @aar type in `implementation` resolves to the @jar type in
33-
// `testImplementation`, and that it wins the dependency resolution battle.
34-
//
35-
// A workaround is to add a new configuration which depends on the @jar type and to reference
36-
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
37-
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
38-
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
39-
// Success!
40-
jnaForTest
41-
}
42-
4326
// Define library names and version constants.
4427
String GLEAN_LIBRARY = "org.mozilla.telemetry:glean:${Versions.mozilla_glean}"
4528
String GLEAN_LIBRARY_FORUNITTESTS = "org.mozilla.telemetry:glean-native-forUnitTests:${Versions.mozilla_glean}"

android-components/plugins/dependencies/src/main/java/DependenciesPlugin.kt

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ object Versions {
3939
// zxing 3.4+ requires a minimum API of 24 or higher
4040
const val zxing = "3.3.3"
4141

42-
const val jna = "5.13.0"
4342
const val disklrucache = "2.0.2"
4443
const val leakcanary = "2.10"
4544

@@ -197,7 +196,6 @@ object ComponentsDependencies {
197196
const val thirdparty_okhttp_urlconnection = "com.squareup.okhttp3:okhttp-urlconnection:${Versions.okhttp}"
198197
const val thirdparty_sentry_latest = "io.sentry:sentry-android:${Versions.sentry_latest}"
199198
const val thirdparty_zxing = "com.google.zxing:core:${Versions.zxing}"
200-
const val thirdparty_jna = "net.java.dev.jna:jna:${Versions.jna}@jar"
201199
const val thirdparty_disklrucache = "com.jakewharton:disklrucache:${Versions.disklrucache}"
202200

203201
const val firebase_messaging = "com.google.firebase:firebase-messaging:${Versions.Firebase.messaging}"

fenix/app/build.gradle

-20
Original file line numberDiff line numberDiff line change
@@ -458,33 +458,13 @@ nimbus {
458458
experimenterManifest = ".experimenter.yaml"
459459
}
460460

461-
configurations {
462-
// There's an interaction between Gradle's resolution of dependencies with different types
463-
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
464-
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
465-
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
466-
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
467-
// what's happening is that @aar type in `implementation` resolves to the @jar type in
468-
// `testImplementation`, and that it wins the dependency resolution battle.
469-
//
470-
// A workaround is to add a new configuration which depends on the @jar type and to reference
471-
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
472-
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
473-
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
474-
// Success!
475-
jnaForTest
476-
}
477-
478461
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
479462
kotlinOptions {
480463
freeCompilerArgs += "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
481464
}
482465
}
483466

484467
dependencies {
485-
jnaForTest FenixDependencies.jna
486-
testImplementation files(configurations.jnaForTest.copyRecursive().files)
487-
488468
implementation project(':browser-engine-gecko')
489469

490470
implementation FenixDependencies.kotlin_coroutines

fenix/buildSrc/src/main/java/FenixDependencies.kt

-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ object FenixVersions {
1818
const val leakcanary = "2.10"
1919
const val osslicenses_plugin = "0.10.4"
2020
const val detekt = "1.19.0"
21-
const val jna = "5.13.0"
2221

2322
const val androidx_activity = "1.6.1"
2423
const val androidx_compose = "1.3.1"
@@ -123,8 +122,6 @@ object FenixDependencies {
123122
const val adjust = "com.adjust.sdk:adjust-android:${FenixVersions.adjust}"
124123
const val installreferrer = "com.android.installreferrer:installreferrer:${FenixVersions.installreferrer}"
125124

126-
const val jna = "net.java.dev.jna:jna:${FenixVersions.jna}@jar"
127-
128125
const val junit = "junit:junit:${FenixVersions.junit}"
129126
const val mockk = "io.mockk:mockk:${FenixVersions.mockk}"
130127
const val mockk_android = "io.mockk:mockk-android:${FenixVersions.mockk}"

focus-android/app/build.gradle

-19
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,6 @@ nimbus {
206206
experimenterManifest = ".experimenter.yaml"
207207
}
208208

209-
configurations {
210-
// There's an interaction between Gradle's resolution of dependencies with different types
211-
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
212-
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
213-
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
214-
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
215-
// what's happening is that @aar type in `implementation` resolves to the @jar type in
216-
// `testImplementation`, and that it wins the dependency resolution battle.
217-
//
218-
// A workaround is to add a new configuration which depends on the @jar type and to reference
219-
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
220-
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
221-
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
222-
// Success!
223-
jnaForTest
224-
}
225-
226209
dependencies {
227210
implementation FocusDependencies.androidx_appcompat
228211
implementation FocusDependencies.androidx_browser
@@ -319,8 +302,6 @@ dependencies {
319302
focusImplementation FocusDependencies.adjust
320303
focusImplementation FocusDependencies.install_referrer // Required by Adjust
321304

322-
jnaForTest FocusDependencies.jna
323-
testImplementation files(configurations.jnaForTest.copyRecursive().files)
324305
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:${project.ext.glean_version}"
325306

326307
testImplementation FocusDependencies.testing_junit_api

focus-android/buildSrc/src/main/java/FocusDependencies.kt

-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ object FocusVersions {
6464
}
6565

6666
object ThirdParty {
67-
const val jna = "5.13.0"
6867
const val leakcanary = "2.10"
6968
const val sentry = "6.15.0"
7069
}
@@ -112,7 +111,6 @@ object FocusDependencies {
112111
const val google_play = "com.google.android.play:core:${FocusVersions.Google.play}"
113112
const val kotlin_gradle_plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${FocusVersions.Gradle.kotlin_plugin}"
114113
const val android_gradle_plugin = "com.android.tools.build:gradle:${FocusVersions.Gradle.android_plugin}"
115-
const val jna = "net.java.dev.jna:jna:${FocusVersions.ThirdParty.jna}@jar"
116114
const val leakcanary = "com.squareup.leakcanary:leakcanary-android-core:${FocusVersions.ThirdParty.leakcanary}"
117115
const val sentry = "io.sentry:sentry-android:${FocusVersions.ThirdParty.sentry}"
118116

0 commit comments

Comments
 (0)