Skip to content

Commit da1356a

Browse files
authored
Feature/ios/update to graal 23 (#619)
* feat(ios): update cap cache and remoe HomeFinderFeature in order to build ios with graal 23 * chore: update gut to 9.2.1 * feat: Use new built ios JDK in iOS export * doc: Remove experimental warning for ios and specify graal vm version to use * chore: remove ios_graal_fix.c from repo * chore: simplify gradle copyDefaultGraalIOSConfigsTask * fix: set tests to run on macos-13 runners * feat: download cap files from external project used to generate them * chore: Add special thanks to MOE community * doc: Add graal vm download link in iOS export guide * doc: Add KB to update iOS JDK version in documentation
1 parent a4c5385 commit da1356a

File tree

76 files changed

+2056
-1536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2056
-1536
lines changed

.github/workflows/check-pr-engine-editor-debug-and-tests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,13 @@ jobs:
146146
matrix:
147147
name: [ Debug, Release ]
148148
include:
149+
# TODO: update macos and Java versions
149150
- name: Debug
150-
os: macos-latest
151+
os: macos-13
151152
java-version: 11
152153
target: debug
153154
- name: Release
154-
os: macos-latest
155+
os: macos-13
155156
java-version: 11
156157
target: release
157158
runs-on: ${{ matrix.os }}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ JetBrains is helping us to develop this project by providing development tools t
5757
Intellij IDEA is our IDE of choice for Kotlin development and we strongly recommend using it.
5858

5959
[![jblogo](.README/jetbrains.svg)](https://www.jetbrains.com/)
60+
61+
## Special thanks
62+
63+
We'd like to give a special thanks to [MOE](https://multi-os-engine.org/) community. They helped us a lot to get iOS
64+
platform working. If you intend to create a multi platform mobile app (not game), check out their project.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
In order to update the JDK for iOS, you will need to follow the next steps:
2+
3+
- Create a repo similar to [ios-graal-jdk-21](https://github.com/utopia-rise/ios-graal-jdk-21).
4+
This repo should contain `labs-openjdk` repo from GraalVM for the corresponding JDK version as a submodule.
5+
It should also contain graal repo as a submodule, using release tag for the GraalVM version associated to the desired
6+
JVM version.
7+
You may need to update the git patch in this repo.
8+
You may need to update xcode projects in this repo.
9+
Once done and compiled, create a new release and upload new built static libraries to this release.
10+
- Update CAP (C Annotation Processor) cache in [cap-cache-generator](https://github.com/utopia-rise/cap-cache-generator).
11+
To do so, change your `GRAALVM_HOME` environment variable to point to the new GraalVM you're updating for.
12+
Then tag a new release and upload new CAP files in it.
13+
- Change iOS JDK versions and CAP cache versions in `libs.versions.toml` of this project.
14+
- Change graalvm version and link in [exporting guide](https://github.com/utopia-rise/godot-kotlin-jvm/blob/master/docs/src/doc/user-guide/exporting.md) iOS section.

docs/src/doc/user-guide/exporting.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,13 @@ On desktop platform default export is inferred by the `godot_kotin_configuration
103103
## iOS
104104
105105
!!! warning
106-
IOS export is experimental.
106+
With this export you don't have a choice regarding JVM version you use. Please use [GraalVM 23.1.3](https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_macos-aarch64_bin.tar.gz).
107107

108108
Additionally, to the regular GraalVM configuration mentioned above, add the following in `build.gradle.kts`:
109109

110110
```kotlin
111111
godot {
112-
isGraalNativeImageExportEnabled.set(true)
113112
graalVmDirectory.set(File("Path to your graalVM install")) // or setup GRAALVM_HOME environment variable.
114113
isIOSExportEnabled.set(true)
115114
}
116-
```
117-
118-
!!! warning
119-
With this export you don't have a choice regarding JVM embedding in the app. Godot Kotlin's Gradle plugin will automatically download a iOS static JDK libraries and pack it with your code for iOS.
115+
```

harness/tests/.gut_editor_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"res://test/unit"
77
],
88
"disable_colors": false,
9-
"double_strategy": "partial",
9+
"double_strategy": 1,
10+
"errors_do_not_cause_failure": false,
1011
"font_color": "ccccccff",
1112
"font_name": "CourierPrime",
1213
"font_size": 16,
@@ -26,6 +27,8 @@
2627
"hide_output_text": false,
2728
"hide_result_tree": false,
2829
"hide_settings": false,
30+
"output_font_name": "CourierPrime",
31+
"output_font_size": 30,
2932
"use_colors": false
3033
},
3134
"post_run_script": "",

harness/tests/addons/gut/GutScene.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func set_font(font_name):
8989

9090
func _set_font(rtl, font_name, custom_name):
9191
if(font_name == null):
92-
rtl.add_theme_font_override(custom_name, null)
92+
rtl.remove_theme_font_override(custom_name)
9393
else:
9494
var dyn_font = FontFile.new()
9595
dyn_font.load_dynamic_font('res://addons/gut/fonts/' + font_name + '.ttf')

harness/tests/addons/gut/doubler.gd

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
# ##############################################################################
2-
#(G)odot (U)nit (T)est class
3-
#
4-
# ##############################################################################
5-
# The MIT License (MIT)
6-
# =====================
7-
#
8-
# Copyright (c) 2020 Tom "Butch" Wesley
9-
#
10-
# Permission is hereby granted, free of charge, to any person obtaining a copy
11-
# of this software and associated documentation files (the "Software"), to deal
12-
# in the Software without restriction, including without limitation the rights
13-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14-
# copies of the Software, and to permit persons to whom the Software is
15-
# furnished to do so, subject to the following conditions:
16-
#
17-
# The above copyright notice and this permission notice shall be included in
18-
# all copies or substantial portions of the Software.
19-
#
20-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26-
# THE SOFTWARE.
27-
#
28-
# ##############################################################################
29-
# Description
30-
# -----------
31-
# ##############################################################################
32-
33-
34-
351
# ------------------------------------------------------------------------------
362
# A stroke of genius if I do say so. This allows for doubling a scene without
373
# having to write any files. By overloading the "instantiate" method we can
@@ -47,8 +13,21 @@ class PackedSceneDouble:
4713

4814
func instantiate(edit_state=0):
4915
var inst = _scene.instantiate(edit_state)
16+
var export_props = []
17+
var script_export_flag = (PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_SCRIPT_VARIABLE)
18+
5019
if(_script != null):
20+
if(inst.get_script() != null):
21+
# Get all the exported props and values so we can set them again
22+
for prop in inst.get_property_list():
23+
var is_export = prop.usage & (script_export_flag) == script_export_flag
24+
if(is_export):
25+
export_props.append([prop.name, inst.get(prop.name)])
26+
5127
inst.set_script(_script)
28+
for exported_value in export_props:
29+
inst.set(exported_value[0], exported_value[1])
30+
5231
return inst
5332

5433
func load_scene(path):
@@ -343,3 +322,34 @@ func partial_double_inner(parent, inner, strategy=_strategy):
343322

344323
func add_ignored_method(obj, method_name):
345324
_ignored_methods.add(obj, method_name)
325+
326+
327+
328+
# ##############################################################################
329+
#(G)odot (U)nit (T)est class
330+
#
331+
# ##############################################################################
332+
# The MIT License (MIT)
333+
# =====================
334+
#
335+
# Copyright (c) 2024 Tom "Butch" Wesley
336+
#
337+
# Permission is hereby granted, free of charge, to any person obtaining a copy
338+
# of this software and associated documentation files (the "Software"), to deal
339+
# in the Software without restriction, including without limitation the rights
340+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
341+
# copies of the Software, and to permit persons to whom the Software is
342+
# furnished to do so, subject to the following conditions:
343+
#
344+
# The above copyright notice and this permission notice shall be included in
345+
# all copies or substantial portions of the Software.
346+
#
347+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
348+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
349+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
350+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
351+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
352+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
353+
# THE SOFTWARE.
354+
#
355+
# ##############################################################################

harness/tests/addons/gut/gui/BottomPanelShortcuts.gd

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
@tool
22
extends Window
33

4+
var GutEditorGlobals = load('res://addons/gut/gui/editor_globals.gd')
5+
var default_path = GutEditorGlobals.editor_shortcuts_path
6+
47
@onready var _ctrls = {
58
run_all = $Layout/CRunAll/ShortcutButton,
69
run_current_script = $Layout/CRunCurrentScript/ShortcutButton,
@@ -9,36 +12,51 @@ extends Window
912
panel_button = $Layout/CPanelButton/ShortcutButton,
1013
}
1114

15+
var _user_prefs = GutEditorGlobals.user_prefs
16+
1217
func _ready():
1318
for key in _ctrls:
1419
var sc_button = _ctrls[key]
1520
sc_button.connect('start_edit', _on_edit_start.bind(sc_button))
1621
sc_button.connect('end_edit', _on_edit_end)
1722

18-
1923
# show dialog when running scene from editor.
2024
if(get_parent() == get_tree().root):
2125
popup_centered()
2226

27+
28+
func _cancel_all():
29+
_ctrls.run_all.cancel()
30+
_ctrls.run_current_script.cancel()
31+
_ctrls.run_current_inner.cancel()
32+
_ctrls.run_current_test.cancel()
33+
_ctrls.panel_button.cancel()
34+
2335
# ------------
2436
# Events
2537
# ------------
2638
func _on_Hide_pressed():
2739
hide()
2840

41+
2942
func _on_edit_start(which):
3043
for key in _ctrls:
3144
var sc_button = _ctrls[key]
3245
if(sc_button != which):
3346
sc_button.disable_set(true)
3447
sc_button.disable_clear(true)
3548

49+
3650
func _on_edit_end():
3751
for key in _ctrls:
3852
var sc_button = _ctrls[key]
3953
sc_button.disable_set(false)
4054
sc_button.disable_clear(false)
4155

56+
57+
func _on_popup_hide():
58+
_cancel_all()
59+
4260
# ------------
4361
# Public
4462
# ------------
@@ -57,26 +75,67 @@ func get_run_current_test():
5775
func get_panel_button():
5876
return _ctrls.panel_button.get_shortcut()
5977

78+
func _set_pref_value(pref, button):
79+
pref.value = {shortcut = button.get_shortcut().events}
6080

61-
func save_shortcuts(path):
62-
var f = ConfigFile.new()
6381

82+
func save_shortcuts():
83+
save_shortcuts_to_file(default_path)
84+
85+
86+
func save_shortcuts_to_editor_settings():
87+
_set_pref_value(_user_prefs.shortcut_run_all, _ctrls.run_all)
88+
_set_pref_value(_user_prefs.shortcut_run_current_script, _ctrls.run_current_script)
89+
_set_pref_value(_user_prefs.shortcut_run_current_inner, _ctrls.run_current_inner)
90+
_set_pref_value(_user_prefs.shortcut_run_current_test, _ctrls.run_current_test)
91+
_set_pref_value(_user_prefs.shortcut_panel_button, _ctrls.panel_button)
92+
93+
_user_prefs.save_it()
94+
95+
96+
func save_shortcuts_to_file(path):
97+
var f = ConfigFile.new()
6498
f.set_value('main', 'run_all', _ctrls.run_all.get_shortcut())
6599
f.set_value('main', 'run_current_script', _ctrls.run_current_script.get_shortcut())
66100
f.set_value('main', 'run_current_inner', _ctrls.run_current_inner.get_shortcut())
67101
f.set_value('main', 'run_current_test', _ctrls.run_current_test.get_shortcut())
68102
f.set_value('main', 'panel_button', _ctrls.panel_button.get_shortcut())
69-
70103
f.save(path)
71104

72105

73-
func load_shortcuts(path):
74-
var emptyShortcut = Shortcut.new()
106+
func _load_shortcut_from_pref(user_pref):
107+
var to_return = Shortcut.new()
108+
# value with be _user_prefs.EMPTY which is a string when the value
109+
# has not been set.
110+
if(typeof(user_pref.value) == TYPE_DICTIONARY):
111+
to_return.events.append(user_pref.value.shortcut[0])
112+
# to_return = user_pref.value
113+
return to_return
114+
115+
116+
func load_shortcuts():
117+
load_shortcuts_from_file(default_path)
118+
119+
120+
func load_shortcuts_from_editor_settings():
121+
var empty = Shortcut.new()
122+
123+
_ctrls.run_all.set_shortcut(_load_shortcut_from_pref(_user_prefs.shortcut_run_all))
124+
_ctrls.run_current_script.set_shortcut(_load_shortcut_from_pref(_user_prefs.shortcut_run_current_script))
125+
_ctrls.run_current_inner.set_shortcut(_load_shortcut_from_pref(_user_prefs.shortcut_run_current_inner))
126+
_ctrls.run_current_test.set_shortcut(_load_shortcut_from_pref(_user_prefs.shortcut_run_current_test))
127+
_ctrls.panel_button.set_shortcut(_load_shortcut_from_pref(_user_prefs.shortcut_panel_button))
128+
129+
130+
func load_shortcuts_from_file(path):
75131
var f = ConfigFile.new()
132+
var empty = Shortcut.new()
133+
76134
f.load(path)
135+
_ctrls.run_all.set_shortcut(f.get_value('main', 'run_all', empty))
136+
_ctrls.run_current_script.set_shortcut(f.get_value('main', 'run_current_script', empty))
137+
_ctrls.run_current_inner.set_shortcut(f.get_value('main', 'run_current_inner', empty))
138+
_ctrls.run_current_test.set_shortcut(f.get_value('main', 'run_current_test', empty))
139+
_ctrls.panel_button.set_shortcut(f.get_value('main', 'panel_button', empty))
140+
77141

78-
_ctrls.run_all.set_shortcut(f.get_value('main', 'run_all', emptyShortcut))
79-
_ctrls.run_current_script.set_shortcut(f.get_value('main', 'run_current_script', emptyShortcut))
80-
_ctrls.run_current_inner.set_shortcut(f.get_value('main', 'run_current_inner', emptyShortcut))
81-
_ctrls.run_current_test.set_shortcut(f.get_value('main', 'run_current_test', emptyShortcut))
82-
_ctrls.panel_button.set_shortcut(f.get_value('main', 'panel_button', emptyShortcut))

harness/tests/addons/gut/gui/BottomPanelShortcuts.tscn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ title = "Shortcuts"
88
size = Vector2i(500, 350)
99
visible = true
1010
exclusive = true
11+
unresizable = false
12+
borderless = false
1113
script = ExtResource("2")
1214

1315
[node name="Layout" type="VBoxContainer" parent="."]
@@ -147,4 +149,5 @@ custom_minimum_size = Vector2(0, 10)
147149
layout_mode = 2
148150
size_flags_horizontal = 3
149151

152+
[connection signal="popup_hide" from="." to="." method="_on_popup_hide"]
150153
[connection signal="pressed" from="Layout/HBoxContainer/Hide" to="." method="_on_Hide_pressed"]

0 commit comments

Comments
 (0)