Setup
To build our module, you need to same dependencies as the ones described in the official Godot documentation.
Make sure that Java is installed and its PATH
set in your system as well (at least Java 11 is needed).
-
Clone Godot's repository with the stable tag you want to develop for:
git clone git@github.com:godotengine/godot.git 4.1.2-stable --recursive
-
In the
godot-root
dir, run the following command:git submodule add git@github.com:utopia-rise/godot-kotlin-jvm.git modules/kotlin_jvm
-
From the
godot-root
dir, build the engine with our module:scons platform=linuxbsd # your target platform
-
Build sample
- navigate to
<module-root>/harness/tests
- create embedded JVM:
- For amd64 systems:
jlink --add-modules java.base,java.logging --output jre-amd64
- For arm64 systems:
jlink --add-modules java.base,java.logging --output jre-arm64
- If you want to remote debug add module
jdk.jdwp.agent
to command. - If you want to enable jmx, add
jdk.management.agent
to command.
- Windows:
gradlew build
- Unix:
./gradlew build
- navigate to
-
In order to run the engine, run
godot.linuxbsd.editor.x86_64
(or the equivalent of your platform) located in thebin
folder ofgodot-root
-
In order to debug your JVM code, you should start Godot with command line
--jvm-debug-port=XXXX
, whereXXXX
stands for the JMX port of you choice. You can then set up remote debug configuration in Intellij IDEA.
Publishing locally
In order to publish our artifacts locally, you'll need to run gradlew :tools-common:publishToMavenLocal publishToMavenLocal
Check in you maven local repository what the version is you've just published: ls ~/.m2/repository/com/utopia-rise/godot-gradle-plugin
.
The version should look something like this: 0.7.2-4.1.2-c8df371-SNAPSHOT
.
Your test project should use mavenLocal()
in the repositories block in build.gradle.kts
and the following in settings.gradle.kts
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
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 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.