Browse Source

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.")
pull/4376/head
Matt Groth 9 months ago committed by GitHub
parent
commit
0c6a141294
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt

5
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt

@ -36,7 +36,10 @@ internal fun ProviderFactory.valueOrNull(prop: String): Provider<String?> =
} }
private fun Provider<String?>.forUseAtConfigurationTimeSafe(): Provider<String?> = private fun Provider<String?>.forUseAtConfigurationTimeSafe(): Provider<String?> =
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() forUseAtConfigurationTime()
} catch (e: NoSuchMethodError) { } catch (e: NoSuchMethodError) {
// todo: remove once we drop support for Gradle 6.4 // todo: remove once we drop support for Gradle 6.4

Loading…
Cancel
Save