Skip to content

Commit

Permalink
Export using gradle instead of scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
chippmann committed Aug 22, 2024
1 parent 1bc0bc4 commit 4220633
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test_linux_exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ jobs:
run: |
jlink --add-modules java.base,java.logging --output jre-amd64-linux
- name: Export tests project
run: |
cd modules/kotlin_jvm/harness/tests/
chmod +x ../../../../bin/godot.linuxbsd.editor.x86_64
../../../../bin/godot.linuxbsd.editor.x86_64 --headless --export-release tests_linux
- name: Run Tests
run: |
cd modules/kotlin_jvm/harness/tests/
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/test_macos_exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ jobs:
jlink --add-modules java.base,java.logging --output jre-arm64-macos
mkdir jre-amd64-macos #create a fake jre dir for amd64 so the export is happy. The test will run on arm anyways
- name: Export tests project
run: |
cd modules/kotlin_jvm/harness/tests/
chmod +x ../../../../bin/godot.macos.editor.${{ matrix.target }}.universal
../../../../bin/godot.macos.editor.${{ matrix.target }}.universal --headless --export-release tests_macos
- name: Extract app from dmg
run: |
cd modules/kotlin_jvm/harness/tests/export
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test_windows_exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ jobs:
run: |
jlink --add-modules java.base,java.logging --output jre-amd64-windows
- name: Export tests project
run: |
cd modules/kotlin_jvm/harness/tests/
../../../../bin/godot.windows.editor.x86_64.exe --headless --export-release tests_windows
- name: Run Tests
run: |
cd modules/kotlin_jvm/harness/tests/
Expand Down
58 changes: 39 additions & 19 deletions harness/tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@ tasks {

isIgnoreExitValue = true

val editorExecutable: String = projectDir
.resolve("../../../../bin")
.listFiles()
?.also {
println("[${it.joinToString()}]")
}
?.firstOrNull { it.name.startsWith("godot.") }
?.absolutePath
?: throw Exception("Could not find editor executable")
val editorExecutable: String = provideEditorExecutable().absolutePath

if (HostManager.hostIsMingw) {
commandLine(
Expand All @@ -89,33 +81,52 @@ tasks {
)
}
}
val exportRelease by registering(Exec::class) {
description = "Exports the tests for the current host OS in release mode"
dependsOn(importResources, build)

environment("JAVA_HOME", System.getProperty("java.home"))
workingDir = projectDir

val target = when {
HostManager.hostIsLinux -> "tests_linux"
HostManager.hostIsMac -> "tests_macos"
HostManager.hostIsMingw -> "tests_windows"
else -> throw IllegalStateException("Unsupported OS for exporting")
}

doFirst {
projectDir.resolve("export").mkdirs()

commandLine(
provideEditorExecutable().absolutePath,
"--headless",
"--export-release",
target,
)
}
}
register<Exec>("runGutTests") {
group = "verification"

dependsOn(importResources)

val editorExecutable: String = projectDir
.resolve("../../../../bin")
.listFiles()
?.also {
println("[${it.joinToString()}]")
}
?.firstOrNull { it.name.startsWith("godot.") }
?.absolutePath
?: throw Exception("Could not find editor executable")
val editorExecutable: String = provideEditorExecutable().absolutePath

setupTestExecution(editorExecutable)
}
register<Exec>("runExportedGutTests") {
group = "verification"

dependsOn(importResources)
dependsOn(importResources, exportRelease)

val testExecutable: String = projectDir
.resolve("export")
.listFiles()
?.filter { it.isFile }
?.also {
println("Test executables: [${it.joinToString()}]")
it.forEach { file -> file.setExecutable(true) }
}
?.firstOrNull { file ->
listOf("exe", "x64_64", "app")
Expand Down Expand Up @@ -185,3 +196,12 @@ fun Exec.setupTestExecution(editorExecutable: String) {
)
}
}

fun provideEditorExecutable(): File = (projectDir
.resolve("../../../../bin")
.listFiles()
?.also {
println("[${it.joinToString()}]")
}
?.firstOrNull { it.name.startsWith("godot.") }
?: throw Exception("Could not find editor executable"))

0 comments on commit 4220633

Please sign in to comment.