Switch to Gradle Kotlin DSL #103
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Steven/fabric-example-mod#103
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why?
no, gradle is way more java friendly than kotlin
@liach it's still gradle, just kotlin dsl and not groovy which makes it more typesafe and generally kotlin is nicer than groovy
I know what the heck a kotlin dsl is and it is said to be more type safe. However, using kotlin makes gradle way less accessible to java programmers given the cost associated to learning kotlin. @l4zs @StckOverflw please understand that adding a kotlin learning cost to minecraft modding is nothing feasible.
We shouldn't incur massive costs for most modders for a minor "typesafe" or "nicer" gain!
How does that make any sense? You don't need to learn Groovy to use Gradle if you use the Groovy DSL but you need to learn Kotlin if you use the Kotlin DSL
You indeed don't. Groovy supports almost all pre-java 7 java syntaxes; the only minor difference is like closure, while kotlin is a whole new system and will continuously issue compile errors.
Finally, the idea of the build.gradle is that it's declarative, though it is executed in order. For declarative purposes, gradle itself is clearer than kotlin, which is more like sequential programming and is inclined to introduce bad habits.
how does groovy look more clean to you
Implicit method calls:
Closures:
def
Yep that's definitivly the Java we all know and love
Seriously, you kotlin people should stop assuming that kotlin is better for everything. If you like kotlin feel free to make your own example mod that use kotlin dsl, but not everyone is required to learn kotlin and do things your way because you know kotlin.
Also feel free to bring more internet bullies like @DRSchlaubi who has nothing to do with the project but is just a staunch kotlin proponent. The rights or wrong is not affected by how many people come to voice for one side. The fabric project has been attacked by raiders less than a few months ago
Finally kotlin dsl is slow for compilation. This is just causing extra problems with no real benefits.
Many people copy gradle buildscript snippets from sites like stackoverflow, and most of those are gradle ones than kotlin ones. This will just make using buildscripts harder as well.
use the built-in literal
\
maven-publish``@ -0,0 +5,4 @@
url = uri("https://maven.fabricmc.net/")
}
gradlePluginPortal()
}
Gradle itself is enough. I don't think it's necessary to throw Kotlin into the mix too, especially for a template mod. It doesn't even include features like publishing tasks.
I never said it's better for everything, just that it's more concise and having type safety in the DSL come in handy as it gives you compile time errors instead of runtime errors. And still, you don't need to understand Kotlin to write a basic build script. You need to understand both languages to write more complex build scripts. So i just don't get your arguments they just don't make a sense for me
I agree that the compilation is definitively slower, but I disagree that it has no real benefits
Yep, nothing to say against that one stack overflow is full of Groovy DSL examples
Can we stop assuming that like the Groovy DSL is Gradle and Kotlin is something entirely different? Just because it's older doesn't mean it's Gradle it's still just Groovy
But a better suggestion probably be to have both examples like many other projects do nowadays. I, personally, prefer Kotlin over Groovy in the DSL but don't think that an example should be locked down to any DSL
@ -0,0 +8,4 @@
val archives_base_name: String by project
val mod_version: String by project
val maven_group: String by project
Why these? Are they no longer automatically polled from
gradle.properties
? Preferable if you poll from the properties in the{$}
evaluation block.@ -0,0 +43,4 @@
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
Should just link to https://docs.gradle.org/current/dsl/org.gradle.api.tasks.compile.CompileOptions.html than some random blog
@ -0,0 +5,4 @@
url = uri("https://maven.fabricmc.net/")
}
gradlePluginPortal()
}
Still preferable to explicitly name this maven as
"fabric"
@ -0,0 +43,4 @@
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
this is same for the original
@ -0,0 +8,4 @@
val archives_base_name: String by project
val mod_version: String by project
val maven_group: String by project
Because that's not really possible in Kotlin hence the type safe part you need to explicitly declare your gradle.properties variables
@ -0,0 +43,4 @@
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
I guess he just copied the original but I agree the wall of text could be shortened down
@ -0,0 +43,4 @@
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
But if you do carry out a big change like switching to kotlin, it's better to fix the overdue technical debt at the same time.
Sorry, I don't think we will go for such a change. The Kotlin language module has a Kotlin based Gradle build script and example mod here: https://github.com/FabricMC/fabric-language-kotlin/tree/master/sample-mod
Lets keep it civil, this isnt going to happen sorry.
I would be happy to create a kotlin example mod project that goes all in on kotlin for the people that wish to use it.
Doesn't Fabric Language Kotlin's repository have a sample mod just like that?
Yes, however I think it’s outdated and possibly not working? It’s also not as easy as having a template repo that is ready to go.
A few things that do need clarification here:
This is a poisoning the well tactic. Fabric doesn't provide any resources explaining Gradle (especially under the groovy flavor); the system that every modder is essentially forced to use unless you snowflake your own build system.
It's subjective.
Why do you assume this is a raiding effort with 2 users. You look like a fool escalating tension that quickly.
Good point, we should start working on an article about Gradle (at least the basics) on Fabric wiki.
Sorry but I usually get overalarmed since I saw these 2 users have little relation with Minecraft modding but are much Kotlin fans from a quick overview at their profile. I indeed should stay back a bit online sometimes: the online environment isn't obligated to be nice to me, but I shouldn't be hostile to the online environment either.
Pull request closed