Skip to content

Commit

Permalink
Merge branch 'master' into feature/gradleSubProjectSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontrider authored Mar 18, 2024
2 parents 32b60a3 + b75c6b8 commit 2293644
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/dsl/GodleExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ abstract class GodleExtension @Inject constructor(objectFactory: ObjectFactory,
//set it to true, to create a blank godot project in the godot root.
var createBlankProject = true

/** When `true`, Godle will create several scripts to quickstart the Godot editor. */
var generateQuickstartScripts = true

val env = HashMap<String, String>()
fun env(key: String, value: String) {
env[key] = value
Expand Down
38 changes: 38 additions & 0 deletions src/main/kotlin/initializers/initBaseGodot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,42 @@ internal fun Project.initBaseGodot() {
}
}
}
}

private fun Project.generateQuickstartScripts(extension: GodleExtension) {
//ignore the gradle wrapper's folder.
if (File(project.rootDir, "gradle/").exists()) {
val file = File(project.rootDir, "gradle/.gdignore")
if (!file.exists()) {
file.writeText("")
}
}
//create runner scripts
// Not in a task, to make it less cumbersome.
File(project.rootDir, "editor.sh").apply {
if (!exists()) {
writeText(
"#!/bin/sh \n./gradlew godotEditor"
)
}
}
File(project.rootDir, "editor.bat").apply {
if (!exists()) {
writeText(
"gradlew.bat godotEditor"
)
}
}
File(project.rootDir, "game.sh").apply {
if (!exists()) {
writeText(
"#!/bin/sh \n./gradlew godotRunGame"
)
}
}
File(project.rootDir, "game.bat").apply {
if (!exists()) {
writeText("call gradlew.bat godotRunGame")
}
}
}

0 comments on commit 2293644

Please sign in to comment.