This message was deleted.
# dependency-management
s
This message was deleted.
v
The TOML is for the simple and easy cases with a very limited functionality and syntax. The DSL is for the more sophisticated uses where you want to parse an own storage file, or do something conditional, or merge something, or whatever.
m
There was a discussion long ago. I am also in need of importing multiple catalogs, and that's not possible even with the DSL, unless you implement your own TOML parser, which I had to do, so I think it's a legit use case.
v
👌
m
Would love to see this become a feature, so modular catalog can be a bit simpler. I went ahead and made a bit of a hacky way around it. (apologies for the cursed code! But it works!)
Copy code
afterEvaluate {
    if (project == rootProject) return@afterEvaluate

    val projectCatalog = project.file("libs.versions.toml")
    val rootCatalog = rootProject.file("libs.versions.toml")

    extensions.getByType(CatalogPluginExtension::class.java).versionCatalog {
        TomlCatalogFileParser.parse(projectCatalog.toPath(), this)
        TomlCatalogFileParser.parse(rootCatalog.toPath(), this)
    }
}