(p: Plugin, frameworks: any[])
| 122 | } |
| 123 | |
| 124 | function buildBinaryTargetEntries(p: Plugin, frameworks: any[]): { binaryTargetsText: string; binaryDepsText: string } { |
| 125 | const customXcframeworks = frameworks.filter((f: any) => f.$.custom === 'true' && f.$.src.endsWith('.xcframework')); |
| 126 | const customFrameworks = frameworks.filter((f: any) => f.$.custom === 'true' && f.$.src.endsWith('.framework')); |
| 127 | |
| 128 | if (customFrameworks.length > 0) { |
| 129 | customFrameworks.forEach((f: any) => { |
| 130 | logger.warn( |
| 131 | `${p.id}: custom .framework files are not supported as binaryTarget in SPM (${f.$.src}). Convert to .xcframework for SPM compatibility.`, |
| 132 | ); |
| 133 | }); |
| 134 | } |
| 135 | |
| 136 | const binaryTargetsText = customXcframeworks |
| 137 | .map((f: any) => { |
| 138 | const name = f.$.src.split('/').pop().replace('.xcframework', ''); |
| 139 | return `, |
| 140 | .binaryTarget( |
| 141 | name: "${name}", |
| 142 | path: "${f.$.src}" |
| 143 | )`; |
| 144 | }) |
| 145 | .join(''); |
| 146 | |
| 147 | const binaryDepsText = customXcframeworks |
| 148 | .map((f: any) => { |
| 149 | const name = f.$.src.split('/').pop().replace('.xcframework', ''); |
| 150 | return `,\n .target(name: "${name}")`; |
| 151 | }) |
| 152 | .join(''); |
| 153 | |
| 154 | return { binaryTargetsText, binaryDepsText }; |
| 155 | } |
| 156 | |
| 157 | function buildResourcesText(resources: any[]) { |
| 158 | const resourceEntry = []; |
no test coverage detected