From efd1c37aa8531c0a9e0fe5fe390b5d1e27f617e6 Mon Sep 17 00:00:00 2001 From: Vadko Date: Fri, 30 May 2025 16:13:03 +0300 Subject: [PATCH 1/2] fix: container xcodeproj location resolution --- .../src/tools/__tests__/getInfo.test.ts | 30 ++++++++++++++++++- .../cli-platform-apple/src/tools/getInfo.ts | 13 ++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts b/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts index 8dbde0ff0..72f43c0d8 100644 --- a/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts +++ b/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts @@ -16,7 +16,7 @@ describe('getInfo', () => { it('handles non-project / workspace locations in a ', () => { const name = `YourProjectName`; (fs.readFileSync as jest.Mock) - .mockReturnValueOnce(` + .mockReturnValueOnce(` { (execa.sync as jest.Mock).mockReturnValue({stdout: '{}'}); getInfo({isWorkspace: true, name} as IOSProjectInfo, 'some/path'); + const execaSync = execa.sync as jest.Mock; + // Should not call on Pods or the other misc groups + expect(execaSync.mock.calls).toEqual([ + [ + 'xcodebuild', + ['-list', '-json', '-project', `some/path/${name}.xcodeproj`], + ], + ]); + }); + it('handles xcodeproj location in container in a ', () => { + const name = `YourProjectName`; + (fs.readFileSync as jest.Mock) + .mockReturnValueOnce(` + + + + + + + +`); + (execa.sync as jest.Mock).mockReturnValue({stdout: '{}'}); + getInfo({isWorkspace: true, name} as IOSProjectInfo, 'some/path'); + const execaSync = execa.sync as jest.Mock; // Should not call on Pods or the other misc groups expect(execaSync.mock.calls).toEqual([ diff --git a/packages/cli-platform-apple/src/tools/getInfo.ts b/packages/cli-platform-apple/src/tools/getInfo.ts index 7f45855d7..e38974921 100644 --- a/packages/cli-platform-apple/src/tools/getInfo.ts +++ b/packages/cli-platform-apple/src/tools/getInfo.ts @@ -5,12 +5,12 @@ import * as fs from 'fs'; import * as path from 'path'; import type {IosInfo} from '../types'; -function isErrorLike(err: unknown): err is {message: string} { +function isErrorLike(err: unknown): err is { message: string } { return Boolean( err && - typeof err === 'object' && - 'message' in err && - typeof err.message === 'string', + typeof err === 'object' && + 'message' in err && + typeof err.message === 'string', ); } @@ -72,7 +72,10 @@ export function getInfo( '-list', '-json', '-project', - path.join(sourceDir, location.replace('group:', '')), + path.join( + sourceDir, + location.replace('group:', '').replace('container:', ''), + ), ]); const info = parseTargetList(xcodebuild.stdout); if (!info) { From e22aa08115d5ba0782177043616292bd1b20996d Mon Sep 17 00:00:00 2001 From: Vadko Date: Fri, 30 May 2025 16:22:47 +0300 Subject: [PATCH 2/2] lint fixes --- .../src/tools/__tests__/getInfo.test.ts | 4 ++-- packages/cli-platform-apple/src/tools/getInfo.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts b/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts index 72f43c0d8..d89b1289d 100644 --- a/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts +++ b/packages/cli-platform-apple/src/tools/__tests__/getInfo.test.ts @@ -16,7 +16,7 @@ describe('getInfo', () => { it('handles non-project / workspace locations in a ', () => { const name = `YourProjectName`; (fs.readFileSync as jest.Mock) - .mockReturnValueOnce(` + .mockReturnValueOnce(` { it('handles xcodeproj location in container in a ', () => { const name = `YourProjectName`; (fs.readFileSync as jest.Mock) - .mockReturnValueOnce(` + .mockReturnValueOnce(`