From 8d9bd5f4fa8934efd6f7968ae80fe4a6af05725c Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 30 Mar 2020 18:05:26 -0700 Subject: [PATCH] Fix flavor dependencies, introduce flavors for filament-utils --- README.md | 7 ++-- android/filamat-android/gradle.properties | 2 +- android/filament-utils-android/build.gradle | 37 ++++++++++++++----- .../filament-utils-android/gradle.properties | 3 +- build.sh | 14 ++++--- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 449e696aa2..e42710e5cc 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,12 @@ Here are all the libraries available in the group `com.google.android.filament`: - `filament-android`: the Filament rendering engine itself - `gltfio-android`: a glTF 2.0 loader for Filament, depends on `filament-android` -- `gltfio-android-lite`: trimmed version of gltfio that does not support some glTF features +- `gltfio-android-lite`: trimmed version of `gltfio` that does not support some glTF features - `filament-utils-android`: KTX loading, Kotlin math, and camera utilities, depends on `gltfio-android` -- `filamat-android-full`: a runtime material builder/compiler. This library is large but contains +- `filament-utils-lite-android`: trimmed version of `filament-utils` that does not support some glTF features +- `filamat-android`: a runtime material builder/compiler. This library is large but contains a full shader compiler/validator/optimizer -- `filamat-android-lite`: a much smaller alternative to `filamat-android-full` that can only +- `filamat-android-lite`: a much smaller alternative to `filamat-android` that can only generate OpenGL shaders. It does not provide validation or optimizations ### Snapshots diff --git a/android/filamat-android/gradle.properties b/android/filamat-android/gradle.properties index 039eb832b9..8a0dd1adbb 100644 --- a/android/filamat-android/gradle.properties +++ b/android/filamat-android/gradle.properties @@ -1,4 +1,4 @@ POM_NAME=Filament Material Builder -POM_ARTIFACT_ID_FULL=filamat-android-full +POM_ARTIFACT_ID_FULL=filamat-android POM_ARTIFACT_ID_LITE=filamat-android-lite POM_PACKAGING=aar diff --git a/android/filament-utils-android/build.gradle b/android/filament-utils-android/build.gradle index 9f1eadf782..802a53bbd2 100644 --- a/android/filament-utils-android/build.gradle +++ b/android/filament-utils-android/build.gradle @@ -19,11 +19,15 @@ android { } } - // The gltfio library has two variants: full and lite. Here we default to the "full" variant. - // Replace "full" with "lite" to use the gltfio-lite variant, which has a smaller binary size - // but comes with certain restrictions. - defaultConfig { - missingDimensionStrategy 'functionality', 'full' + flavorDimensions "functionality" + productFlavors { + full { + dimension "functionality" + } + + lite { + dimension "functionality" + } } externalNativeBuild { @@ -54,11 +58,21 @@ android { } } +configurations.all { + resolutionStrategy { + dependencySubstitution { + substitute(module("com.google.android.filament:gltfio-android-full")).with(project(":gltfio-android")) + substitute(module("com.google.android.filament:gltfio-android-lite")).with(project(":gltfio-android")) + } + } +} + dependencies { implementation deps.kotlin implementation deps.androidx.annotations implementation project(':filament-android') - implementation project(':gltfio-android') + fullImplementation module("com.google.android.filament:gltfio-android-full") + liteImplementation module("com.google.android.filament:gltfio-android-lite") } apply from: rootProject.file('gradle/gradle-mvn-push.gradle') @@ -66,9 +80,14 @@ apply from: rootProject.file('gradle/gradle-mvn-push.gradle') afterEvaluate { project -> publishing { publications { - release(MavenPublication) { - artifactId = POM_ARTIFACT_ID - from components.release + fullRelease(MavenPublication) { + artifactId = POM_ARTIFACT_ID_FULL + from components.fullRelease + } + + liteRelease(MavenPublication) { + artifactId = POM_ARTIFACT_ID_LITE + from components.liteRelease } } } diff --git a/android/filament-utils-android/gradle.properties b/android/filament-utils-android/gradle.properties index 9be5582656..e86385fc61 100644 --- a/android/filament-utils-android/gradle.properties +++ b/android/filament-utils-android/gradle.properties @@ -1,3 +1,4 @@ POM_NAME=Filament Android Utilities -POM_ARTIFACT_ID=filament-utils-android +POM_ARTIFACT_ID_FULL=filament-utils-android +POM_ARTIFACT_ID_LITE=filament-utils-android-lite POM_PACKAGING=aar diff --git a/build.sh b/build.sh index 650e168884..5829a9db50 100755 --- a/build.sh +++ b/build.sh @@ -389,18 +389,19 @@ function build_android { if [[ "$INSTALL_COMMAND" ]]; then echo "Installing out/filamat-android-debug.aar..." - cp filamat-android/build/outputs/aar/filamat-android-full-debug.aar ../out/ cp filamat-android/build/outputs/aar/filamat-android-lite-debug.aar ../out/ + cp filamat-android/build/outputs/aar/filamat-android-full-debug.aar ../out/filamat-android-debug.aar echo "Installing out/filament-android-debug.aar..." cp filament-android/build/outputs/aar/filament-android-debug.aar ../out/ - echo "Installing out/gltfio-android-*-debug.aar..." + echo "Installing out/gltfio-android-debug.aar..." cp gltfio-android/build/outputs/aar/gltfio-android-lite-debug.aar ../out/ cp gltfio-android/build/outputs/aar/gltfio-android-full-debug.aar ../out/gltfio-android-debug.aar echo "Installing out/filament-utils-android-debug.aar..." - cp filament-utils-android/build/outputs/aar/filament-utils-android-debug.aar ../out/ + cp filament-utils-android/build/outputs/aar/filament-utils-android-lite-debug.aar ../out/ + cp filament-utils-android/build/outputs/aar/filament-utils-android-full-debug.aar ../out/filament-utils-android-debug.aar fi fi @@ -418,18 +419,19 @@ function build_android { if [[ "$INSTALL_COMMAND" ]]; then echo "Installing out/filamat-android-release.aar..." - cp filamat-android/build/outputs/aar/filamat-android-full-release.aar ../out/ cp filamat-android/build/outputs/aar/filamat-android-lite-release.aar ../out/ + cp filamat-android/build/outputs/aar/filamat-android-full-release.aar ../out/filamat-android-release.aar echo "Installing out/filament-android-release.aar..." cp filament-android/build/outputs/aar/filament-android-release.aar ../out/ - echo "Installing out/gltfio-android-*-release.aar..." + echo "Installing out/gltfio-android-release.aar..." cp gltfio-android/build/outputs/aar/gltfio-android-lite-release.aar ../out/ cp gltfio-android/build/outputs/aar/gltfio-android-full-release.aar ../out/gltfio-android-release.aar echo "Installing out/filament-utils-android-release.aar..." - cp filament-utils-android/build/outputs/aar/filament-utils-android-release.aar ../out/ + cp filament-utils-android/build/outputs/aar/filament-utils-android-lite-release.aar ../out/ + cp filament-utils-android/build/outputs/aar/filament-utils-android-full-release.aar ../out/filament-utils-android-release.aar fi fi