(plugin: Plugin)
| 18 | } |
| 19 | |
| 20 | export async function resolvePlugin(plugin: Plugin): Promise<Plugin | null> { |
| 21 | const platform = 'android'; |
| 22 | if (plugin.manifest?.android) { |
| 23 | let pluginFilesPath = plugin.manifest.android.src ? plugin.manifest.android.src : platform; |
| 24 | const absolutePath = join(plugin.rootPath, pluginFilesPath, plugin.id); |
| 25 | // Android folder shouldn't have subfolders, but they used to, so search for them for compatibility reasons |
| 26 | if (await pathExists(absolutePath)) { |
| 27 | pluginFilesPath = join(platform, plugin.id); |
| 28 | } |
| 29 | plugin.android = { |
| 30 | type: PluginType.Core, |
| 31 | path: convertToUnixPath(pluginFilesPath), |
| 32 | }; |
| 33 | } else if (plugin.xml) { |
| 34 | plugin.android = { |
| 35 | type: PluginType.Cordova, |
| 36 | path: 'src/' + platform, |
| 37 | }; |
| 38 | if (getIncompatibleCordovaPlugins(platform).includes(plugin.id) || !getPluginPlatform(plugin, platform)) { |
| 39 | plugin.android.type = PluginType.Incompatible; |
| 40 | } |
| 41 | } else { |
| 42 | return null; |
| 43 | } |
| 44 | return plugin; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Update an Android project with the desired app name and appId. |
no test coverage detected