diff --git a/cli/src/cordova.ts b/cli/src/cordova.ts index 30b01e515..4594288aa 100644 --- a/cli/src/cordova.ts +++ b/cli/src/cordova.ts @@ -518,14 +518,19 @@ export function getIncompatibleCordovaPlugins(platform: string): string[] { return pluginList; } -export function needsStaticPod(plugin: Plugin): boolean { - const pluginList = [ +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', ]; + if (config.app.extConfig?.cordova?.staticPlugins) { + pluginList = pluginList.concat( + config.app.extConfig?.cordova?.staticPlugins, + ); + } return pluginList.includes(plugin.id); } diff --git a/cli/src/declarations.ts b/cli/src/declarations.ts index 570a6ff4b..f609d095e 100644 --- a/cli/src/declarations.ts +++ b/cli/src/declarations.ts @@ -442,6 +442,14 @@ export interface CapacitorConfig { * @since 1.3.0 */ preferences?: { [key: string]: string | undefined }; + + /** + * List of Cordova plugins that need to be static but are not + * already in the static plugin list. + * + * @since 3.3.0 + */ + staticPlugins?: string[]; }; /** diff --git a/cli/src/ios/update.ts b/cli/src/ios/update.ts index 5e248de1f..74deabc58 100644 --- a/cli/src/ios/update.ts +++ b/cli/src/ios/update.ts @@ -195,7 +195,7 @@ async function generatePodFile( }); }); }); - const staticPlugins = cordovaPlugins.filter(needsStaticPod); + const staticPlugins = cordovaPlugins.filter(p => needsStaticPod(p, config)); const noStaticPlugins = cordovaPlugins.filter( el => !staticPlugins.includes(el), ); @@ -241,7 +241,7 @@ async function generateCordovaPodspecs( cordovaPlugins: Plugin[], config: Config, ) { - const staticPlugins = cordovaPlugins.filter(needsStaticPod); + const staticPlugins = cordovaPlugins.filter(p => needsStaticPod(p, config)); const noStaticPlugins = cordovaPlugins.filter( el => !staticPlugins.includes(el), ); @@ -424,7 +424,7 @@ async function copyPluginsNativeFiles( const codeFiles = sourceFiles.concat(headerFiles); const frameworks = getPlatformElement(p, platform, 'framework'); let sourcesFolderName = 'sources'; - if (needsStaticPod(p)) { + if (needsStaticPod(p, config)) { sourcesFolderName += 'static'; } const sourcesFolder = join(