* Builds `.framework` for given target name and flavor specifying, * configuration, the SDK and a list of architectures to compile against.
(
target: string,
flavor: Flavor,
options?: XcodebuildSettings
)
| 67 | * configuration, the SDK and a list of architectures to compile against. |
| 68 | */ |
| 69 | async buildFrameworkAsync( |
| 70 | target: string, |
| 71 | flavor: Flavor, |
| 72 | options?: XcodebuildSettings |
| 73 | ): Promise<Framework> { |
| 74 | await this.xcodebuildAsync( |
| 75 | [ |
| 76 | 'build', |
| 77 | '-project', |
| 78 | `${this.name}.xcodeproj`, |
| 79 | '-scheme', |
| 80 | `${target}_iOS`, |
| 81 | '-configuration', |
| 82 | flavor.configuration, |
| 83 | '-sdk', |
| 84 | flavor.sdk, |
| 85 | ...spreadArgs('-arch', flavor.archs), |
| 86 | '-derivedDataPath', |
| 87 | SHARED_DERIVED_DATA_DIR, |
| 88 | ], |
| 89 | options |
| 90 | ); |
| 91 | |
| 92 | const frameworkPath = flavorToFrameworkPath(target, flavor); |
| 93 | const stat = await fs.lstat(path.join(frameworkPath, target)); |
| 94 | |
| 95 | // Remove `Headers` as each our module contains headers as part of the provided source code |
| 96 | // and CocoaPods exposes them through HEADER_SEARCH_PATHS either way. |
| 97 | await fs.remove(path.join(frameworkPath, 'Headers')); |
| 98 | |
| 99 | // `_CodeSignature` is apparently generated only for simulator, afaik we don't need it. |
| 100 | await fs.remove(path.join(frameworkPath, '_CodeSignature')); |
| 101 | |
| 102 | return { |
| 103 | target, |
| 104 | flavor, |
| 105 | frameworkPath, |
| 106 | binarySize: stat.size, |
| 107 | }; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Builds universal `.xcframework` from given frameworks. |
no test coverage detected