From 8c4a699c123f871e7ff788a3cabc00b37757fd8f Mon Sep 17 00:00:00 2001 From: Louis CAD Date: Thu, 6 Jul 2023 17:40:27 +0200 Subject: [PATCH] Add snippet for Compose apps in the CHANGELOG --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d1cece8..415907d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,35 @@ dependencies { } ``` +```kts +// Add Jetpack Compose to a project in seconds with refreshVersions. +// NEW: The Compose BoM released on Android Dev Summit is supported! + +// No need to search for the versions, refreshVersions will do it for you! +// It will add the latest most stable version, and will even add the updates +// as comments in the versions.properties file (auto-created on first use). + +android { + buildFeatures.compose = true + composeOptions { + // Version and updates are in versions.properties + kotlinCompilerExtensionVersion = versionFor(AndroidX.compose.compiler) + } +} + +dependencies { + // Version and updates of the BoM are in versions.properties too. + implementation(platform(AndroidX.compose.bom)) // Enables the BoM automatically + implementation(AndroidX.compose.runtime) // Version from the BoM + implementation(AndroidX.compose.icons.extended) // Version from the BoM + + // What if you need a specific alpha/beta/rc version? + // withVersionPlaceholder() detaches the dependency from the BoM. + // Version and updates will therefore be in versions.properties + implementation(AndroidX.compose.material3.withVersionPlaceholder()) // Not from BoM +} +``` + ### Fix StabilityLevel calculation for number-less pre-versions Since last changes in the Version class, versions like 1.7.20-RC and 1.7.20-Beta would be marked as stable instead of respectively ReleaseCandidate and Beta because the logic expected a number in all cases.