Setup
To build our module, you need the same dependencies as the ones described in the official Godot documentation. Before building the engine, we invite you to read this document until the end.
Make sure that Java is installed and its PATH set in your system as well (at least Java 11 is needed).
Note
To check if Java is installed on your platform, open a terminal and type the following command:
1 | |
Warning
The microsoft jdk is known for causing issues on windows while building code for our IDE plugin. The issue is the same as described in this issue.
Either use a different jvm vendor like Adoptium temurin or create the folder Packages manually in the JAVA_HOME folder: 'C:\Program Files\Microsoft\jdk-21.0.6.7-hotspot\Packages in order to build our module.
Once you have all the necessary dependencies, proceed to do the following:
- Clone Godot's repository with the stable tag you want to develop for. Notice that the branch tag must be
aligned to the current binding's version (e.g., current version
0.10.0-4.3.0, we need Godot at4.3.0version).
1 | |
-
In the
godotdirectory, run the following command:1git submodule add git@github.com:utopia-rise/godot-kotlin-jvm.git modules/kotlin_jvm -
Once the git submodule is added, change your directory to
godot, and build the engine with our module:1scons platform=linuxbsd # your target platform (windows, macos, ...) -
Build the sample following these steps:
- Navigate to
<module-root>/harness/tests - Create an embedded Java Virtual Machine:
- For
amd64systems: jlink --add-modules java.base,java.logging --output jvm/jre-amd64-<platform ex. linux>- For
arm64(macOS with Apple Silicon chips) systems: jlink --add-modules java.base,java.logging --output jvm/jre-arm64-<platform ex. macos>- If you want to remote debug add module
jdk.jdwp.agentto command. - If you want to enable
jmx, addjdk.management.agentto command.
- For
- Then build the project using the Gradle wrapper.
- Windows:
gradlew build - Unix:
./gradlew build
- Windows:
- Navigate to
-
To run the engine, run
godot.linuxbsd.editor.x86_64(or the equivalent of your platform) located in thebinfolder ofgodot. -
To debug your JVM code, you should start Godot with command line
--jvm-debug-port=XXXX, whereXXXXstands for the JMX port of you choice. You can then set up remote debug configuration in Intellij IDEA.
Publishing locally
To publish our artifacts locally, you'll need to run the following command:
1 | |
Check in you maven local repository what is the version you've just published, doing the following:
1 | |
The version should look something like this: 0.7.2-4.1.2-c8df371-SNAPSHOT.
Your test project should use mavenLocal() in its Gradle repositories and use the exact snapshot version you published from your local ~/.m2/repository/com/utopia-rise/godot-gradle-plugin/ folder.
Use the following minimal settings.gradle.kts setup:
1 2 3 4 5 6 7 8 9 10 | |
Warning
If you republish local changes under the same snapshot version, Gradle may reuse cached plugin artifacts. Rerun the consuming project with --refresh-dependencies (for example ./gradlew --refresh-dependencies build) to force it to pick up the republished local artifacts.
Important notes
When you build a sample, it generates a godot-bootstrap.jar in build/libs.
This JAR is needed by the engine to function correctly. You need to copy this jar to <godot-root>/bin.
If you want to automate that, consider using the following Gradle task in the samples build.gradle.kts - but, please,
don't commit it!
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
If you build the libs from <module-root>/kt then this copy task is already present and executed automatically for you.