Skip to content

Commit

Permalink
feat(cli): configurable iOS build scheme (#4073)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Jan 19, 2021
1 parent 13e9860 commit e6374dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ async function loadIOSConfig(
const podPath = determineCocoapodPath();
const platformDir = extConfig.ios?.path ?? 'ios';
const platformDirAbs = resolve(rootDir, platformDir);
const scheme = extConfig.ios?.scheme ?? 'App';
const nativeProjectDir = 'App';
const nativeProjectDirAbs = resolve(platformDirAbs, nativeProjectDir);
const nativeTargetDir = `${nativeProjectDir}/App`;
Expand All @@ -285,6 +286,7 @@ async function loadIOSConfig(
minVersion: '12.0',
platformDir,
platformDirAbs,
scheme,
cordovaPluginsDir,
cordovaPluginsDirAbs: resolve(platformDirAbs, cordovaPluginsDir),
nativeProjectDir,
Expand Down
15 changes: 15 additions & 0 deletions cli/src/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ export interface CapacitorConfig {
*/
path?: string;

/**
* iOS build scheme to use.
*
* Usually this matches your app's target in Xcode. You can use the
* following command to list schemes:
*
* ```shell
* xcodebuild -workspace ios/App/App.xcworkspace -list
* ```
*
* @since 3.0.0
* @default App
*/
scheme?: string;

/**
* User agent of Capacitor Web View on iOS.
*
Expand Down
1 change: 1 addition & 0 deletions cli/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export interface IOSConfig extends PlatformConfig {
readonly cordovaPluginsDirAbs: string;
readonly minVersion: string;
readonly podPath: string;
readonly scheme: string;
readonly webDir: Promise<string>;
readonly webDirAbs: Promise<string>;
readonly nativeProjectDir: string;
Expand Down
4 changes: 2 additions & 2 deletions cli/src/ios/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function runIOS(
'-workspace',
basename(await config.ios.nativeXcodeWorkspaceDirAbs),
'-scheme',
'App',
config.ios.scheme,
'-configuration',
'Debug',
'-destination',
Expand All @@ -46,7 +46,7 @@ export async function runIOS(
}),
);

const appName = 'App.app';
const appName = `${config.ios.scheme}.app`;
const appPath = resolve(
derivedDataPath,
'Build/Products',
Expand Down

0 comments on commit e6374dc

Please sign in to comment.