-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Consider moving to build.gradle.kts #63
Comments
I think what would help people decide which they like more is seeing an mdk example using this to compare the current mdk with |
For reference, I made a sample port to the kotlin build script at https://github.com/Martmists-GH/MDK-kts |
How well are the Eclipse and Eclipse Plugins support for this kind of buildscript? The MDK is ideally suppose to be maintainable and easily usable for a wide range of setups people may have one Eclipse and Intellij |
|
I am a Kotlin fanboy but this particular issue is the reason I do not use Kotlin buildscripts anywhere. |
Eclipse Buildship added Kotlin DSL support late 2023.
Kotlin build scripts benefit from being less magic-y. Groovy suffers from not differentiating between variables, functions and strings cleanly. Some examples from this repo:
Groovy suffers from the same problem, but this shoudldn't be a concern as the MDK is designed to always load as-is with no errors. Modifications will still show syntax highlighting afterwards, even if they cause errors. Even supposing this were a problem, kotlin build scripts tend to be more verbose in regards to error reporting compared to groovy, in my experience.
I'd argue that most of these are usually dependencies and not any complex logic, as you'd see on e.g. the Gradle Documentation. For most users, the difference between |
That's not correct, strings are clearly differentiated using
Not really, most examples and linked code you'll find browsing the Forge forums and Discord servers are in Groovy, and those vary from creating new sourcesets (like datagen sourcesets, or api sourcesets), new runs, new configurations, hacks for certain configurations and IDEs (used for eclipse historically for ages). The syntax for creating and using a custom configuration, and for creating sourcesets and wiring their dependencies is quite different between Groovy and Kotlin. As for the other parts of your comment,
There are mods written in Groovy too, there's a language provider and mods.groovy for declaring mods.toml files for different loaders. My stance in this issue is that people that care enough to have a Kotlin buildscript know enough to port it themselves. A modder that is just starting out should not need to learn how to write kotlin code (and understand its quirks and differences that are more significant than Java vs Groovy - i.e. delegation, which is something I often see people confused about, or providing class types using the *as an experimental feature, not available on Windows (or not at the time of writing the blog post), see eclipse/buildship#222 (comment) |
uhh, no? It has basic syntax highlighting instead of everything being red
designed to doesn't mean it always will |
See https://discord.com/channels/313125603924639766/801175194298744902/1247764605556490301 for the sort of cases that would make me hesitant to see the MDK moved to the kotlin DSL -- there's still far too many cases that pop up that work perfectly fine with the groovy DSL that require the use of ugly, unintuitive, and undiscoverable Furthermore, the |
Gradle's official documentation, as well a variety of other sites, are moving to build.gradle.kts as the default.
The kotlin build script format feels much more similar to java and/or kotlin than the current groovy syntax. This is good, because these two languages are used much more frequently in modding, while the latter isn't used at all (to my knowledge).
Additionally, kotlin build scripts provide type hints and full syntax highlighting in IntelliJ, and are usually more verbose in their errors to help identify any problems users may encounter in their build scripts.
The main downside this change would have on this repo is that a large chunk of the gradle.properties file would be better off in a libs.versions.toml file, rather than accessing them through
project.extra["..."]
. While this is not necessarily a downside, it does add a small amount of complexity to using the toolchain.The text was updated successfully, but these errors were encountered: