From 0c6a141294ccaaa9c8c34be66fc619813482a2d8 Mon Sep 17 00:00:00 2001 From: Matt Groth Date: Tue, 27 Feb 2024 04:35:43 -0500 Subject: [PATCH] Prevent forUseAtConfigurationTimeSafe deprecation warning This became deprecated in Gradle 8.0. So just checks to see if gradle is 8.0 or higher and if so does not call it. (the gradle changelog says "Clients should simply remove the call.") --- .../org/jetbrains/compose/internal/utils/providerUtils.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt index 07bd94dd3b..111f812671 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt @@ -36,7 +36,10 @@ internal fun ProviderFactory.valueOrNull(prop: String): Provider = } private fun Provider.forUseAtConfigurationTimeSafe(): Provider = - try { + // https://docs.gradle.org/current/userguide/upgrading_version_7.html + if (org.gradle.util.GradleVersion.current() >= org.gradle.util.GradleVersion.version("8.0")) { + this + } else try { forUseAtConfigurationTime() } catch (e: NoSuchMethodError) { // todo: remove once we drop support for Gradle 6.4