Skip to content

Commit 3571080

Browse files
committed
move getInfo, getScheme, getConfiguration inline
1 parent ea7d5c0 commit 3571080

File tree

1 file changed

+65
-11
lines changed
  • packages/platform-apple-helpers/src/lib/commands/run

1 file changed

+65
-11
lines changed

packages/platform-apple-helpers/src/lib/commands/run/createRun.ts

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,22 @@ export const createRun = async (
9595
throw new RnefError('Failed to get Xcode project information');
9696
}
9797

98-
const info = await getInfo(xcodeProject, sourceDir);
99-
100-
if (!info) {
101-
throw new RnefError('Failed to get Xcode project information');
102-
}
103-
const scheme = await getScheme(info.schemes, args.scheme, xcodeProject.name);
104-
const configuration = await getConfiguration(
105-
info.configurations,
106-
args.configuration
107-
);
108-
10998
if (platformName === 'macos') {
11099
let appPath = args.binaryPath;
100+
const info = await getInfo(xcodeProject, sourceDir);
101+
if (!info) {
102+
throw new RnefError('Failed to get Xcode project information');
103+
}
111104
if (!appPath) {
105+
const scheme = await getScheme(
106+
info.schemes,
107+
args.scheme,
108+
xcodeProject.name
109+
);
110+
const configuration = await getConfiguration(
111+
info.configurations,
112+
args.configuration
113+
);
112114
await buildProject({
113115
xcodeProject,
114116
sourceDir,
@@ -131,8 +133,21 @@ export const createRun = async (
131133
outro('Success 🎉.');
132134
return;
133135
} else if (args.catalyst) {
136+
const info = await getInfo(xcodeProject, sourceDir);
137+
if (!info) {
138+
throw new RnefError('Failed to get Xcode project information');
139+
}
140+
const scheme = await getScheme(
141+
info.schemes,
142+
args.scheme,
143+
xcodeProject.name
144+
);
134145
let appPath = args.binaryPath;
135146
if (!appPath) {
147+
const configuration = await getConfiguration(
148+
info.configurations,
149+
args.configuration
150+
);
136151
await buildProject({
137152
xcodeProject,
138153
sourceDir,
@@ -171,6 +186,19 @@ export const createRun = async (
171186
if (device) {
172187
cacheRecentDevice(device, platformName);
173188
if (device.type === 'simulator') {
189+
const info = await getInfo(xcodeProject, sourceDir);
190+
if (!info) {
191+
throw new RnefError('Failed to get Xcode project information');
192+
}
193+
const scheme = await getScheme(
194+
info.schemes,
195+
args.scheme,
196+
xcodeProject.name
197+
);
198+
const configuration = await getConfiguration(
199+
info.configurations,
200+
args.configuration
201+
);
174202
if (!args.binaryPath) {
175203
await buildProject({
176204
xcodeProject,
@@ -195,6 +223,19 @@ export const createRun = async (
195223
} else if (device.type === 'device') {
196224
let appPath = args.binaryPath;
197225
if (!appPath) {
226+
const info = await getInfo(xcodeProject, sourceDir);
227+
if (!info) {
228+
throw new RnefError('Failed to get Xcode project information');
229+
}
230+
const scheme = await getScheme(
231+
info.schemes,
232+
args.scheme,
233+
xcodeProject.name
234+
);
235+
const configuration = await getConfiguration(
236+
info.configurations,
237+
args.configuration
238+
);
198239
await buildProject({
199240
xcodeProject,
200241
sourceDir,
@@ -244,6 +285,19 @@ export const createRun = async (
244285
}
245286
}
246287
for (const simulator of bootedSimulators) {
288+
const info = await getInfo(xcodeProject, sourceDir);
289+
if (!info) {
290+
throw new RnefError('Failed to get Xcode project information');
291+
}
292+
const scheme = await getScheme(
293+
info.schemes,
294+
args.scheme,
295+
xcodeProject.name
296+
);
297+
const configuration = await getConfiguration(
298+
info.configurations,
299+
args.configuration
300+
);
247301
if (!args.binaryPath) {
248302
await buildProject({
249303
xcodeProject,

0 commit comments

Comments
 (0)