|
@@ -53,11 +53,11 @@ public final class GodotPluginRegistry {
|
|
|
private static final String TAG = GodotPluginRegistry.class.getSimpleName();
|
|
|
|
|
|
/**
|
|
|
- * Prefix used for version 1 of the Godot plugin, compatible with Godot 3.x
|
|
|
+ * Prefix used for version 1 of the Godot plugin, mostly compatible with Godot 3.x
|
|
|
*/
|
|
|
private static final String GODOT_PLUGIN_V1_NAME_PREFIX = "org.godotengine.plugin.v1.";
|
|
|
/**
|
|
|
- * Prefix used for version 2 of the Godot plugin, compatible with Godot 4.x
|
|
|
+ * Prefix used for version 2 of the Godot plugin, compatible with Godot 4.2+
|
|
|
*/
|
|
|
private static final String GODOT_PLUGIN_V2_NAME_PREFIX = "org.godotengine.plugin.v2.";
|
|
|
|
|
@@ -130,12 +130,18 @@ public final class GodotPluginRegistry {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int godotPluginV2NamePrefixLength = GODOT_PLUGIN_V2_NAME_PREFIX.length();
|
|
|
for (String metaDataName : metaData.keySet()) {
|
|
|
// Parse the meta-data looking for entry with the Godot plugin name prefix.
|
|
|
+ String pluginName = null;
|
|
|
if (metaDataName.startsWith(GODOT_PLUGIN_V2_NAME_PREFIX)) {
|
|
|
- String pluginName = metaDataName.substring(godotPluginV2NamePrefixLength).trim();
|
|
|
- Log.i(TAG, "Initializing Godot v2 plugin " + pluginName);
|
|
|
+ pluginName = metaDataName.substring(GODOT_PLUGIN_V2_NAME_PREFIX.length()).trim();
|
|
|
+ } else if (metaDataName.startsWith(GODOT_PLUGIN_V1_NAME_PREFIX)) {
|
|
|
+ pluginName = metaDataName.substring(GODOT_PLUGIN_V1_NAME_PREFIX.length()).trim();
|
|
|
+ Log.w(TAG, "Godot v1 plugin are deprecated in Godot 4.2 and higher: " + pluginName);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(pluginName)) {
|
|
|
+ Log.i(TAG, "Initializing Godot plugin " + pluginName);
|
|
|
|
|
|
// Retrieve the plugin class full name.
|
|
|
String pluginHandleClassFullName = metaData.getString(metaDataName);
|
|
@@ -155,22 +161,17 @@ public final class GodotPluginRegistry {
|
|
|
"Meta-data plugin name does not match the value returned by the plugin handle: " + pluginName + " =/= " + pluginHandle.getPluginName());
|
|
|
}
|
|
|
registry.put(pluginName, pluginHandle);
|
|
|
- Log.i(TAG, "Completed initialization for Godot v2 plugin " + pluginHandle.getPluginName());
|
|
|
- } catch (ClassNotFoundException | IllegalAccessException |
|
|
|
- InstantiationException | NoSuchMethodException |
|
|
|
- InvocationTargetException e) {
|
|
|
- Log.w(TAG, "Unable to load Godot v2 plugin " + pluginName, e);
|
|
|
+ Log.i(TAG, "Completed initialization for Godot plugin " + pluginHandle.getPluginName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.w(TAG, "Unable to load Godot plugin " + pluginName, e);
|
|
|
}
|
|
|
} else {
|
|
|
Log.w(TAG, "Invalid plugin loader class for " + pluginName);
|
|
|
}
|
|
|
- } else if (metaDataName.startsWith(GODOT_PLUGIN_V1_NAME_PREFIX)) {
|
|
|
- String v1PluginName = metaDataName.substring(GODOT_PLUGIN_V1_NAME_PREFIX.length()).trim();
|
|
|
- Log.w(TAG, "Godot 4 does not support Godot 3 (v1) plugin: " + v1PluginName);
|
|
|
}
|
|
|
}
|
|
|
- } catch (PackageManager.NameNotFoundException e) {
|
|
|
- Log.e(TAG, "Unable load Godot Android v2 plugins from the manifest file.", e);
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "Unable load Godot Android plugins from the manifest file.", e);
|
|
|
}
|
|
|
}
|
|
|
}
|