Feature request: Support using `implementation(platform(...))` for BOMs
StylianosGakis opened this issue · 3 comments
Currently, I am using version catalogs and I have a BOM in there.
The bom is defined inside libs.versions.toml as:
firebase-bom = "com.google.firebase:firebase-bom:31.2.3"
And used like this:
implementation(platform(libs.firebase.bom))
I get the error:
1: extraneous input '"' expecting {'}', ID}, 2: extraneous input 'platform(' expecting {<EOF>, DEPENDENCIES, 'file(', 'files(', 'buildscript', '{', '}', '(', ')', ''', '"', '=', ';', '\', UNICODE_LATIN, ID, DIGIT, WS}
Do you have a minimally reproducing sample project? We support it here https://github.com/square/gradle-dependencies-sorter/blob/main/grammar/src/main/antlr/com/squareup/grammar/GradleGroovyScript.g4#L29-L31
I've tested a reproducer in https://github.com/SimonMarquis/gradle-dependencies-sorter/commit/7e6cd54e3533fa80124ee760db547fff1ea767bf and the test passed correctly as you can see in the corresponding Gradle scan.
I looked into trying out this plugin again now, and I did also try to make a reproducer and I couldn't create one.
Then after fiddling with it a bunch, it works in my project too 🤷♂️
I did have another issue before, where I was doing "stagingImplementation"(dependencyNotation)
and it did not like me doing the String.invoke() there. I created a new function like this
fun DependencyHandlerScope.stagingImplementation(dependencyNotation: Any) {
"stagingImplementation"(dependencyNotation)
}
And then this also fixed the error I was getting while parsing the platform
part too. (This issue is tracked here btw #23)
I feel like this must've been some sort of a false positive since it was failing at some other part of parsing. I now understand that the error I got was actually 2 errors stemming from different parts of the setup.
Anyway, I think you can consider this not an issue then, I must've been doing something wrong myself.
If I encounter this again somehow, I'll make sure to try and get a reproducer that time.