-
Notifications
You must be signed in to change notification settings - Fork 40
fix: missing -sdk for getting build settings; running incompatible destinations #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@rnef/platform-apple-helpers': patch | ||
| --- | ||
|
|
||
| fix: missing -sdk for getting build settings; running incompatible destinations |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ import type { | |
| ProjectConfig, | ||
| } from '../../types/index.js'; | ||
| import { buildApp } from '../../utils/buildApp.js'; | ||
| import { getGenericDestination } from '../../utils/destionation.js'; | ||
| import { getPlatformInfo } from '../../utils/getPlatformInfo.js'; | ||
| import { listDevicesAndSimulators } from '../../utils/listDevices.js'; | ||
| import { matchingDevice } from './matchingDevice.js'; | ||
|
|
@@ -48,12 +47,16 @@ export const createRun = async ({ | |
| reactNativePath: string; | ||
| }) => { | ||
| validateArgs(args, projectRoot); | ||
|
|
||
| const deviceOrSimulator = args.destination | ||
| ? // there can be multiple destinations, so we'll pick the first one | ||
| args.destination[0].match(/simulator/i) | ||
| ? 'simulator' | ||
| : 'device' | ||
| : 'simulator'; | ||
| const artifactName = await formatArtifactName({ | ||
| platform: 'ios', | ||
| traits: [ | ||
| args.destination?.[0] ?? 'simulator', | ||
| args.configuration ?? 'Debug', | ||
| ], | ||
| traits: [deviceOrSimulator, args.configuration ?? 'Debug'], | ||
| root: projectRoot, | ||
| fingerprintOptions, | ||
| }); | ||
|
|
@@ -99,10 +102,7 @@ export const createRun = async ({ | |
|
|
||
| if (platformName === 'macos') { | ||
| const { appPath } = await buildApp({ | ||
| args: { | ||
| destination: [getGenericDestination(platformName, 'simulator')], | ||
| ...args, | ||
| }, | ||
| args, | ||
| projectConfig, | ||
| platformName, | ||
| projectRoot, | ||
|
|
@@ -116,10 +116,7 @@ export const createRun = async ({ | |
| return; | ||
| } else if (args.catalyst) { | ||
| const { appPath, scheme } = await buildApp({ | ||
| args: { | ||
| destination: [getGenericDestination(platformName, 'simulator')], | ||
| ...args, | ||
| }, | ||
| args, | ||
| projectConfig, | ||
| platformName, | ||
| projectRoot, | ||
|
|
@@ -150,15 +147,22 @@ export const createRun = async ({ | |
| const device = await selectDevice(devices, args); | ||
|
|
||
| if (device) { | ||
| if (device.type !== deviceOrSimulator) { | ||
| throw new RnefError( | ||
| `Selected device "${device.name}" is not a ${deviceOrSimulator}. | ||
| Please select available ${deviceOrSimulator} device: | ||
| ${devices | ||
| .filter(({ type }) => type === deviceOrSimulator) | ||
| .map(({ name }) => `• ${name}`) | ||
| .join('\n')}` | ||
| ); | ||
| } | ||
|
Comment on lines
+150
to
+159
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| cacheRecentDevice(device, platformName); | ||
| if (device.type === 'simulator') { | ||
| const [, { appPath, infoPlistPath }] = await Promise.all([ | ||
| launchSimulator(device), | ||
| buildApp({ | ||
| args: { | ||
| destination: [getGenericDestination(platformName, 'simulator')], | ||
| ...args, | ||
| }, | ||
| args, | ||
| projectConfig, | ||
| platformName, | ||
| udid: device.udid, | ||
|
|
@@ -172,10 +176,7 @@ export const createRun = async ({ | |
| await runOnSimulator(device, appPath, infoPlistPath); | ||
| } else if (device.type === 'device') { | ||
| const { appPath } = await buildApp({ | ||
| args: { | ||
| destination: [getGenericDestination(platformName, 'device')], | ||
| ...args, | ||
| }, | ||
| args, | ||
| projectConfig, | ||
| platformName, | ||
| udid: device.udid, | ||
|
|
@@ -188,14 +189,17 @@ export const createRun = async ({ | |
| } | ||
| return; | ||
| } else { | ||
| const bootedSimulators = devices.filter( | ||
| ({ state, type }) => state === 'Booted' && type === 'simulator' | ||
| const bootedDevices = devices.filter( | ||
| ({ state, type }) => state === 'Booted' && type === deviceOrSimulator | ||
| ); | ||
| if (bootedSimulators.length === 0) { | ||
| if (bootedDevices.length === 0) { | ||
| // fallback to present all devices when no device is selected | ||
| if (isInteractive()) { | ||
| const simulator = await promptForDeviceSelection(devices, platformName); | ||
| bootedSimulators.push(simulator); | ||
| const simulator = await promptForDeviceSelection( | ||
| devices.filter(({ type }) => type === deviceOrSimulator), | ||
| platformName | ||
| ); | ||
| bootedDevices.push(simulator); | ||
| cacheRecentDevice(simulator, platformName); | ||
| } else { | ||
| logger.debug( | ||
|
|
@@ -205,32 +209,33 @@ export const createRun = async ({ | |
| (device) => device.type === 'simulator' | ||
| )[0]; | ||
| if (simulator) { | ||
| bootedSimulators.push(simulator); | ||
| bootedDevices.push(simulator); | ||
| } else { | ||
| throw new RnefError( | ||
| 'No Apple simulators found. Install simulators via Xcode.' | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| for (const simulator of bootedSimulators) { | ||
| for (const bootedDevice of bootedDevices) { | ||
| const [, { appPath, infoPlistPath }] = await Promise.all([ | ||
| launchSimulator(simulator), | ||
| launchSimulator(bootedDevice), | ||
| buildApp({ | ||
| args: { | ||
| destination: [getGenericDestination(platformName, 'simulator')], | ||
| ...args, | ||
| }, | ||
| args, | ||
| projectConfig, | ||
| platformName, | ||
| udid: simulator.udid, | ||
| udid: bootedDevice.udid, | ||
| projectRoot, | ||
| reactNativePath, | ||
| artifactName, | ||
| binaryPath, | ||
| }), | ||
| ]); | ||
| await runOnSimulator(simulator, appPath, infoPlistPath); | ||
| if (bootedDevice.type === 'simulator') { | ||
| await runOnSimulator(bootedDevice, appPath, infoPlistPath); | ||
| } else { | ||
| await runOnDevice(bootedDevice, appPath, projectConfig.sourceDir); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was bug producing e.g.
ios-generic/platform=iOS-Debug-{hash}, which would never resolve correctly for a remote artifact. cc @mdjastrzebski