Skip to content

Commit 5665188

Browse files
authored
Merge pull request #20 from dsnopek/update-ubuntu-22-04
Update CI to use Ubuntu 22.04 and fix clang format issues
2 parents bb01430 + 85e7abd commit 5665188

File tree

12 files changed

+190
-224
lines changed

12 files changed

+190
-224
lines changed

.github/workflows/build-addon-on-push.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
matrix:
2323
include:
2424
- name: 🐧 Linux (x86_64)
25-
os: ubuntu-20.04
25+
os: ubuntu-22.04
2626
platform: linux
2727
flags: arch=x86_64
2828
artifact_name: godotmetatoolkit-build-files-linux-x86_64
@@ -42,7 +42,7 @@ jobs:
4242
artifact_path: godot_meta_toolkit/demo/addons/godot_meta_toolkit/.bin/macos/*/*.framework
4343
cache-name: macos-universal
4444
- name: 🤖 Android (arm64)
45-
os: ubuntu-20.04
45+
os: ubuntu-22.04
4646
platform: android
4747
flags: arch=arm64
4848
artifact_name: godotmetatoolkit-build-files-android
@@ -116,7 +116,7 @@ jobs:
116116
117117
asset:
118118
name: Assembling the asset
119-
runs-on: ubuntu-20.04
119+
runs-on: ubuntu-22.04
120120
needs: build
121121

122122
steps:

.github/workflows/static_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push, pull_request]
55
jobs:
66
static-checks:
77
name: Formatting (clang-format, file format)
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-22.04
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v4

doc_classes/MetaToolkitEditorPlugin.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

doc_classes/MetaToolkitExportPlugin.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

doc_classes/MetaXRSimulatorDialog.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

toolkit/src/main/cpp/editor/meta_toolkit_editor_plugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ void MetaToolkitEditorPlugin::_bind_methods() {
77
}
88

99
void MetaToolkitEditorPlugin::_notification(uint32_t p_what) {
10-
switch (p_what) {
11-
case NOTIFICATION_POSTINITIALIZE: {
10+
switch (p_what) {
11+
case NOTIFICATION_POSTINITIALIZE: {
1212
_meta_xr_simulator_dialog = memnew(MetaXRSimulatorDialog);
1313
add_child(_meta_xr_simulator_dialog);
1414
} break;
@@ -21,7 +21,7 @@ void MetaToolkitEditorPlugin::_notification(uint32_t p_what) {
2121
add_export_plugin(_meta_toolkit_export_plugin);
2222
} break;
2323

24-
case NOTIFICATION_EXIT_TREE: {
24+
case NOTIFICATION_EXIT_TREE: {
2525
remove_tool_menu_item("Configure Meta XR Simulator...");
2626

2727
// Clean up the editor export plugin

toolkit/src/main/cpp/editor/meta_xr_simulator_dialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void MetaXRSimulatorDialog::_bind_methods() {
3333
}
3434

3535
void MetaXRSimulatorDialog::_notification(uint32_t p_what) {
36-
switch (p_what) {
37-
case NOTIFICATION_POSTINITIALIZE: {
36+
switch (p_what) {
37+
case NOTIFICATION_POSTINITIALIZE: {
3838
_file_dialog = memnew(EditorFileDialog);
3939
_file_dialog->connect("file_selected", callable_mp(this, &MetaXRSimulatorDialog::_on_file_selected));
4040
_file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);

toolkit/src/main/cpp/export/meta_toolkit_export_plugin.cpp

Lines changed: 131 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -15,166 +15,164 @@ static const char *TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH = "res://addons/godot_
1515
} // namespace
1616

1717
MetaToolkitExportPlugin::MetaToolkitExportPlugin() {
18-
_enable_meta_toolkit_option = _generate_export_option(
19-
"meta_toolkit/enable_meta_toolkit",
20-
"",
21-
Variant::Type::BOOL,
22-
PROPERTY_HINT_NONE,
23-
"",
24-
PROPERTY_USAGE_DEFAULT,
25-
false,
26-
true);
18+
_enable_meta_toolkit_option = _generate_export_option(
19+
"meta_toolkit/enable_meta_toolkit",
20+
"",
21+
Variant::Type::BOOL,
22+
PROPERTY_HINT_NONE,
23+
"",
24+
PROPERTY_USAGE_DEFAULT,
25+
false,
26+
true);
2727
}
2828

2929
void MetaToolkitExportPlugin::_bind_methods() {}
3030

3131
Dictionary MetaToolkitExportPlugin::_generate_export_option(const godot::String &p_name,
32-
const godot::String &p_class_name,
33-
Variant::Type p_type,
34-
godot::PropertyHint p_property_hint,
35-
const godot::String &p_hint_string,
36-
godot::PropertyUsageFlags p_property_usage,
37-
const godot::Variant &p_default_value,
38-
bool p_update_visibility) {
39-
Dictionary option_info;
40-
option_info["name"] = p_name;
41-
option_info["class_name"] = p_class_name;
42-
option_info["type"] = p_type;
43-
option_info["hint"] = p_property_hint;
44-
option_info["hint_string"] = p_hint_string;
45-
option_info["usage"] = p_property_usage;
46-
47-
Dictionary export_option;
48-
export_option["option"] = option_info;
49-
export_option["default_value"] = p_default_value;
50-
export_option["update_visibility"] = p_update_visibility;
51-
52-
return export_option;
32+
const godot::String &p_class_name,
33+
Variant::Type p_type,
34+
godot::PropertyHint p_property_hint,
35+
const godot::String &p_hint_string,
36+
godot::PropertyUsageFlags p_property_usage,
37+
const godot::Variant &p_default_value,
38+
bool p_update_visibility) {
39+
Dictionary option_info;
40+
option_info["name"] = p_name;
41+
option_info["class_name"] = p_class_name;
42+
option_info["type"] = p_type;
43+
option_info["hint"] = p_property_hint;
44+
option_info["hint_string"] = p_hint_string;
45+
option_info["usage"] = p_property_usage;
46+
47+
Dictionary export_option;
48+
export_option["option"] = option_info;
49+
export_option["default_value"] = p_default_value;
50+
export_option["update_visibility"] = p_update_visibility;
51+
52+
return export_option;
5353
}
5454

5555
bool MetaToolkitExportPlugin::_supports_platform(const Ref<godot::EditorExportPlatform> &p_platform) const {
56-
return p_platform->is_class(EditorExportPlatformAndroid::get_class_static());
56+
return p_platform->is_class(EditorExportPlatformAndroid::get_class_static());
5757
}
5858

5959
bool MetaToolkitExportPlugin::_get_bool_option(const godot::String &p_option) const {
60-
Variant option_enabled = get_option(p_option);
61-
if (option_enabled.get_type() == Variant::Type::BOOL) {
62-
return option_enabled;
63-
}
64-
return false;
60+
Variant option_enabled = get_option(p_option);
61+
if (option_enabled.get_type() == Variant::Type::BOOL) {
62+
return option_enabled;
63+
}
64+
return false;
6565
}
6666

6767
TypedArray<Dictionary> MetaToolkitExportPlugin::_get_export_options(const Ref<godot::EditorExportPlatform> &p_platform) const {
68-
TypedArray<Dictionary> export_options;
69-
if (!_supports_platform(p_platform)) {
70-
return export_options;
71-
}
68+
TypedArray<Dictionary> export_options;
69+
if (!_supports_platform(p_platform)) {
70+
return export_options;
71+
}
7272

73-
export_options.append(_enable_meta_toolkit_option);
73+
export_options.append(_enable_meta_toolkit_option);
7474

75-
return export_options;
75+
return export_options;
7676
}
7777

7878
String MetaToolkitExportPlugin::_get_export_option_warning(
79-
const Ref<godot::EditorExportPlatform> &p_platform, const godot::String &p_option) const {
80-
return "";
79+
const Ref<godot::EditorExportPlatform> &p_platform, const godot::String &p_option) const {
80+
return "";
8181
}
8282

8383
Dictionary MetaToolkitExportPlugin::_get_export_options_overrides(
84-
const Ref<godot::EditorExportPlatform> &p_platform) const {
85-
Dictionary overrides;
86-
if (!_supports_platform(p_platform)) {
87-
return overrides;
88-
}
89-
90-
// Check if this plugin is enabled
91-
if (!_get_bool_option("meta_toolkit/enable_meta_toolkit")) {
92-
return overrides;
93-
}
94-
95-
// Gradle build overrides
96-
overrides["gradle_build/use_gradle_build"] = true;
97-
overrides["gradle_build/export_format"] = 0; // apk
98-
overrides["gradle_build/min_sdk"] = "29"; // Android 10
99-
overrides["gradle_build/target_sdk"] = "32"; // Android 12
100-
101-
// Check if we have an alternate build template
102-
if (FileAccess::file_exists(TOOLKIT_BUILD_TEMPLATE_ZIP_PATH)) {
103-
overrides["gradle_build/gradle_build_directory"] = "res://addons/godot_meta_toolkit/build";
104-
overrides["gradle_build/android_source_template"] = TOOLKIT_BUILD_TEMPLATE_ZIP_PATH;
105-
}
106-
107-
// Check if we have a debug keystore available
108-
if (FileAccess::file_exists(TOOLKIT_DEBUG_KEYSTORE_PATH)
109-
&& FileAccess::file_exists(TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH)) {
110-
// Read the debug keystore user and password from the properties file
111-
// The file should contain the following lines:
112-
// key.alias=platformkeystore
113-
// key.alias.password=android
114-
Ref<FileAccess> file_access = FileAccess::open(TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH, FileAccess::ModeFlags::READ);
115-
if (file_access.is_valid()) {
116-
String debug_user;
117-
String debug_password;
118-
119-
while (file_access->get_position() < file_access->get_length()
120-
&& (debug_user.is_empty() || debug_password.is_empty())) {
121-
String current_line = file_access->get_line();
122-
PackedStringArray current_line_splits = current_line.split("=", false);
123-
if (current_line_splits.size() == 2) {
124-
if (current_line_splits[0] == "key.alias") {
125-
debug_user = current_line_splits[1];
126-
} else if (current_line_splits[0] == "key.alias.password") {
127-
debug_password = current_line_splits[1];
128-
}
129-
}
130-
}
131-
132-
if (!debug_user.is_empty() && !debug_password.is_empty()) {
133-
overrides["keystore/debug"] = ProjectSettings::get_singleton()->globalize_path(TOOLKIT_DEBUG_KEYSTORE_PATH);
134-
overrides["keystore/debug_user"] = debug_user;
135-
overrides["keystore/debug_password"] = debug_password;
136-
}
137-
}
138-
}
139-
140-
// Architectures overrides
141-
overrides["architectures/armeabi-v7a"] = false;
142-
overrides["architectures/arm64-v8a"] = true;
143-
overrides["architectures/x86"] = false;
144-
overrides["architectures/x86_64"] = false;
145-
146-
// Package overrides
147-
overrides["package/show_in_android_tv"] = false;
148-
149-
// Screen overrides
150-
overrides["screen/immersive_mode"] = true;
151-
overrides["screen/support_small"] = true;
152-
overrides["screen/support_normal"] = true;
153-
overrides["screen/support_large"] = true;
154-
overrides["screen/support_xlarge"] = true;
155-
156-
// XR features overrides
157-
overrides["xr_features/xr_mode"] = 1; // OpenXR mode
158-
overrides["xr_features/enable_khronos_plugin"] = false;
159-
overrides["xr_features/enable_lynx_plugin"] = false;
160-
overrides["xr_features/enable_meta_plugin"] = true;
161-
overrides["xr_features/enable_pico_plugin"] = false;
162-
163-
return overrides;
84+
const Ref<godot::EditorExportPlatform> &p_platform) const {
85+
Dictionary overrides;
86+
if (!_supports_platform(p_platform)) {
87+
return overrides;
88+
}
89+
90+
// Check if this plugin is enabled
91+
if (!_get_bool_option("meta_toolkit/enable_meta_toolkit")) {
92+
return overrides;
93+
}
94+
95+
// Gradle build overrides
96+
overrides["gradle_build/use_gradle_build"] = true;
97+
overrides["gradle_build/export_format"] = 0; // apk
98+
overrides["gradle_build/min_sdk"] = "29"; // Android 10
99+
overrides["gradle_build/target_sdk"] = "32"; // Android 12
100+
101+
// Check if we have an alternate build template
102+
if (FileAccess::file_exists(TOOLKIT_BUILD_TEMPLATE_ZIP_PATH)) {
103+
overrides["gradle_build/gradle_build_directory"] = "res://addons/godot_meta_toolkit/build";
104+
overrides["gradle_build/android_source_template"] = TOOLKIT_BUILD_TEMPLATE_ZIP_PATH;
105+
}
106+
107+
// Check if we have a debug keystore available
108+
if (FileAccess::file_exists(TOOLKIT_DEBUG_KEYSTORE_PATH) && FileAccess::file_exists(TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH)) {
109+
// Read the debug keystore user and password from the properties file
110+
// The file should contain the following lines:
111+
// key.alias=platformkeystore
112+
// key.alias.password=android
113+
Ref<FileAccess> file_access = FileAccess::open(TOOLKIT_DEBUG_KEYSTORE_PROPERTIES_PATH, FileAccess::ModeFlags::READ);
114+
if (file_access.is_valid()) {
115+
String debug_user;
116+
String debug_password;
117+
118+
while (file_access->get_position() < file_access->get_length() && (debug_user.is_empty() || debug_password.is_empty())) {
119+
String current_line = file_access->get_line();
120+
PackedStringArray current_line_splits = current_line.split("=", false);
121+
if (current_line_splits.size() == 2) {
122+
if (current_line_splits[0] == "key.alias") {
123+
debug_user = current_line_splits[1];
124+
} else if (current_line_splits[0] == "key.alias.password") {
125+
debug_password = current_line_splits[1];
126+
}
127+
}
128+
}
129+
130+
if (!debug_user.is_empty() && !debug_password.is_empty()) {
131+
overrides["keystore/debug"] = ProjectSettings::get_singleton()->globalize_path(TOOLKIT_DEBUG_KEYSTORE_PATH);
132+
overrides["keystore/debug_user"] = debug_user;
133+
overrides["keystore/debug_password"] = debug_password;
134+
}
135+
}
136+
}
137+
138+
// Architectures overrides
139+
overrides["architectures/armeabi-v7a"] = false;
140+
overrides["architectures/arm64-v8a"] = true;
141+
overrides["architectures/x86"] = false;
142+
overrides["architectures/x86_64"] = false;
143+
144+
// Package overrides
145+
overrides["package/show_in_android_tv"] = false;
146+
147+
// Screen overrides
148+
overrides["screen/immersive_mode"] = true;
149+
overrides["screen/support_small"] = true;
150+
overrides["screen/support_normal"] = true;
151+
overrides["screen/support_large"] = true;
152+
overrides["screen/support_xlarge"] = true;
153+
154+
// XR features overrides
155+
overrides["xr_features/xr_mode"] = 1; // OpenXR mode
156+
overrides["xr_features/enable_khronos_plugin"] = false;
157+
overrides["xr_features/enable_lynx_plugin"] = false;
158+
overrides["xr_features/enable_meta_plugin"] = true;
159+
overrides["xr_features/enable_pico_plugin"] = false;
160+
161+
return overrides;
164162
}
165163

166164
PackedStringArray MetaToolkitExportPlugin::_get_android_libraries(const Ref<godot::EditorExportPlatform> &p_platform, bool p_debug) const {
167-
PackedStringArray dependencies;
168-
if (!_supports_platform(p_platform)) {
169-
return dependencies;
170-
}
165+
PackedStringArray dependencies;
166+
if (!_supports_platform(p_platform)) {
167+
return dependencies;
168+
}
171169

172-
// Check if the Godot Meta toolkit aar dependency is available
173-
const String debug_label = p_debug ? "debug" : "release";
170+
// Check if the Godot Meta toolkit aar dependency is available
171+
const String debug_label = p_debug ? "debug" : "release";
174172
const String toolkit_aar_file_path = "res://addons/godot_meta_toolkit/.bin/android/" + debug_label + "/godot_meta_toolkit-" + debug_label + ".aar";
175173
if (FileAccess::file_exists(toolkit_aar_file_path)) {
176-
dependencies.append(toolkit_aar_file_path);
177-
}
174+
dependencies.append(toolkit_aar_file_path);
175+
}
178176

179-
return dependencies;
177+
return dependencies;
180178
}

0 commit comments

Comments
 (0)