MCPcopy
hub / github.com/ionic-team/capacitor / resolvePlugin

Function resolvePlugin

cli/src/android/common.ts:20–45  ·  view source on GitHub ↗
(plugin: Plugin)

Source from the content-addressed store, hash-verified

18}
19
20export 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.

Callers 1

getAndroidPluginsFunction · 0.70

Calls 3

convertToUnixPathFunction · 0.90
getPluginPlatformFunction · 0.90

Tested by

no test coverage detected