This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
174 additions
and
145 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
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
70 changes: 70 additions & 0 deletions
70
packages/expo-cli/src/commands/eas-build/build/utils/xcode.ts
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,70 @@ | ||
import { ExpoConfig, IOSConfig } from '@expo/config'; | ||
import once from 'lodash/once'; | ||
|
||
import log from '../../../../log'; | ||
import prompts from '../../../../prompts'; | ||
|
||
export const getBundleIdentifier = once(_getBundleIdentifier); | ||
|
||
async function _getBundleIdentifier(projectDir: string, manifest: ExpoConfig): Promise<string> { | ||
const bundleIdentifierFromPbxproj = IOSConfig.BundleIdenitifer.getBundleIdentifierFromPbxproj( | ||
projectDir | ||
); | ||
const bundleIdentifierFromConfig = IOSConfig.BundleIdenitifer.getBundleIdentifier(manifest); | ||
if (bundleIdentifierFromPbxproj !== null && bundleIdentifierFromConfig !== null) { | ||
if (bundleIdentifierFromPbxproj === bundleIdentifierFromConfig) { | ||
return bundleIdentifierFromPbxproj; | ||
} else { | ||
log.newLine(); | ||
log( | ||
log.chalk.yellow( | ||
`We detected that your Xcode project is configured with a different bundle identifier than the one defined in app.json/app.config.js. | ||
If you choose the one defined in app.json/app.config.js we'll automatically configure your Xcode project with it. | ||
However, if you choose the one defined in the Xcode project you'll have to update app.json/app.config.js on your own. | ||
Otherwise, you'll see this prompt again in the future.` | ||
) | ||
); | ||
log.newLine(); | ||
const { bundleIdentifier } = await prompts({ | ||
type: 'select', | ||
name: 'bundleIdentifier', | ||
message: 'Which bundle identifier should we use?', | ||
choices: [ | ||
{ | ||
title: `Defined in the Xcode project: ${log.chalk.bold(bundleIdentifierFromPbxproj)}`, | ||
value: bundleIdentifierFromPbxproj, | ||
}, | ||
{ | ||
title: `Defined in app.json/app.config.js: ${log.chalk.bold( | ||
bundleIdentifierFromConfig | ||
)}`, | ||
value: bundleIdentifierFromConfig, | ||
}, | ||
], | ||
}); | ||
return bundleIdentifier; | ||
} | ||
} else if (bundleIdentifierFromPbxproj === null && bundleIdentifierFromConfig === null) { | ||
throw new Error('Please define "expo.ios.bundleIdentifier" in app.json/app.config.js'); | ||
} else { | ||
if (bundleIdentifierFromPbxproj !== null) { | ||
log( | ||
`Using ${log.chalk.bold( | ||
bundleIdentifierFromPbxproj | ||
)} as the bundle identifier (read from the Xcode project).` | ||
); | ||
return bundleIdentifierFromPbxproj; | ||
} else { | ||
// bundleIdentifierFromConfig is never null in this case | ||
// the following line is to satisfy TS | ||
const bundleIdentifier = bundleIdentifierFromConfig ?? ''; | ||
log( | ||
`Using ${log.chalk.bold( | ||
bundleIdentifier | ||
)} as the bundle identifier (read from app.json/app.config.js). | ||
We'll automatically configure your Xcode project using this value.` | ||
); | ||
return bundleIdentifier; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.