Splitties / refreshVersions

Life is too short to google for dependencies and versions
https://splitties.github.io/refreshVersions/
MIT License
1.65k stars 107 forks source link

Clarification when using AndroidX.compose.bom #695

Closed marcardar closed 1 year ago

marcardar commented 1 year ago

In the androidx compose documentation, we are encouraged to use platform:

implementation platform('androidx.compose:compose-bom:2023.06.01')

However, in refreshVersion, it's not clear whether to use:

api(AndroidX.compose.bom)

or:

api(platform(AndroidX.compose.bom))

Both seem to work, but which one should be used?

LouisCAD commented 1 year ago

Hello, use platform(…). Are you sure it works without? Unless Gradle did something special, it wouldn't.

marcardar commented 1 year ago

Hi Louis, yes it does appear to work at least in my setup (Android-only app). I even cleared all gradle caches just to be sure.

EDIT: oh perhaps those dependencies are being ignored (when not using platform(...)) and the compose dependencies are being pulled in elsewhere?

EDIT2: Hmm, so I guess my bad. My build script was:

val composeBom = platform(AndroidX.compose.bom)
api(composeBom)
androidTestImplementation(composeBom)
api(AndroidX.compose.material)
debugApi(AndroidX.compose.ui.tooling)
api(AndroidX.compose.ui.toolingPreview)
api(AndroidX.compose.ui.viewBinding)

So I guess those last 4 were pulling in all the necessary compose dependencies when the bom dependency was not configured correctly. Ideally it would have failed when I made that platform change?

LouisCAD commented 1 year ago

I'm not sure what you mean by not configured correctly. You're properly using platform here.