Tomáš Procházka
10/05/2024, 2:16 PMandroidx-compose-bom and inside of Gradle scripts "-" are replaced by "." this is so awful solution and it is used everywhere 😭 It completely prevent to use code suggestion / auto completion inside of IDE.
When you have something like androidx-compose-material3-adaptive-navigation and you don't remember the whole name, just know that it is navigation, you are lost. With androidxComposeMaterial3AdaptiveNavigation, you can write just nav and you are done. Or if you want to add some dependency even before project is properly synced, with camel case you can just copy&paste it, with current format is a huge pain.
The same if you are using currently popular build-logic in project plugins to simplify multi-module setup. Then you need to use
add("implementation", libs.findLibrary("androidx.compose.material3.adaptive.navigation").get())
And you need to manually handle replacing - by . . Or when you want to found where it is used, you cannot just select text and search.
Is there any petition for stop using a-b-c syntax. I would sign in immediately 😉.Eric Haag
10/05/2024, 4:22 PM[libraries]
androidx-compose-material3-adaptive-navigation = { ... }
Then using the type unsafe API you will use androidx-compose-material3-adaptive-navigation, not `androidx.compose.material3.adaptive.navigation`:
versionCatalog.findLibrary("androidx-compose-material3-adaptive-navigation").ifPresent { implementation(it) }
See here: https://docs.gradle.org/current/userguide/platforms.html#sub:type-unsafe-access-to-catalog
But, in any case, if you want camel case version catalog names, then you can use camel case:
[libraries]
androidxComposeMaterial3AdaptiveNavigation = { ... }
Using the type safe API you will reference it using:
implementation(libs.androidxComposeMaterial3AdaptiveNavigation)
In my opinion, I would't have a name like androidx-compose-material3-adaptive-navigation in my version catalog because it's way too lengthy. I try to keep my version catalog IDs only 2 layers deep. I would probably do something like this:
[libraries]
androidx-adaptiveNavigation = { ... }
All androidx dependencies would be grouped that way. Then you would reference it like:
implementation(libs.androidx.adaptiveNavigation)
But, the naming is all personal preference. You can name entries however you like. Here is a blog post that talks about best practices for naming version catalog entries: https://blog.gradle.org/best-practices-naming-version-catalog-entries
Personally, I think translating - into . makes sense. What else would you use? If it kept the -, then everything needs to be surrounded by backticks and you would have no way to group common dependencies. So you have:
```implementation(libs.`androidx-compose-material3-adaptive-navigation`)Tomáš Procházka
10/05/2024, 5:42 PMcom.bmuschko:gradle-docker-plugin
• Wrong: bmuschko-gradleDockerPlugin, plugin-bmuschko-docker
• Right: bmuschko-docker-plugin
Why I must remember something so complicated like bmuschko
to be able to add docker to dependencies? Why? If name would be bmuschkoGradleDockerPlugin , would write just docker and IDE will provider my suggestion with whole name, because IDE allows to use any part of the name.
The same with
androidx-adaptiveNavigation
You need to remember that it is part of androix, if it would be
androidxAdaptiveNavigation
you still can write androidx and IDE will display list of all androidx dependencies, but you can also directly write just nav
At the end in reality in all Android example projects it looks like this 😞
https://github.com/android/compose-samples/blob/main/Jetcaster/gradle/libs.versions.toml#L83
It is impossible to find something other way than open toml file directly and search there.Tomáš Procházka
10/05/2024, 5:44 PMTomáš Procházka
10/05/2024, 5:54 PMtest- for all testing dependencies. You can then have libs.test. and see really just dependencies for testing purposes.Martin
10/05/2024, 6:03 PMcom.bmuschko:gradle-docker-plugin => comBmuschkoGradleDockerPlugin
Sure it's verbose as hell but maven coordinates are already verbose as hell and no one complainsMartin
10/05/2024, 6:05 PMEric Haag
10/05/2024, 6:05 PMMartin
10/05/2024, 6:06 PMMartin
10/05/2024, 6:06 PMEric Haag
10/05/2024, 6:08 PMVampire
10/05/2024, 6:26 PMEric Haag
10/05/2024, 6:27 PMVampire
10/05/2024, 6:28 PMEric Haag
10/05/2024, 6:28 PMMartin
10/05/2024, 6:29 PM~/.gradle 😂 (for very good reasons)Vampire
10/05/2024, 6:29 PMVampire
10/05/2024, 6:29 PMVampire
10/05/2024, 6:30 PMTomáš Procházka
10/05/2024, 6:43 PMVampire
10/05/2024, 6:47 PMpablozki
10/05/2024, 8:30 PMVampire
10/05/2024, 8:57 PMpablozki
10/05/2024, 11:22 PMmelix
10/09/2024, 6:20 AM- translated into . is kind of obvious: a minus is an operator in scripts. Then comes the point about using androidxAdaptiveNavigation vs androidx.adaptative.navigation. The key to me is hierarchy. You should split the name whenever a dependency can be seen as as subcategory. eg, androidx.adaptativeNavigation would make better sense to me than androidxAdaptativeNavigation because it's an androidx category, and adaptativeNativation is a single unit. We can argue about using androidx.adaptative.navigation too. In theory, I would tend to think that it shouldn't be used, however, because of the cognitive overhead of figuring out if you should capitalize or not, I think it's ok. It's actually a convention we have eventually adopted in Micronaut, it makes things easier for users. Long story short, I'm far from fond of capitalizedLibraryNames, because it's putting all libraries in a single bucket, and completely hides one of the best features of catalogs which is categorizing them.Martin
10/09/2024, 7:44 AMMartin
10/09/2024, 7:45 AMMartin
10/09/2024, 7:45 AMVampire
10/09/2024, 7:48 AMMartin
10/09/2024, 7:48 AMmelix
10/09/2024, 7:51 AMTomáš Procházka
10/09/2024, 4:09 PMandroidx.adaptativeNavigation
and
destination.navigation
when I will write library.nav I would like to see both navigation in auto complete.
From my point of view androidxAdaptativeNavigation is still structured,
But I was discussing it also with android studio developers and they told that maybe would be possible to enhance autocomplete suggestions to search also in subcategories.Vampire
10/09/2024, 4:11 PMnav group?
You as the one writing the version catalog control which groups exist and what is in which group.melix
10/09/2024, 4:11 PMTomáš Procházka
10/09/2024, 4:12 PMVampire
10/09/2024, 4:13 PM