Skip to content

Commit

Permalink
Merge pull request #2327 from hborawski/serial-next-cocoapods
Browse files Browse the repository at this point in the history
[CocoaPods] switch Promise.all for reduce to avoid git lock
  • Loading branch information
hipstersmoothie committed Aug 10, 2023
2 parents fc78a59 + ce4650d commit beeb948
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions plugins/cocoapods/__tests__/cocoapods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ describe("Cocoapods Plugin", () => {
expect(versions).toContain("1.0.0-next.0");
expect(exec).toBeCalledTimes(6);
expect(exec).toHaveBeenCalledWith("git", ["checkout", "./Test.podspec"]);
expect(exec).toHaveBeenCalledWith("git", ["checkout", "./Test2.podspec"]);

expect(mock).toBeCalledTimes(2);
expect(mock).toHaveBeenCalledWith(
Expand Down
8 changes: 6 additions & 2 deletions plugins/cocoapods/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,12 @@ export default class CocoapodsPlugin implements IPlugin {
await this.publishPodSpec(podLogLevel);

// Reset changes to podspec file since it doesn't need to be committed
await Promise.all(
this.paths.map((path) => execPromise("git", ["checkout", path]))
await this.paths.reduce(
(promise, path) =>
promise.then(async () => {
await execPromise("git", ["checkout", path]);
}),
Promise.resolve()
);

return preReleaseVersions;
Expand Down

0 comments on commit beeb948

Please sign in to comment.