Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ indent_style = unset
indent_style = space
indent_size = 2
max_line_length = unset

# Properties
[*.json]
max_line_length = unset
22 changes: 12 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ body:
label: Godot Version
description: What version of Godot are you running?
options:
- 4.5.stable
- 4.5.1.stable
- 4.6.stable
- 4.6.1.stable
- 4.7.stable
- 4.6.3.stable
- 4.6.2.stable
- 4.6.1.stable
- 4.6.stable
- 4.5.1.stable
- 4.5.stable
- 4.x
- Other
default: 2
default: 0
validations:
required: true
- type: dropdown
Expand Down Expand Up @@ -89,15 +91,15 @@ body:
label: OS Plugin Is Running On
description: What operating system is the plugin (and your app) running on?
options:
- Android 13
- Android 14
- Android 15
- Android 16
- Android 15
- Android 14
- Android 13
- Android (other)
- iOS 18.x
- iOS 26.x
- iOS 18.x
- iOS (other)
default: 3
default: 0
validations:
required: true
- type: textarea
Expand Down
72 changes: 28 additions & 44 deletions addon/addon-build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ fun TaskContainerScope.registerGdscriptFormatTask(
fileTree("${rootProject.projectDir}/../demo") {
include("**/*.gd")
exclude("addons/**")
exclude("android/**")
exclude("ios/**")
}.files,
)
}.map { it.relativeTo(addonSrcDir).path }
Expand Down Expand Up @@ -185,41 +187,42 @@ tasks {
inputs.files(fileTree(addonSrcDir) { include("**/*.png") })
}

val allTokens: Map<String, String> by lazy {
buildMap {
project.extra.properties.forEach { (k, v) ->
val raw = v.toString()
put(
k,
if (raw.contains(",")) {
raw.split(",").joinToString(", ") { "\"${it.trim()}\"" }
} else {
raw
},
)
}
put("androidDependencies", androidDependencies.joinToString(", ") { "\"$it\"" })
put("iosFrameworks", iosFrameworks.toQuotedString())
put("iosEmbeddedFrameworks", iosEmbeddedFrameworks.toQuotedString())
put("iosLinkerFlags", iosLinkerFlags.toQuotedString())
put("iosBundleFiles", iosBundleFiles.toQuotedString())
put("spmDependencies", iosSpmDependencies.toGdscriptFormat())
}
}

register<Copy>("generateSharedGDScript") {
description = "Copies shared GDScript templates to the GMPShared output directory and replaces tokens"
group = "generate"
onlyIf("shared source directory contains GDScript or config files") {
sharedSrcDir.exists() &&
fileTree(sharedSrcDir) { include("**/*.gd", "**/*.cfg") }.files.isNotEmpty()
fileTree(sharedSrcDir) { include("**/*.gd", "**/*.cfg", "**/*.json") }.files.isNotEmpty()
}

from(sharedSrcDir)
into("$outputDir/addons/GMPShared")
include("**/*.gd", "**/*.cfg")
include("**/*.gd", "**/*.cfg", "**/*.json")

eachFile { println("[DEBUG] Processing shared file $relativePath") }

val allTokens: Map<String, String> =
buildMap {
project.extra.properties.forEach { (k, v) ->
val raw = v.toString()
put(
k,
if (raw.contains(",")) {
raw.split(",").joinToString(", ") { "\"${it.trim()}\"" }
} else {
raw
},
)
}
put("androidDependencies", androidDependencies.joinToString(", ") { "\"$it\"" })
put("iosFrameworks", iosFrameworks.toQuotedString())
put("iosEmbeddedFrameworks", iosEmbeddedFrameworks.toQuotedString())
put("iosLinkerFlags", iosLinkerFlags.toQuotedString())
put("iosBundleFiles", iosBundleFiles.toQuotedString())
put("spmDependencies", iosSpmDependencies.toGdscriptFormat())
}

filter { line: String ->
allTokens.entries.fold(line) { acc, (key, value) ->
val token = "@$key@"
Expand All @@ -235,6 +238,7 @@ tasks {
if (sharedSrcDir.exists()) inputs.dir(sharedSrcDir)
inputs.files(
rootProject.file("config/plugin.properties"),
rootProject.file("../addon/config/addon-build.properties"),
rootProject.file("../ios/config/ios.properties"),
rootProject.file("../ios/config/spm_dependencies.json"),
)
Expand Down Expand Up @@ -265,27 +269,6 @@ tasks {

eachFile { println("[DEBUG] Processing file: $relativePath") }

val allTokens: Map<String, String> =
buildMap {
project.extra.properties.forEach { (k, v) ->
val raw = v.toString()
put(
k,
if (raw.contains(",")) {
raw.split(",").joinToString(", ") { "\"${it.trim()}\"" }
} else {
raw
},
)
}
put("androidDependencies", androidDependencies.joinToString(", ") { "\"$it\"" })
put("iosFrameworks", iosFrameworks.toQuotedString())
put("iosEmbeddedFrameworks", iosEmbeddedFrameworks.toQuotedString())
put("iosLinkerFlags", iosLinkerFlags.toQuotedString())
put("iosBundleFiles", iosBundleFiles.toQuotedString())
put("spmDependencies", iosSpmDependencies.toGdscriptFormat())
}

filter { line: String ->
allTokens.entries.fold(line) { acc, (key, value) ->
val token = "@$key@"
Expand All @@ -301,6 +284,7 @@ tasks {
inputs.dir(addonSrcDir)
inputs.files(
rootProject.file("config/plugin.properties"),
rootProject.file("../addon/config/addon-build.properties"),
rootProject.file("../ios/config/ios.properties"),
rootProject.file("../ios/config/spm_dependencies.json"),
)
Expand Down
11 changes: 4 additions & 7 deletions addon/src/main/PluginTemplatePlugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,27 @@ func _exit_tree() -> void:


class AndroidExportPlugin extends EditorExportPlugin:
var _plugin_name = PLUGIN_NAME


func _supports_platform(platform: EditorExportPlatform) -> bool:
return platform is EditorExportPlatformAndroid


func _get_android_libraries(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
if debug:
return PackedStringArray(["%s/bin/debug/%s-debug.aar" % [_plugin_name, _plugin_name]])
return PackedStringArray(["%s/bin/debug/%s-debug.aar" % [PLUGIN_NAME, PLUGIN_NAME]])
else:
return PackedStringArray(["%s/bin/release/%s-release.aar" % [_plugin_name, _plugin_name]])
return PackedStringArray(["%s/bin/release/%s-release.aar" % [PLUGIN_NAME, PLUGIN_NAME]])


func _get_name() -> String:
return _plugin_name
return PLUGIN_NAME


func _get_android_dependencies(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
return PackedStringArray(ANDROID_DEPENDENCIES)


class IosExportPlugin extends EditorExportPlugin:
var _plugin_name = PLUGIN_NAME
var _spm_dependencies = []


Expand All @@ -65,7 +62,7 @@ class IosExportPlugin extends EditorExportPlugin:


func _get_name() -> String:
return _plugin_name
return PLUGIN_NAME


func _export_begin(_features: PackedStringArray, _is_debug: bool, _path: String, _flags: int) -> void:
Expand Down
22 changes: 16 additions & 6 deletions addon/src/shared/GmpLogger.gd
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
#
# © 2026-present https://github.com/<<GitHubUsername>>
# © 2026-present Godot Mobile Plugins (https://github.com/godot-mobile-plugins)
#

class_name GmpLogger extends Object

const PLUGIN_SINGLETON_NAME: String = "@pluginName@"


static func log_error(a_description: String) -> void:
push_error("%s: %s" % [PLUGIN_SINGLETON_NAME, a_description])
push_error("%s" % [a_description])


static func log_warn(a_description: String) -> void:
push_warning("%s: %s" % [PLUGIN_SINGLETON_NAME, a_description])
push_warning("%s" % [a_description])


static func log_info(a_description: String) -> void:
print_rich("[color=lime]%s: INFO: %s[/color]" % [PLUGIN_SINGLETON_NAME, a_description])
print_rich("[color=lime]INFO: %s[/color]" % [a_description])


static func error(a_plugin_name: String, a_description: String) -> void:
log_error("%s: %s" % [a_plugin_name, a_description])


static func warn(a_plugin_name: String, a_description: String) -> void:
log_warn("%s: %s" % [a_plugin_name, a_description])


static func info(a_plugin_name: String, a_description: String) -> void:
log_info("%s: %s" % [a_plugin_name, a_description])
2 changes: 1 addition & 1 deletion addon/src/shared/SpmDependency.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# © 2026-present https://github.com/<<GitHubUsername>>
# © 2026-present Godot Mobile Plugins (https://github.com/godot-mobile-plugins)
#

class_name SpmDependency extends RefCounted
Expand Down
Loading