Skip to content

Commit

Permalink
Add new AndroidX.compose.bom dependency notation
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisCAD committed Oct 25, 2022
1 parent 462ba24 commit 5b38a7e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ sealed class AbstractDependencyGroup(
name: String,
isBom: Boolean = false,
usePlatformConstraints: Boolean? = if (isBom) false else null
) = module(
group = group,
name = name,
isBom = isBom,
usePlatformConstraints = usePlatformConstraints
)

fun module(
group: String,
name: String,
isBom: Boolean = false,
usePlatformConstraints: Boolean? = if (isBom) false else null
): DependencyNotation {
assert(name.trimStart() == name) { "module($name) has superfluous leading whitespace" }
assert(name.trimEnd() == name) { "module($name) has superfluous trailing whitespace" }
Expand Down
52 changes: 43 additions & 9 deletions plugins/dependencies/src/main/kotlin/dependencies/AndroidX.kt
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,20 @@ object AndroidX : IsNotADependency {
*/
val compose = Compose

object Compose : IsNotADependency {
object Compose : DependencyGroup(group = "androidx.compose") {

val bom = module("compose-bom", isBom = true)

/**
* Transform @Composable functions and enable optimizations with a Kotlin compiler plugin.
*
* [Release notes](https://developer.android.com/jetpack/androidx/releases/compose-compiler)
*/
val compiler = DependencyNotation("androidx.compose.compiler", "compiler")
val compiler = module(
group = "androidx.compose.compiler",
name = "compiler",
usePlatformConstraints = false // Not included in the BoM, and not used as a regular dependency.
)

/**
* Fundamental building blocks of Compose's programming model and state management,
Expand All @@ -520,7 +526,11 @@ object AndroidX : IsNotADependency {
*/
val runtime = Runtime

object Runtime : DependencyNotationAndGroup(group = "androidx.compose.runtime", name = "runtime") {
object Runtime : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.runtime",
name = "runtime"
) {

val dispatch = module("runtime-dispatch")

Expand Down Expand Up @@ -578,7 +588,11 @@ object AndroidX : IsNotADependency {
*/
val animation = Animation

object Animation : DependencyNotationAndGroup(group = "androidx.compose.animation", name = "animation") {
object Animation : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.animation",
name = "animation"
) {

/**
* Animation engine and animation primitives that are the building blocks of the Compose animation library.
Expand Down Expand Up @@ -648,7 +662,11 @@ object AndroidX : IsNotADependency {
*/
val ui = Ui

object Ui : DependencyNotationAndGroup(group = "androidx.compose.ui", name = "ui") {
object Ui : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.ui",
name = "ui"
) {

/**
* Compose classes related to dimensions without units
Expand Down Expand Up @@ -707,7 +725,11 @@ object AndroidX : IsNotADependency {
*/
val text = Text

object Text : DependencyNotationAndGroup(group = group, name = "ui-text") {
object Text : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = group,
name = "ui-text"
) {

/**
* Compose Downloadable Fonts integration for Google Fonts.
Expand Down Expand Up @@ -787,7 +809,11 @@ object AndroidX : IsNotADependency {
*/
val foundation = Foundation

object Foundation : DependencyNotationAndGroup(group = "androidx.compose.foundation", name = "foundation") {
object Foundation : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.foundation",
name = "foundation"
) {

/**
* Compose layout implementations
Expand All @@ -814,7 +840,11 @@ object AndroidX : IsNotADependency {
*/
val material = Material

object Material : DependencyNotationAndGroup(group = "androidx.compose.material", name = "material") {
object Material : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.material",
name = "material"
) {

/**
* Material icons
Expand Down Expand Up @@ -867,7 +897,11 @@ object AndroidX : IsNotADependency {
*/
val material3 = Material3

object Material3 : DependencyNotationAndGroup(group = "androidx.compose.material3", name = "material3") {
object Material3 : DependencyNotationAndGroup(
platformConstrainsDelegateGroup = Compose,
group = "androidx.compose.material3",
name = "material3"
) {

/**
* Provides window size classes for building responsive UIs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ androidx.compose.ui:ui-tooling-preview
androidx.compose.ui:ui-unit
androidx.compose.ui:ui-util
androidx.compose.ui:ui-viewbinding
androidx.compose:compose-bom
androidx.concurrent:concurrent-futures
androidx.concurrent:concurrent-futures-ktx
androidx.constraintlayout:constraintlayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ androidx.car.app..app=AndroidX.carApp
androidx.cardview..cardview=AndroidX.cardView
androidx.collection..collection-ktx=AndroidX.collection.ktx
androidx.collection..collection=AndroidX.collection
androidx.compose..compose-bom=AndroidX.compose.bom
androidx.compose.animation..animation-core=AndroidX.compose.animation.core
androidx.compose.animation..animation-graphics=AndroidX.compose.animation.graphics
androidx.compose.animation..animation=AndroidX.compose.animation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ androidx.car.app..app=version.androidx.car.app
androidx.cardview..cardview=version.androidx.cardview
androidx.collection..collection-ktx=version.androidx.collection
androidx.collection..collection=version.androidx.collection
androidx.compose..compose-bom=version.androidx.compose
androidx.compose.animation..animation-core=version.androidx.compose.animation
androidx.compose.animation..animation-graphics=version.androidx.compose.animation
androidx.compose.animation..animation=version.androidx.compose.animation
Expand Down

0 comments on commit 5b38a7e

Please sign in to comment.