Skip to content

Add Kotlin Buildscripts + Add Kotlin Buildscript Support to Testing + Update Gradle Plugins, Gradle and MinecraftForge#6

Merged
LexManos merged 11 commits intoMinecraftForge:masterfrom
Codetoil:master
Mar 3, 2026
Merged

Add Kotlin Buildscripts + Add Kotlin Buildscript Support to Testing + Update Gradle Plugins, Gradle and MinecraftForge#6
LexManos merged 11 commits intoMinecraftForge:masterfrom
Codetoil:master

Conversation

@Codetoil
Copy link
Contributor

Lex mentioned that the Kotlin Buildscript needed to be added to the testing framework. I went ahead and did that.
While I was there, I bumped the Gradle Plugins, Gradle and MinecraftForge, since they should probably be up to date.

@LexManos
Copy link
Member

LexManos commented Mar 1, 2026

This doesnt actually seem to add any kotlin examples
Nore does it seem to of actually run the _internal updates.
What is the goal of this PR?

@Codetoil
Copy link
Contributor Author

Codetoil commented Mar 1, 2026

It adds the existing kotlin buildscript into the _internal testing framework. Plus I made some modifications to it to extend its capabilities.

@Codetoil
Copy link
Contributor Author

Codetoil commented Mar 1, 2026

If you want me to add the kotlin examples in the same PR, I could, but that'll take me some time to make.

@LexManos
Copy link
Member

LexManos commented Mar 1, 2026

Worth doing yes, and like I said, the updateBuilds task doesnt seem to of been run because the current projects output a range, which is not what the code does.
Jonathan changed things to a range after I wrote that task and never updated it.

@Codetoil
Copy link
Contributor Author

Codetoil commented Mar 1, 2026

I did actually run it though. I modified the task to output a range since that what I thought you wanted.

@LexManos
Copy link
Member

LexManos commented Mar 1, 2026

Oh my bad, forgot it was hardcoded, thought I had it pick from that subproject's version. Im an idiot.
I'll try and remember to look at this tomarrow. But yes, having a kotlin version of each example is the overall goal.

@Codetoil Codetoil marked this pull request as draft March 2, 2026 05:45
@Codetoil Codetoil changed the title Add Kotlin Buildscript Support to Testing + Update Gradle Plugins, Gradle and MinecraftForge Add Kotlin Buildscripts + Add Kotlin Buildscript Support to Testing + Update Gradle Plugins, Gradle and MinecraftForge Mar 2, 2026
@Codetoil Codetoil marked this pull request as ready for review March 2, 2026 06:47
[version: '[7.0.10,8.0)', id: 'net.minecraftforge.gradle'],
[version: '5.0.3', id: 'net.minecraftforge.accesstransformers'],
[version: '0.2.3', id: 'net.minecraftforge.jarjar'],
[version: '1.0.2', id: 'net.minecraftforge.renamer'],
Copy link
Member

Choose a reason for hiding this comment

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

Why did you delete the paths that completely breaks the include build functionality...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't. Paths aren't used at all in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually nevermind they are my bad


publications.register<MavenPublication>("mavenJava") {
from(components.named("java").get()) // Publish the normal jar
artifact(tasks.named("renameJar").get()) // Publish the renamed jar in addition
Copy link
Member

Choose a reason for hiding this comment

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

The .get() shouldn't be needed. As it forces the task to be resolved at evaluation time. Breaking lazy configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't compile in Kotlin otherwise.

Copy link
Member

Choose a reason for hiding this comment

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

What do we need to do to make kotlin happy with gradle's lazy tasks?

@LexManos
Copy link
Member

LexManos commented Mar 2, 2026

Why did you move the internal project up a level? this removes the ability to add a fg6 version

@LexManos
Copy link
Member

LexManos commented Mar 2, 2026

As for actually running the tests, they are broken
I am not sure how the existing tasks got broken but it did.
Also may be worth adding a gradle cache redirect to make each sub-project have its own separate cache (and this no inter-project overlaps)
I think the traditional's are broken because you bumped the minecraft/forge version without updating the code. No idea why you bumped the forge version its not needed. This project isn't about chasing MC/Forge. Its about testing the toolchains and giving examples of the basics. If we want to add more Minecraft specific examples we'd make projects like game-content/blocks/furnace/1.12.2 and game-content/blocks/furnace/1.20.1

FAILURE: Build completed with 4 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':accesstransformers-only:compileJava'.
> Compilation failed; see the compiler output below.
  Z:\Projects\MDKExamples\accesstransformers-only\fg7\src\main\java\net\minecraftforge\example\ExampleMod.java:10: error: LOGGER has private access in Minecraft
        Minecraft.LOGGER.info("Able to access a private field");
                 ^
  1 error

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':accesstransformers-only-kotlin:compileJava'.
> Compilation failed; see the compiler output below.
  Z:\Projects\MDKExamples\accesstransformers-only\fg7-kotlin\src\main\java\net\minecraftforge\example\ExampleMod.java:10: error: LOGGER has private access in Minecraft
        Minecraft.LOGGER.info("Able to access a private field");
                 ^
  1 error

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':traditional-mdk:compileJava'.
> Compilation failed; see the compiler output below.
  Z:\Projects\MDKExamples\traditional-mdk\fg7\src\main\java\com\example\examplemod\Config.java:3: error: cannot find symbol
  import net.minecraft.resources.ResourceLocation;
                                ^
    symbol:   class ResourceLocation
    location: package net.minecraft.resources
  1 error

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':traditional-mdk-kotlin:compileJava'.
> Compilation failed; see the compiler output below.
  Z:\Projects\MDKExamples\traditional-mdk\fg7-kotlin\src\main\java\com\example\examplemod\Config.java:3: error: cannot find symbol
  import net.minecraft.resources.ResourceLocation;
                                ^
    symbol:   class ResourceLocation
    location: package net.minecraft.resources
  1 error

@Codetoil Codetoil marked this pull request as draft March 3, 2026 05:54
@Codetoil
Copy link
Contributor Author

Codetoil commented Mar 3, 2026

You run into the same issue in the original codebase if you use the gradle build task for the mdkexamples gradle project. (Unless it's from the port from FG 7.0.0-rc.5 to [7.0.2,8.0))
image

@Codetoil
Copy link
Contributor Author

Codetoil commented Mar 3, 2026

Running the build tasks per-gradle project does work
image

@Codetoil Codetoil marked this pull request as ready for review March 3, 2026 06:15
@Codetoil Codetoil requested a review from LexManos March 3, 2026 18:47
@LexManos
Copy link
Member

LexManos commented Mar 3, 2026

There are still issues with lazy configuration and the published artifacts but im getting tired of arguing about this.

@LexManos LexManos merged commit 5068b6c into MinecraftForge:master Mar 3, 2026
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.

2 participants