(config: Config, plugins: Plugin[])
| 367 | } |
| 368 | |
| 369 | async function generatePodFile(config: Config, plugins: Plugin[]): Promise<string> { |
| 370 | const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config); |
| 371 | |
| 372 | const capacitorPlugins = plugins.filter((p) => getPluginType(p, platform) === PluginType.Core); |
| 373 | const pods = await Promise.all( |
| 374 | capacitorPlugins.map(async (p) => { |
| 375 | if (!p.ios) { |
| 376 | return ''; |
| 377 | } |
| 378 | |
| 379 | return ` pod '${p.ios.name}', :path => '${convertToUnixPath( |
| 380 | relative(config.ios.nativeProjectDirAbs, await realpath(p.rootPath)), |
| 381 | )}'\n`; |
| 382 | }), |
| 383 | ); |
| 384 | const cordovaPlugins = plugins.filter((p) => getPluginType(p, platform) === PluginType.Cordova); |
| 385 | cordovaPlugins.map(async (p) => { |
| 386 | const podspecs = getPlatformElement(p, platform, 'podspec'); |
| 387 | podspecs.map((podspec: any) => { |
| 388 | podspec.pods.map((pPods: any) => { |
| 389 | pPods.pod.map((pod: any) => { |
| 390 | if (pod.$.git) { |
| 391 | let gitRef = ''; |
| 392 | if (pod.$.tag) { |
| 393 | gitRef = `, :tag => '${pod.$.tag}'`; |
| 394 | } else if (pod.$.branch) { |
| 395 | gitRef = `, :branch => '${pod.$.branch}'`; |
| 396 | } else if (pod.$.commit) { |
| 397 | gitRef = `, :commit => '${pod.$.commit}'`; |
| 398 | } |
| 399 | pods.push(` pod '${pod.$.name}', :git => '${pod.$.git}'${gitRef}\n`); |
| 400 | } |
| 401 | }); |
| 402 | }); |
| 403 | }); |
| 404 | }); |
| 405 | const staticPlugins = cordovaPlugins.filter((p) => needsStaticPod(p)); |
| 406 | const noStaticPlugins = cordovaPlugins.filter((el) => !staticPlugins.includes(el)); |
| 407 | if (noStaticPlugins.length > 0) { |
| 408 | pods.push(` pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'\n`); |
| 409 | } |
| 410 | if (staticPlugins.length > 0) { |
| 411 | pods.push(` pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'\n`); |
| 412 | } |
| 413 | const resourcesPlugins = cordovaPlugins.filter(filterResources); |
| 414 | if (resourcesPlugins.length > 0) { |
| 415 | pods.push(` pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'\n`); |
| 416 | } |
| 417 | return ` |
| 418 | pod 'Capacitor', :path => '${relativeCapacitoriOSPath}' |
| 419 | pod 'CapacitorCordova', :path => '${relativeCapacitoriOSPath}' |
| 420 | ${pods.join('').trimRight()}`; |
| 421 | } |
| 422 | |
| 423 | function getFrameworkName(framework: any) { |
| 424 | if (isFramework(framework)) { |
no test coverage detected