-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin collides with build script Kotlin deps resulting in language version change, exception #181
Comments
Workaround: run ktfmt directly to avoid mixing class paths:
|
Thanks for reporting this
Yup you're right that the ktfmt dependencies will end up contributing to the build dependencies of the whole build. I've been investigating isolating the KtFmt dependencies so that users could effectively specify the tool versions without having a 1:1 relationship between gradle plugin-ktfmt tool. I'm happy to receive a PR if someone is up for investigating in this space |
Will have a look at that, pretty straightforward. Not having used AGP (and not clear why its a dep on this project) - unable to sync project into IntelliJ after forking due to:
Recommended approach to setup dev env? |
It
IntelliJ IDEA 2023.2 should work without problems. Sadly due to how Android Studio & IntelliJ import the Android plugin source, you always have to be on the latest version of IntelliJ to open the project. |
It unfortunately doesn't sync into IntelliJ 2023.2. For the time being I've flipped the dep back to 8.0.2 to get by this. |
Something odd here - many of the tests have (by design) invalid Kotlin code, such as this:
However, in all those places where the invalid content has a backtick, IntelliJ flags them as an error. Unclear how this could ever have compiled (perhaps it's just an IntelliJ quirk, still working on lots of other things, not able to compile atm). If we need to replace the backticks presumably all this needs is bad Kotlin of some form. |
...because that method parameter is annotation with |
Yup that's IntelliJ attempting to render that as Kotlin code and showing errors if they happen to be invalid (fixing them to be valid code would be a nice to fix for the codebase) |
Gotcha, thanks. Almost there - working through adjusting tests for use of Worker API (decoupled a lot of code for clarity of isolation / ease of testing). |
Co-authored-by: Nicola Corti <[email protected]>
Applying v0.13.0 to a project results in these issues:
Exception compiling Kotlin code when ktfmt plugin applied:
Same exception happens on sync when applying plugin to build-logic (included build w/ convention plugins).
✅ Expected behavior
Applying the ktfmt plugin does not cause exceptions or interfere with other settings.
💣 Steps to reproduce
Install ktfmt plugin via a convention plugin, onto a project using Kotlin 1.8.22 w/ language level 1.9.0.
📷 Screenshots
Dependencies are whacked:
📱 Tech info
Gradle 8.2.1 / Java 19 (same issue with Java 17) / plugin 0.13.0 / Kotlin 1.8.22 (language level 1.9.0)
Seems like the plugin could benefit from running ktfmt using either class loader isolation or shaded dependencies to avoid collisions with likely-to-conflict dependencies (the Kotlin setup needed to build an application will frequently differ from the Kotlin setup needed by ktfmt to parse code).
The text was updated successfully, but these errors were encountered: