From 885dd1d4d5e38991df55c433486534de7999aff5 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik <ryan.pavlik@collabora.com> Date: Thu, 12 Nov 2020 17:18:25 -0600 Subject: [PATCH] gradle: Handle kotlin in multiple parts of the build --- build.gradle | 4 ++++ src/xrt/auxiliary/android/build.gradle | 10 +++++++++- src/xrt/ipc/android/build.gradle | 3 +++ src/xrt/targets/openxr_android/build.gradle | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8a8d94ab6..c215eff55 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,8 @@ buildscript { androidxLifecycleVersion = "2.2.0" androidxConstraintLayoutVersion = '2.0.4' + hiltVersion = "2.29.1-alpha" + // Saw some breakage when updating to 1.2? materialVersion = "1.1.0" } @@ -25,6 +27,8 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}" classpath 'com.quittle:svg-2-android-vector:0.0.5' + classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion" + } } plugins { diff --git a/src/xrt/auxiliary/android/build.gradle b/src/xrt/auxiliary/android/build.gradle index a8ccb1dda..09adeff78 100644 --- a/src/xrt/auxiliary/android/build.gradle +++ b/src/xrt/auxiliary/android/build.gradle @@ -1,7 +1,10 @@ // Copyright 2020, Collabora, Ltd. // SPDX-License-Identifier: BSL-1.0 -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'kotlin-android' +} android { compileSdkVersion project.sharedTargetSdk @@ -27,8 +30,13 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + packagingOptions { + exclude("META-INF/*.kotlin_module") + } } dependencies { implementation "androidx.annotation:annotation:$androidxAnnotationVersion" + implementation "androidx.core:core-ktx:$androidxCoreVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" } diff --git a/src/xrt/ipc/android/build.gradle b/src/xrt/ipc/android/build.gradle index e55a85abe..c9cd398b6 100644 --- a/src/xrt/ipc/android/build.gradle +++ b/src/xrt/ipc/android/build.gradle @@ -39,6 +39,9 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + packagingOptions { + exclude("META-INF/*.kotlin_module") + } } dependencies { diff --git a/src/xrt/targets/openxr_android/build.gradle b/src/xrt/targets/openxr_android/build.gradle index fd8da9bbf..e4fa3ffde 100644 --- a/src/xrt/targets/openxr_android/build.gradle +++ b/src/xrt/targets/openxr_android/build.gradle @@ -122,6 +122,9 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + packagingOptions { + exclude("META-INF/*.kotlin_module") + } }