Switch to Gradle Kotlin DSL #103

Closed
StckOverflw wants to merge 5 commits from master into master
StckOverflw commented 2021-06-02 23:04:52 +00:00 (Migrated from github.com)
No description provided.
intact commented 2021-06-02 23:24:24 +00:00 (Migrated from github.com)

Why?

Why?
liach commented 2021-06-02 23:53:24 +00:00 (Migrated from github.com)

no, gradle is way more java friendly than kotlin

no, gradle is way more java friendly than kotlin
l4zs commented 2021-06-03 00:00:42 +00:00 (Migrated from github.com)

@liach it's still gradle, just kotlin dsl and not groovy which makes it more typesafe and generally kotlin is nicer than groovy

@liach it's still gradle, just kotlin dsl and not groovy which makes it more typesafe and generally kotlin is nicer than groovy
liach commented 2021-06-03 00:40:20 +00:00 (Migrated from github.com)

@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!

> > > @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!
DRSchlaubi commented 2021-06-03 00:55:15 +00:00 (Migrated from github.com)

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

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
liach commented 2021-06-03 00:57:56 +00:00 (Migrated from github.com)

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.

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.
l4zs commented 2021-06-03 01:00:40 +00:00 (Migrated from github.com)

how does groovy look more clean to you

how does groovy look more clean to you
DRSchlaubi commented 2021-06-03 01:03:03 +00:00 (Migrated from github.com)

Implicit method calls:

id 'fabric-loom' version '0.7-SNAPSHOT'	
id 'maven-publish'

Closures:



dependencies {
	// To change the versions see the gradle.properties file	
minecraft "com.mojang:minecraft:${project.minecraft_version}"	
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
	// Fabric API. This is technically optional, but you probably want it anyway.
	modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
	// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.	// You may need to force-disable transitiveness on them.
}

def

def targetVersion = 8

Yep that's definitivly the Java we all know and love

Implicit method calls: ```groovy id 'fabric-loom' version '0.7-SNAPSHOT' id 'maven-publish' ``` Closures: ```groovy dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. } ``` def ```groovy def targetVersion = 8 ``` Yep that's definitivly the Java we all know and love
liach commented 2021-06-03 01:08:38 +00:00 (Migrated from github.com)

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.

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.
DRSchlaubi (Migrated from github.com) requested changes 2021-06-03 01:08:57 +00:00
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:06:18 +00:00

use the built-in literal \maven-publish``

	`maven-publish`
use the built-in literal `\`maven-publish\`` ```suggestion `maven-publish` ```
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:07:56 +00:00
			this.expand("version" to project.version)
```suggestion this.expand("version" to project.version) ```
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:08:17 +00:00
		dependsOn(classes)
```suggestion dependsOn(classes) ```
@ -0,0 +5,4 @@
url = uri("https://maven.fabricmc.net/")
}
gradlePluginPortal()
}
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:08:52 +00:00
maven("https://maven.fabricmc.net/")
```suggestion maven("https://maven.fabricmc.net/") ```
haykam821 commented 2021-06-03 01:11:23 +00:00 (Migrated from github.com)

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.

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.
DRSchlaubi commented 2021-06-03 01:17:10 +00:00 (Migrated from github.com)

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.

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

Finally kotlin dsl is slow for compilation. This is just causing extra problems with no real benefits.

I agree that the compilation is definitively slower, but I disagree that it has 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.

Yep, nothing to say against that one stack overflow is full of Groovy DSL examples

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.

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

> 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. 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 > Finally kotlin dsl is slow for compilation. This is just causing extra problems with no real benefits. I agree that the compilation is definitively slower, but I disagree that it has 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. Yep, nothing to say against that one stack overflow is full of Groovy DSL examples > 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. 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
liach (Migrated from github.com) reviewed 2021-06-03 01:24:12 +00:00
@ -0,0 +8,4 @@
val archives_base_name: String by project
val mod_version: String by project
val maven_group: String by project
liach (Migrated from github.com) commented 2021-06-03 01:20:11 +00:00

Why these? Are they no longer automatically polled from gradle.properties? Preferable if you poll from the properties in the {$} evaluation block.

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.
liach (Migrated from github.com) commented 2021-06-03 01:23:20 +00:00
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()
}
liach (Migrated from github.com) commented 2021-06-03 01:24:10 +00:00

Still preferable to explicitly name this maven as "fabric"

Still preferable to explicitly name this maven as `"fabric"`
l4zs (Migrated from github.com) reviewed 2021-06-03 01:25:56 +00:00
@ -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.
l4zs (Migrated from github.com) commented 2021-06-03 01:25:56 +00:00

this is same for the original

this is same for the original
DRSchlaubi (Migrated from github.com) reviewed 2021-06-03 01:26:18 +00:00
@ -0,0 +8,4 @@
val archives_base_name: String by project
val mod_version: String by project
val maven_group: String by project
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:26:18 +00:00

Because that's not really possible in Kotlin hence the type safe part you need to explicitly declare your gradle.properties variables

Because that's not really possible in Kotlin hence the type safe part you need to explicitly declare your gradle.properties variables
DRSchlaubi (Migrated from github.com) reviewed 2021-06-03 01:27:25 +00:00
@ -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.
DRSchlaubi (Migrated from github.com) commented 2021-06-03 01:27:25 +00:00

I guess he just copied the original but I agree the wall of text could be shortened down

I guess he just copied the original but I agree the wall of text could be shortened down
liach (Migrated from github.com) reviewed 2021-06-03 05:17:07 +00:00
@ -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.
liach (Migrated from github.com) commented 2021-06-03 05:17:07 +00:00

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.

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.
sfPlayer1 commented 2021-06-03 05:21:04 +00:00 (Migrated from github.com)

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

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
modmuss50 (Migrated from github.com) requested changes 2021-06-03 07:27:29 +00:00
modmuss50 (Migrated from github.com) left a comment

Lets keep it civil, this isnt going to happen sorry.

  • It fragments the documentation/help advalible, most if not all of the existing example are in groovy.
  • Not everyone knows kotlin (my self included) Groovy is somewhat a superset of Java so is trivial for java devs to pick up and most importantly understand what is going on. I find kotlin hard to read sometimes. (Groovy does suffer from this a bit, but not in the case of this build script)
  • Kotlin is notrorisily bad on IDE's other than jetbrains's products, we want as many people as possible to be able to use this regardless of IDE.
  • In my experience kotlin is much slower (to compile and get going) than groovy, speed is everything when you are running this 100s of times a day.
  • If we did this all of the other fabric build scripts should be moved to kotlin, I dont really fancy doing that.
  • The typesafe argument is none existant here IMO as you quickly find out if its not going to work when you run it, idea provide me ample amount of help when writing groovy.

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.

Lets keep it civil, this isnt going to happen sorry. - It fragments the documentation/help advalible, most if not all of the existing example are in groovy. - Not everyone knows kotlin (my self included) Groovy is somewhat a superset of Java so is trivial for java devs to pick up and most importantly understand what is going on. I find kotlin hard to read sometimes. (Groovy does suffer from this a bit, but not in the case of this build script) - Kotlin is notrorisily bad on IDE's other than jetbrains's products, we want as many people as possible to be able to use this regardless of IDE. - In my experience kotlin is much slower (to compile and get going) than groovy, speed is everything when you are running this 100s of times a day. - If we did this all of the other fabric build scripts should be moved to kotlin, I dont really fancy doing that. - The typesafe argument is none existant here IMO as you quickly find out if its not going to work when you run it, idea provide me ample amount of help when writing groovy. 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.
Juuxel commented 2021-06-03 13:12:06 +00:00 (Migrated from github.com)

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?

> 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?
modmuss50 commented 2021-06-03 13:19:28 +00:00 (Migrated from github.com)

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.

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.
i509VCB commented 2021-06-03 15:24:38 +00:00 (Migrated from github.com)

A few things that do need clarification here:

please understand that adding a kotlin learning cost to minecraft modding is nothing feasible

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.

how does groovy look more clean to you

It's subjective.

Also feel free to bring more internet bullies...

Why do you assume this is a raiding effort with 2 users. You look like a fool escalating tension that quickly.

A few things that do need clarification here: > please understand that adding a kotlin learning cost to minecraft modding is nothing feasible 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. > how does groovy look more clean to you It's subjective. > Also feel free to bring more internet bullies... Why do you assume this is a raiding effort with 2 users. You look like a fool escalating tension that quickly.
liach commented 2021-06-03 15:39:22 +00:00 (Migrated from github.com)

Fabric doesn't provide any resources explaining Gradle (especially under the groovy flavor)

Good point, we should start working on an article about Gradle (at least the basics) on Fabric wiki.

Why do you assume this is a raiding effort with 2 users. You look like a fool escalating tension that quickly.

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.

> Fabric doesn't provide any resources explaining Gradle (especially under the groovy flavor) Good point, we should start working on an article about Gradle (at least the basics) on Fabric wiki. > Why do you assume this is a raiding effort with 2 users. You look like a fool escalating tension that quickly. 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

Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Steven/fabric-example-mod#103
No description provided.