diff --git a/android/build.gradle b/android/build.gradle index 0ea3922804..60534d2253 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,3 +1,5 @@ +import java.nio.file.Paths + // This script accepts the following parameters: // // com.google.android.filament.dist-dir @@ -42,23 +44,31 @@ // buildscript { - def filamentPath = file("../out/android-release/filament").absolutePath - if (project.hasProperty("com.google.android.filament.dist-dir")) { - filamentPath = file(project.property("com.google.android.filament.dist-dir")).absolutePath - } + def path = providers + .gradleProperty("com.google.android.filament.dist-dir") + .forUseAtConfigurationTime().get() + + def directory = objects.fileProperty().fileValue(new File(path)).getAsFile().get() + def filamentPath = directory.absolutePath + // Our CMake scripts require a forward-slash path for the FILAMENT_DIST_DIR // variable, so here we convert the native path to a forward-slash path. filamentPath = filamentPath.replace(File.separator, '/') // Warning: changing this property does not work well with incremental builds. - def excludeVulkan = project.hasProperty("com.google.android.filament.exclude-vulkan") + def excludeVulkan = providers + .gradleProperty("com.google.android.filament.exclude-vulkan") + .forUseAtConfigurationTime() + .isPresent() def abis = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"] - if (project.hasProperty("com.google.android.filament.abis")) { - def newAbis = project.property("com.google.android.filament.abis").split(',') - if (!newAbis.contains("all")) { - abis = newAbis - } + def newAbis = providers + .gradleProperty("com.google.android.filament.abis") + .forUseAtConfigurationTime() + .get() + .split(',') + if (!newAbis.contains("all")) { + abis = newAbis } ext.versions = [ @@ -72,7 +82,7 @@ buildscript { ext.deps = [ 'androidx': [ - 'annotations': "androidx.annotation:annotation:1.1.0", + 'annotations': "androidx.annotation:annotation:1.3.0", 'core': "androidx.core:core:1.3.0", ], 'kotlin': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}" @@ -120,7 +130,7 @@ buildscript { } plugins { - id 'io.codearte.nexus-staging' version '0.22.0' + id 'io.codearte.nexus-staging' version '0.30.0' } // Nexus Staging configuration diff --git a/android/gradle.properties b/android/gradle.properties index 63e61ee5ae..8c44680534 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -22,3 +22,5 @@ android.useAndroidX=true org.gradle.unsafe.configuration-cache=true com.google.android.filament.tools-dir=../../../out/release/filament +com.google.android.filament.dist-dir=../out/android-release/filament +com.google.android.filament.abis=all diff --git a/android/samples/sample-gltf-viewer/build.gradle b/android/samples/sample-gltf-viewer/build.gradle index 39e923f023..6e9a88a9a6 100644 --- a/android/samples/sample-gltf-viewer/build.gradle +++ b/android/samples/sample-gltf-viewer/build.gradle @@ -32,6 +32,11 @@ android { targetSdkVersion versions.targetSdk missingDimensionStrategy 'functionality', 'full' } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } } dependencies { diff --git a/android/samples/sample-hello-camera/build.gradle b/android/samples/sample-hello-camera/build.gradle index 3ff4b4b4e6..15850008f0 100644 --- a/android/samples/sample-hello-camera/build.gradle +++ b/android/samples/sample-hello-camera/build.gradle @@ -23,6 +23,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-hello-triangle/build.gradle b/android/samples/sample-hello-triangle/build.gradle index cb768787ce..aabbfc5e05 100644 --- a/android/samples/sample-hello-triangle/build.gradle +++ b/android/samples/sample-hello-triangle/build.gradle @@ -23,6 +23,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-image-based-lighting/build.gradle b/android/samples/sample-image-based-lighting/build.gradle index 03328be1f4..5693f54efb 100644 --- a/android/samples/sample-image-based-lighting/build.gradle +++ b/android/samples/sample-image-based-lighting/build.gradle @@ -29,6 +29,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-lit-cube/build.gradle b/android/samples/sample-lit-cube/build.gradle index 432ca05b91..b082c5561e 100644 --- a/android/samples/sample-lit-cube/build.gradle +++ b/android/samples/sample-lit-cube/build.gradle @@ -22,6 +22,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-live-wallpaper/build.gradle b/android/samples/sample-live-wallpaper/build.gradle index 12531884bf..0b365b3c70 100644 --- a/android/samples/sample-live-wallpaper/build.gradle +++ b/android/samples/sample-live-wallpaper/build.gradle @@ -10,6 +10,12 @@ android { minSdkVersion versions.minSdk targetSdkVersion versions.targetSdk } + + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } } dependencies { diff --git a/android/samples/sample-material-builder/build.gradle b/android/samples/sample-material-builder/build.gradle index 0d08d43b2c..348f7265cb 100644 --- a/android/samples/sample-material-builder/build.gradle +++ b/android/samples/sample-material-builder/build.gradle @@ -33,6 +33,12 @@ android { missingDimensionStrategy 'functionality', 'full' } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-multi-view/build.gradle b/android/samples/sample-multi-view/build.gradle index b0562428d5..69c547cf7c 100644 --- a/android/samples/sample-multi-view/build.gradle +++ b/android/samples/sample-multi-view/build.gradle @@ -22,6 +22,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-page-curl/build.gradle b/android/samples/sample-page-curl/build.gradle index 9a06422375..835f431752 100644 --- a/android/samples/sample-page-curl/build.gradle +++ b/android/samples/sample-page-curl/build.gradle @@ -25,6 +25,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { @@ -34,5 +40,5 @@ android { dependencies { implementation project(':filament-android') - implementation 'androidx.annotation:annotation:1.1.0' + implementation deps.androidx.annotations } diff --git a/android/samples/sample-stream-test/build.gradle b/android/samples/sample-stream-test/build.gradle index aea342fe4d..1ec5feba23 100644 --- a/android/samples/sample-stream-test/build.gradle +++ b/android/samples/sample-stream-test/build.gradle @@ -23,6 +23,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-texture-view/build.gradle b/android/samples/sample-texture-view/build.gradle index e793516329..c010007a00 100644 --- a/android/samples/sample-texture-view/build.gradle +++ b/android/samples/sample-texture-view/build.gradle @@ -23,6 +23,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-textured-object/build.gradle b/android/samples/sample-textured-object/build.gradle index 3228a5a2ed..2b458a0227 100644 --- a/android/samples/sample-textured-object/build.gradle +++ b/android/samples/sample-textured-object/build.gradle @@ -30,6 +30,12 @@ android { missingDimensionStrategy 'functionality', 'full' } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions { diff --git a/android/samples/sample-transparent-view/build.gradle b/android/samples/sample-transparent-view/build.gradle index e793516329..c010007a00 100644 --- a/android/samples/sample-transparent-view/build.gradle +++ b/android/samples/sample-transparent-view/build.gradle @@ -23,6 +23,12 @@ android { targetSdkVersion versions.targetSdk } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies + // is not configuration-cache friendly yet; this is only useful for Play publication + dependenciesInfo { + includeInApk = false + } + // We use the .filamat extension for materials compiled with matc // Telling aapt to not compress them allows to load them efficiently aaptOptions {