({
cacheRoot,
cachedAppPath,
plist,
source,
targetArch,
})
| 63 | } |
| 64 | |
| 65 | function buildFixtureIntoCache({ |
| 66 | cacheRoot, |
| 67 | cachedAppPath, |
| 68 | plist, |
| 69 | source, |
| 70 | targetArch, |
| 71 | }) { |
| 72 | const stagingRoot = `${cacheRoot}.tmp-${process.pid}-${Date.now()}`; |
| 73 | const stagingApp = path.join(stagingRoot, `${executable}.app`); |
| 74 | fs.rmSync(stagingRoot, { recursive: true, force: true }); |
| 75 | fs.mkdirSync(stagingApp, { recursive: true }); |
| 76 | |
| 77 | const plistPath = path.join(stagingApp, "Info.plist"); |
| 78 | const sourcePath = path.join(stagingRoot, `${executable}.m`); |
| 79 | fs.writeFileSync(plistPath, plist); |
| 80 | fs.writeFileSync(sourcePath, source); |
| 81 | |
| 82 | run("xcrun", [ |
| 83 | "--sdk", |
| 84 | "iphonesimulator", |
| 85 | "clang", |
| 86 | "-target", |
| 87 | `${targetArch}-apple-ios${minimumIosVersion}-simulator`, |
| 88 | "-fobjc-arc", |
| 89 | "-fmodules", |
| 90 | "-framework", |
| 91 | "UIKit", |
| 92 | "-framework", |
| 93 | "Foundation", |
| 94 | sourcePath, |
| 95 | "-o", |
| 96 | path.join(stagingApp, executable), |
| 97 | ]); |
| 98 | |
| 99 | fs.rmSync(cacheRoot, { recursive: true, force: true }); |
| 100 | fs.mkdirSync(path.dirname(cacheRoot), { recursive: true }); |
| 101 | fs.renameSync(stagingRoot, cacheRoot); |
| 102 | |
| 103 | if (!isUsableApp(cachedAppPath)) { |
| 104 | throw new Error(`Cached fixture app was not created at ${cachedAppPath}`); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | function fixtureInfoPlist(bundleId, urlScheme) { |
| 109 | return `<?xml version="1.0" encoding="UTF-8"?> |
no test coverage detected