From 8dae181c2fc3e1aeb4be13ebc553f2ee4dede6b7 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 15 Sep 2022 16:05:18 -0700 Subject: [PATCH] Upgrade AGP and dependencies including plugins (#6078) This moves to a new, maintained Maven publishing plugin. --- BUILDING.md | 2 +- android/build.gradle | 42 +++++++++---------- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../android/filament/utils/ModelViewer.kt | 4 +- .../src/main/AndroidManifest.xml | 3 +- android/gradle.properties | 4 -- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- .../src/main/AndroidManifest.xml | 3 +- build/android/ndk.version | 2 +- 23 files changed, 43 insertions(+), 64 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index f8cead51e6..029d8fb612 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -15,7 +15,7 @@ To build Filament for Android you must also install the following: - Android Studio Arctic Fox or more recent - Android SDK -- Android NDK "side-by-side" 23.1 or higher +- Android NDK 25.1 or higher ### Environment variables diff --git a/android/build.gradle b/android/build.gradle index f080f1ce23..016e6c7cc8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -29,15 +29,12 @@ // Publishing to Maven Central: // - Build and upload artifacts with ./gradlew publish -// - Close and release staging repo on Nexus with ./gradlew closeAndReleaseRepository +// - Close and release staging repo on Nexus with ./gradlew closeAndReleaseStagingRepository // // The following is needed in ~/gradle/gradle.properties: // -// SONATYPE_NEXUS_USERNAME=nexus_user -// SONATYPE_NEXUS_PASSWORD=nexus_password -// -// nexusUsername=nexus_user -// nexusPassword=nexus_password +// sonatypeUsername=nexus_user +// sonatypePassword=nexus_password // // signing.keyId=pgp_key_id // signing.password=pgp_key_password @@ -47,7 +44,7 @@ buildscript { def path = providers .gradleProperty("com.google.android.filament.dist-dir") - .forUseAtConfigurationTime().get() + .get() def directory = objects.fileProperty().fileValue(new File(path)).getAsFile().get() def filamentPath = directory.absolutePath @@ -59,18 +56,15 @@ buildscript { // Warning: changing this property does not work well with incremental builds. def excludeVulkan = providers .gradleProperty("com.google.android.filament.exclude-vulkan") - .forUseAtConfigurationTime() .isPresent() def matdbg = providers .gradleProperty("com.google.android.filament.matdbg") - .forUseAtConfigurationTime() .isPresent() def abis = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"] def newAbis = providers .gradleProperty("com.google.android.filament.abis") - .forUseAtConfigurationTime() .get() .split(',') if (!newAbis.contains("all")) { @@ -79,18 +73,20 @@ buildscript { ext.versions = [ 'minSdk': 19, - 'targetSdk': 31, - 'compileSdk': 31, + 'targetSdk': 33, + 'compileSdk': 33, 'kotlin': '1.7.10', 'kotlin_coroutines': '1.6.1', 'buildTools': '33.0.0', - 'ndk': '25.0.8775105' + 'ndk': '25.1.8937393', + 'androidx_core': '1.9.0', + 'androidx_annotations': '1.3.0' ] ext.deps = [ 'androidx': [ - 'annotations': "androidx.annotation:annotation:1.3.0", - 'core': "androidx.core:core:1.7.0", + 'annotations': "androidx.annotation:annotation:${versions.androidx_annotations}", + 'core': "androidx.core:core:${versions.androidx_core}", ], 'kotlin': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}", 'coroutines': [ @@ -101,7 +97,7 @@ buildscript { dependencies { // NOTE: See TODO in gradle.properties once we move to Gradle 7.4 - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" } @@ -148,14 +144,18 @@ buildscript { } plugins { - id 'io.codearte.nexus-staging' version '0.30.0' + id "io.github.gradle-nexus.publish-plugin" version "1.1.0" } -// Nexus Staging configuration -// See https://github.com/Codearte/gradle-nexus-staging-plugin/ -nexusStaging { +// See https://github.com/gradle-nexus/publish-plugin +// Publish to https://oss.sonatype.org/ (not s01) +nexusPublishing { packageGroup = 'com.google.android' - stagingProfileId = '9a75a224a4f17b' + repositories { + sonatype { + stagingProfileId = '9a75a224a4f17b' + } + } } subprojects { diff --git a/android/filamat-android/src/main/AndroidManifest.xml b/android/filamat-android/src/main/AndroidManifest.xml index 853dff374e..94cbbcfc39 100644 --- a/android/filamat-android/src/main/AndroidManifest.xml +++ b/android/filamat-android/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/android/filament-android/src/main/AndroidManifest.xml b/android/filament-android/src/main/AndroidManifest.xml index cdbfba8bc9..94cbbcfc39 100644 --- a/android/filament-android/src/main/AndroidManifest.xml +++ b/android/filament-android/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/android/filament-utils-android/src/main/AndroidManifest.xml b/android/filament-utils-android/src/main/AndroidManifest.xml index 9709dd03d1..da497470f2 100644 --- a/android/filament-utils-android/src/main/AndroidManifest.xml +++ b/android/filament-utils-android/src/main/AndroidManifest.xml @@ -14,5 +14,4 @@ limitations under the License. --> - + diff --git a/android/filament-utils-android/src/main/java/com/google/android/filament/utils/ModelViewer.kt b/android/filament-utils-android/src/main/java/com/google/android/filament/utils/ModelViewer.kt index deafd62f3c..8e21616ea1 100644 --- a/android/filament-utils-android/src/main/java/com/google/android/filament/utils/ModelViewer.kt +++ b/android/filament-utils-android/src/main/java/com/google/android/filament/utils/ModelViewer.kt @@ -310,8 +310,8 @@ class ModelViewer( private fun addDetachListener(view: android.view.View) { view.addOnAttachStateChangeListener(object : android.view.View.OnAttachStateChangeListener { - override fun onViewAttachedToWindow(v: android.view.View?) {} - override fun onViewDetachedFromWindow(v: android.view.View?) { + override fun onViewAttachedToWindow(v: android.view.View) {} + override fun onViewDetachedFromWindow(v: android.view.View) { uiHelper.detach() destroyModel() diff --git a/android/gltfio-android/src/main/AndroidManifest.xml b/android/gltfio-android/src/main/AndroidManifest.xml index 3ecd231601..954556519f 100644 --- a/android/gltfio-android/src/main/AndroidManifest.xml +++ b/android/gltfio-android/src/main/AndroidManifest.xml @@ -14,5 +14,4 @@ limitations under the License. --> - + diff --git a/android/gradle.properties b/android/gradle.properties index 173cec9f97..66d62f0d88 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -19,10 +19,6 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true -org.gradle.unsafe.configuration-cache=true -# TODO: Remove this when we switch to Gradle 7.4 -org.gradle.unsafe.configuration-cache.max-problems=3 - 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/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 8f53cbd5e9..0c67a17050 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Nov 17 10:40:18 PST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml b/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml index 9aa82e20f7..72d1c4e67b 100644 --- a/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml +++ b/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/android/samples/sample-hello-camera/src/main/AndroidManifest.xml b/android/samples/sample-hello-camera/src/main/AndroidManifest.xml index 383dc6523c..587f704cce 100644 --- a/android/samples/sample-hello-camera/src/main/AndroidManifest.xml +++ b/android/samples/sample-hello-camera/src/main/AndroidManifest.xml @@ -16,8 +16,7 @@ limitations under the License. --> - + diff --git a/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml b/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml index 7b5d03bf6b..9b149c2580 100644 --- a/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml +++ b/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/android/samples/sample-lit-cube/src/main/AndroidManifest.xml b/android/samples/sample-lit-cube/src/main/AndroidManifest.xml index 903be29df0..642333b1fe 100644 --- a/android/samples/sample-lit-cube/src/main/AndroidManifest.xml +++ b/android/samples/sample-lit-cube/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/android/samples/sample-material-builder/src/main/AndroidManifest.xml b/android/samples/sample-material-builder/src/main/AndroidManifest.xml index a4cd115b76..642333b1fe 100644 --- a/android/samples/sample-material-builder/src/main/AndroidManifest.xml +++ b/android/samples/sample-material-builder/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + - + - + - + - + - +