-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): check Pods Manifest.lock earlier (#3374)
- Loading branch information
Showing
8 changed files
with
94 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rnx-kit/cli": patch | ||
--- | ||
|
||
Check Pods Manifest.lock earlier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rnx-kit/tools-apple": patch | ||
--- | ||
|
||
Added a new function, `checkPodsManifestLock`, for checking whether the | ||
CocoaPods sandbox is in sync with its `Podfile.lock` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import * as fs from "node:fs"; | ||
import * as path from "node:path"; | ||
|
||
function equalFiles(aPath: string, bPath: string): boolean { | ||
if (fs.lstatSync(aPath).size !== fs.lstatSync(bPath).size) { | ||
return false; | ||
} | ||
|
||
const af = fs.openSync(aPath, "r"); | ||
const bf = fs.openSync(bPath, "r"); | ||
|
||
const bufsize = 16 * 1024; | ||
const aBuf = Buffer.alloc(bufsize); | ||
const bBuf = Buffer.alloc(bufsize); | ||
|
||
try { | ||
let aRead = 0; | ||
do { | ||
aRead = fs.readSync(af, aBuf, 0, aBuf.length, null); | ||
const bRead = fs.readSync(bf, bBuf, 0, bBuf.length, null); | ||
if (aRead !== bRead || !aBuf.equals(bBuf)) { | ||
return false; | ||
} | ||
} while (aRead > 0); | ||
} finally { | ||
fs.closeSync(af); | ||
fs.closeSync(bf); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Returns whether the CocoaPods sandbox is in sync with its `Podfile.lock`. | ||
*/ | ||
export function checkPodsManifestLock(xcworkspace: string): boolean { | ||
const workspaceDir = path.dirname(xcworkspace); | ||
const podfileLock = path.join(workspaceDir, "Podfile.lock"); | ||
const manifestLock = path.join(workspaceDir, "Pods", "Manifest.lock"); | ||
return ( | ||
fs.existsSync(podfileLock) && | ||
fs.existsSync(manifestLock) && | ||
equalFiles(podfileLock, manifestLock) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { checkPodsManifestLock } from "./cocoapods.js"; | ||
export { | ||
bootSimulator, | ||
getAvailableSimulators, | ||
|