From 8a0518be9f6f6a4be4a9f1366cb8dcb191225b9d Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 11 Nov 2021 10:59:59 +0100 Subject: [PATCH] fix(cli): Add plugin to static list if pod has use-frameworks (#5232) --- cli/src/cordova.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/cli/src/cordova.ts b/cli/src/cordova.ts index c88c667a9b..5237f6ab74 100644 --- a/cli/src/cordova.ts +++ b/cli/src/cordova.ts @@ -519,20 +519,24 @@ export function getIncompatibleCordovaPlugins(platform: string): string[] { } export function needsStaticPod(plugin: Plugin, config: Config): boolean { - let pluginList = [ - 'phonegap-plugin-push', - '@havesource/cordova-plugin-push', - 'cordova-plugin-firebasex', - '@batch.com/cordova-plugin', - 'onesignal-cordova-plugin', - 'cordova-plugin-google-analytics', - ]; + let pluginList = ['phonegap-plugin-push', '@batch.com/cordova-plugin']; if (config.app.extConfig?.cordova?.staticPlugins) { pluginList = pluginList.concat( config.app.extConfig?.cordova?.staticPlugins, ); } - return pluginList.includes(plugin.id); + return pluginList.includes(plugin.id) || useFrameworks(plugin); +} + +function useFrameworks(plugin: Plugin): boolean { + const podspecs = getPlatformElement(plugin, 'ios', 'podspec'); + const frameworkPods = podspecs.filter( + (podspec: any) => + podspec.pods.filter( + (pods: any) => pods.$ && pods.$['use-frameworks'] === 'true', + ).length > 0, + ); + return frameworkPods.length > 0; } export async function getCordovaPreferences(config: Config): Promise {