From 1452ce62f4aaa8cf824c4fb1afa32c0ff0ff49eb Mon Sep 17 00:00:00 2001 From: Philip Rideout Date: Tue, 28 Jan 2020 03:55:38 -0800 Subject: [PATCH] Remove srcDirs hack, use packagingOptions / exclude. --- android/filament-utils-android/build.gradle | 13 +++++++++++-- android/gltfio-android/build.gradle | 10 +++++++++- android/samples/sample-gltf-bloom/build.gradle | 2 ++ android/samples/sample-gltf-viewer/build.gradle | 2 ++ android/samples/sample-textured-object/build.gradle | 1 + 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/android/filament-utils-android/build.gradle b/android/filament-utils-android/build.gradle index 9d79cc8300..ca5a2a2223 100644 --- a/android/filament-utils-android/build.gradle +++ b/android/filament-utils-android/build.gradle @@ -31,8 +31,6 @@ android { sourceSets { main { - java.srcDirs += "../filament-android/src/main/java" - java.srcDirs += "../gltfio-android/src/main/java" jni.srcDirs "src/main/cpp" kotlin.srcDirs += "src/main/java" } @@ -42,11 +40,22 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + // No need to package up the following shared libs, which arise as a side effect of our + // externalNativeBuild dependencies. When clients pick and choose from project-level gradle + // dependencies, these shared libs already get pulled in, so we need to avoid the error: + // "More than one file was found with OS independent path ..." + packagingOptions { + exclude 'lib/*/libfilament-jni.so' + exclude 'lib/*/libgltfio-jni.so' + } } dependencies { implementation deps.kotlin implementation deps.androidx.annotations + implementation project(':filament-android') + implementation project(':gltfio-android') } apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/gltfio-android/build.gradle b/android/gltfio-android/build.gradle index 51fff5d70d..4d632bf631 100644 --- a/android/gltfio-android/build.gradle +++ b/android/gltfio-android/build.gradle @@ -29,7 +29,6 @@ android { sourceSets { main { - java.srcDirs += "../filament-android/src/main/java" jni.srcDirs "src/main/cpp" } } @@ -38,10 +37,19 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + + // No need to package up the following shared libs, which arise as a side effect of our + // externalNativeBuild dependencies. When clients pick and choose from project-level gradle + // dependencies, these shared libs already get pulled in, so we need to avoid the error: + // "More than one file was found with OS independent path ..." + packagingOptions { + exclude 'lib/*/libfilament-jni.so' + } } dependencies { implementation deps.androidx.annotations + implementation project(':filament-android') } apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/android/samples/sample-gltf-bloom/build.gradle b/android/samples/sample-gltf-bloom/build.gradle index 50fd2eaca9..1b464956a2 100644 --- a/android/samples/sample-gltf-bloom/build.gradle +++ b/android/samples/sample-gltf-bloom/build.gradle @@ -40,5 +40,7 @@ android { dependencies { implementation deps.kotlin + implementation project(':filament-android') + implementation project(':gltfio-android') implementation project(':filament-utils-android') } diff --git a/android/samples/sample-gltf-viewer/build.gradle b/android/samples/sample-gltf-viewer/build.gradle index 81aa0eb6ba..e4390db952 100644 --- a/android/samples/sample-gltf-viewer/build.gradle +++ b/android/samples/sample-gltf-viewer/build.gradle @@ -37,5 +37,7 @@ android { dependencies { implementation deps.kotlin + implementation project(':filament-android') + implementation project(':gltfio-android') implementation project(':filament-utils-android') } diff --git a/android/samples/sample-textured-object/build.gradle b/android/samples/sample-textured-object/build.gradle index 649b10fdae..7579cd38bd 100644 --- a/android/samples/sample-textured-object/build.gradle +++ b/android/samples/sample-textured-object/build.gradle @@ -35,5 +35,6 @@ android { dependencies { implementation deps.kotlin + implementation project(':filament-android') implementation project(':filament-utils-android') }