|
27 | 27 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
28 | 28 | /**************************************************************************/ |
29 | 29 |
|
| 30 | +#include "export/export_plugin.h" |
30 | 31 | #include "export/validation_layers_export_plugin.h" |
31 | 32 |
|
32 | 33 | #include <godot_cpp/classes/editor_export_platform_android.hpp> |
33 | 34 | #include <godot_cpp/classes/project_settings.hpp> |
| 35 | +#include <openxr/openxr.h> |
34 | 36 |
|
35 | 37 | OpenXRValidationLayersEditorExportPlugin::OpenXRValidationLayersEditorExportPlugin() { |
36 | 38 | { |
@@ -89,10 +91,50 @@ PackedStringArray OpenXRValidationLayersEditorExportPlugin::_get_android_librari |
89 | 91 | return dependencies; |
90 | 92 | } |
91 | 93 |
|
92 | | - if ((bool)get_option("xr_features/enable_openxr_validation_layers")) { |
93 | | - const String debug_label = debug ? "debug" : "release"; |
94 | | - dependencies.append("res://addons/godotopenxrvendors/.bin/android/" + debug_label + "/openxr-validation-layers-" + debug_label + ".aar"); |
| 94 | + if (_is_enabled() && _is_android_aar_file_available(debug)) { |
| 95 | + dependencies.append(_get_android_aar_file_path(debug)); |
95 | 96 | } |
96 | 97 |
|
97 | 98 | return dependencies; |
98 | 99 | } |
| 100 | + |
| 101 | +PackedStringArray OpenXRValidationLayersEditorExportPlugin::_get_android_dependencies(const Ref<godot::EditorExportPlatform> &platform, bool debug) const { |
| 102 | + PackedStringArray dependencies; |
| 103 | + if (!_supports_platform(platform)) { |
| 104 | + return dependencies; |
| 105 | + } |
| 106 | + |
| 107 | + if (_is_enabled() && !_is_android_aar_file_available(debug)) { |
| 108 | + dependencies.append("org.godotengine:openxr-validation-layers:" + _get_version()); |
| 109 | + } |
| 110 | + return dependencies; |
| 111 | +} |
| 112 | + |
| 113 | +PackedStringArray OpenXRValidationLayersEditorExportPlugin::_get_android_dependencies_maven_repos(const Ref<godot::EditorExportPlatform> &platform, bool debug) const { |
| 114 | + PackedStringArray maven_repos; |
| 115 | + if (!_supports_platform(platform)) { |
| 116 | + return maven_repos; |
| 117 | + } |
| 118 | + |
| 119 | + if (_is_enabled() && !_is_android_aar_file_available(debug) && !_get_version().to_lower().ends_with("-stable")) { |
| 120 | + maven_repos.append("https://central.sonatype.com/repository/maven-snapshots/"); |
| 121 | + } |
| 122 | + return maven_repos; |
| 123 | +} |
| 124 | + |
| 125 | +String OpenXRValidationLayersEditorExportPlugin::_get_android_aar_file_path(bool debug) const { |
| 126 | + const String debug_label = debug ? "debug" : "release"; |
| 127 | + return "res://addons/godotopenxrvendors/.bin/android/" + debug_label + "/openxr-validation-layers-" + debug_label + ".aar"; |
| 128 | +} |
| 129 | + |
| 130 | +String OpenXRValidationLayersEditorExportPlugin::_get_version() const { |
| 131 | + String version = vformat("%d.%d.%d-%s", |
| 132 | + XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), |
| 133 | + XR_VERSION_MINOR(XR_CURRENT_API_VERSION), |
| 134 | + XR_VERSION_PATCH(XR_CURRENT_API_VERSION), |
| 135 | + PLUGIN_VERSION); |
| 136 | + if (!version.to_lower().ends_with("-stable") && !version.to_lower().ends_with("-snapshot")) { |
| 137 | + version = version + "-SNAPSHOT"; |
| 138 | + } |
| 139 | + return version; |
| 140 | +} |
0 commit comments