Skip to content

Comments

Add Kotlin build script#156

Open
CelDaemon wants to merge 19 commits intoFabricMC:mainfrom
CelDaemon:kotlin-dsl
Open

Add Kotlin build script#156
CelDaemon wants to merge 19 commits intoFabricMC:mainfrom
CelDaemon:kotlin-dsl

Conversation

@CelDaemon
Copy link
Contributor

Unlike the other PR, this one tries to stay as similar as possible to the Groovy build script.

The biggest differences are:

  • The loom version is retrieved in the settings.gradle.kts file
  • Project properties are written in camelCase instead of snake_case to avoid IDE warnings

This PR also fixes building Kotlin projects, as a deprecation seemed to prevent Gradle from configuring the project properly.

P.S.
I'm not entirely sure about the camel case properties, it causes the names to not match up with what is displayed on the site. If it is deemed unwanted, I'd be happy to revert them.

@CelDaemon
Copy link
Contributor Author

Is missing config from fabric cli, I would convert to a draft but there seems to be no option to do that from the GitHub mobile app.

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update the CLI and add it to the test script here: https://github.com/FabricMC/fabricmc.net/blob/main/cli/test.ts and run the tests to make sure this works on all versions.

<% if (it.kotlin) { %><% if (it.unobfuscated) { %>implementation<% } else { %>modImplementation<% } %>("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")<% } %>
}

tasks.processResources {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again should be lazy, we should also adjust this in the groovy template (not as part of this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about groovy, but this is already lazy in Kotlin.

@CelDaemon
Copy link
Contributor Author

I have successfully ran the tests (158 passed), though with the Kotlin language disabled and an extra check to skip yarn on unobfuscated versions.

image

Changes property access to use Gradle property providers instead of
project property binding. Using Gradle properties in this way avoids
issues when using Isolated Projects
(gradle/gradle#32398).

An alternative is to use `project.property(...)` instead, which is
closer to the Groovy variant but does exhibit these issues.
Shares the gradle.properties.eta file between the Groovy and Kotlin DSL build script types.
@CelDaemon CelDaemon requested a review from modmuss50 February 23, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants