(dir: string, spec: ProjectSpec)
| 29 | * Generates `.xcodeproj` from given project spec and saves it at given dir. |
| 30 | */ |
| 31 | export async function generateXcodeProjectAsync(dir: string, spec: ProjectSpec): Promise<string> { |
| 32 | const specPath = path.join(dir, `${spec.name}.spec.json`); |
| 33 | |
| 34 | // Save the spec to the file so `xcodegen` can use it. |
| 35 | await fs.outputJSON(specPath, spec, { |
| 36 | spaces: 2, |
| 37 | }); |
| 38 | |
| 39 | // Generate `.xcodeproj` from given spec. The binary is provided by `@expo/xcodegen` package. |
| 40 | await spawnAsync('pnpm', ['--silent', 'run', 'xcodegen', '--quiet', '--spec', specPath], { |
| 41 | cwd: EXPOTOOLS_DIR, |
| 42 | stdio: 'inherit', |
| 43 | }); |
| 44 | |
| 45 | // Remove temporary spec file. |
| 46 | await fs.remove(specPath); |
| 47 | |
| 48 | return path.join(dir, `${spec.name}.xcodeproj`); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Creates `xcodegen` spec from the podspec. It's very naive, but covers all our cases so far. |
no test coverage detected
searching dependent graphs…