Skip to content

Commit 34f1c59

Browse files
feat: scheme selector for package:ios (#344)
* feat: scheme selector for Brownfield iOS * tweaks * changeset
1 parent 9f5219a commit 34f1c59

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

.changeset/popular-forks-watch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@rnef/platform-apple-helpers': minor
3+
'@rnef/plugin-brownfield-ios': minor
4+
---
5+
6+
Interactive Xcode scheme selector for `package:ios` command
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
export { createBuild } from './commands/build/createBuild.js';
22
export { createRun } from './commands/run/createRun.js';
3-
export {
4-
getBuildOptions,
5-
BuildFlags,
6-
} from './commands/build/buildOptions.js';
3+
export { getBuildOptions, BuildFlags } from './commands/build/buildOptions.js';
74
export { getRunOptions, RunFlags } from './commands/run/runOptions.js';
8-
export { getBuildPaths } from './utils/getBuildPaths.js'
95
export { modifyIpa, type ModifyIpaOptions } from './commands/sign/modifyIpa.js';
6+
export { getBuildPaths } from './utils/getBuildPaths.js';
7+
export { getInfo } from './utils/getInfo.js';
8+
export { getScheme } from './utils/getScheme.js';
9+
export { getValidProjectConfig } from './utils/getValidProjectConfig.js';
1010
export { promptSigningIdentity } from './utils/signingIdentities.js';
11-
export { getValidProjectConfig } from './utils/getValidProjectConfig.js';

packages/plugin-brownfield-ios/src/lib/pluginBrownfieldIos.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
createBuild,
66
getBuildOptions,
77
getBuildPaths,
8+
getInfo,
9+
getScheme,
810
getValidProjectConfig,
911
} from '@rnef/platform-apple-helpers';
1012
import { intro, outro, RnefError } from '@rnef/tools';
@@ -36,22 +38,27 @@ export const pluginBrownfieldIos =
3638
const buildFolder = args.buildFolder ?? derivedDataDir;
3739
const configuration = args.configuration ?? 'Debug';
3840

39-
if (!args.scheme) {
40-
throw new RnefError(
41-
'Scheme is required. Please provide "--scheme" flag.'
42-
);
41+
const { xcodeProject, sourceDir } = iosConfig;
42+
const info = await getInfo(xcodeProject, sourceDir);
43+
if (!info) {
44+
throw new RnefError('Failed to get Xcode project information');
4345
}
4446

47+
const scheme = await getScheme(
48+
info.schemes,
49+
args.scheme,
50+
xcodeProject.name
51+
);
4552
await createBuild({
4653
platformName: 'ios',
4754
projectConfig: iosConfig,
48-
args: { ...args, destinations, buildFolder },
55+
args: { ...args, scheme, destinations, buildFolder },
4956
projectRoot,
5057
reactNativePath: api.getReactNativePath(),
5158
});
5259

5360
await mergeFrameworks({
54-
scheme: args.scheme,
61+
scheme,
5562
configuration,
5663
sourceDir: iosConfig.sourceDir,
5764
platformName: 'ios',

0 commit comments

Comments
 (0)