microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/ios/iOSPlatform.ts
440lines · modeblame
8a67e140Artem Egorov8 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
| 4 | import * as path from "path"; | |
df8c800dArtem Egorov8 years ago | 5 | import * as semver from "semver"; |
8a67e140Artem Egorov8 years ago | 6 | |
34472878RedMickey5 years ago | 7 | import { ChildProcess } from "../../common/node/childProcess"; |
| 8 | import { CommandExecutor } from "../../common/commandExecutor"; | |
4cd25962JiglioNero4 years ago | 9 | import { MobilePlatformDeps, TargetType } from "../generalPlatform"; |
34472878RedMickey5 years ago | 10 | import { IIOSRunOptions, PlatformType } from "../launchArgs"; |
| 11 | import { PlistBuddy } from "./plistBuddy"; | |
| 12 | import { IOSDebugModeManager } from "./iOSDebugModeManager"; | |
| 13 | import { OutputVerifier, PatternToFailure } from "../../common/outputVerifier"; | |
| 14 | import { TelemetryHelper } from "../../common/telemetryHelper"; | |
fc602bb6Yuri Skorokhodov7 years ago | 15 | import { InternalErrorCode } from "../../common/error/internalErrorCode"; |
d7d405aeYuri Skorokhodov7 years ago | 16 | import * as nls from "vscode-nls"; |
7e74daf7Yuri Skorokhodov6 years ago | 17 | import { AppLauncher } from "../appLauncher"; |
4cd25962JiglioNero4 years ago | 18 | import { GeneralMobilePlatform } from "../generalMobilePlatform"; |
| 19 | import { IDebuggableIOSTarget, IOSTarget, IOSTargetManager } from "./iOSTargetManager"; | |
| 20 | import { ErrorHelper } from "../../common/error/errorHelper"; | |
34472878RedMickey5 years ago | 21 | nls.config({ |
| 22 | messageFormat: nls.MessageFormat.bundle, | |
| 23 | bundleFormat: nls.BundleFormat.standalone, | |
| 24 | })(); | |
d7d405aeYuri Skorokhodov7 years ago | 25 | const localize = nls.loadMessageBundle(); |
8022afdfVladimir Kotikov8 years ago | 26 | |
8a67e140Artem Egorov8 years ago | 27 | export class IOSPlatform extends GeneralMobilePlatform { |
| 28 | public static DEFAULT_IOS_PROJECT_RELATIVE_PATH = "ios"; | |
0a68f8dbArtem Egorov8 years ago | 29 | |
8a67e140Artem Egorov8 years ago | 30 | private plistBuddy = new PlistBuddy(); |
0db0be15Artem Egorov8 years ago | 31 | private iosProjectRoot: string; |
7daed3fcArtem Egorov8 years ago | 32 | private iosDebugModeManager: IOSDebugModeManager; |
| 33 | | |
db6fd42aRuslan Bikkinin7 years ago | 34 | private defaultConfiguration: string = "Debug"; |
| 35 | private configurationArgumentName: string = "--configuration"; | |
8a67e140Artem Egorov8 years ago | 36 | |
4cd25962JiglioNero4 years ago | 37 | protected target?: IOSTarget; |
| 38 | | |
0a68f8dbArtem Egorov8 years ago | 39 | // We should add the common iOS build/run errors we find to this list |
34472878RedMickey5 years ago | 40 | private static RUN_IOS_FAILURE_PATTERNS: PatternToFailure[] = [ |
| 41 | { | |
| 42 | pattern: "No devices are booted", | |
| 43 | errorCode: InternalErrorCode.IOSSimulatorNotLaunchable, | |
| 44 | }, | |
| 45 | { | |
| 46 | pattern: "FBSOpenApplicationErrorDomain", | |
| 47 | errorCode: InternalErrorCode.IOSSimulatorNotLaunchable, | |
| 48 | }, | |
| 49 | { | |
| 50 | pattern: "ios-deploy", | |
| 51 | errorCode: InternalErrorCode.IOSDeployNotFound, | |
| 52 | }, | |
| 53 | ]; | |
8a67e140Artem Egorov8 years ago | 54 | |
3021756bYuri Skorokhodov6 years ago | 55 | private static readonly RUN_IOS_SUCCESS_PATTERNS = ["BUILD SUCCEEDED"]; |
8a67e140Artem Egorov8 years ago | 56 | |
0a68f8dbArtem Egorov8 years ago | 57 | constructor(protected runOptions: IIOSRunOptions, platformDeps: MobilePlatformDeps = {}) { |
| 58 | super(runOptions, platformDeps); | |
8a67e140Artem Egorov8 years ago | 59 | |
4cd25962JiglioNero4 years ago | 60 | this.targetManager = new IOSTargetManager(); |
db6fd42aRuslan Bikkinin7 years ago | 61 | this.runOptions.configuration = this.getConfiguration(); |
| 62 | | |
34472878RedMickey5 years ago | 63 | if (this.runOptions.iosRelativeProjectPath) { |
| 64 | // Deprecated option | |
| 65 | this.logger.warning( | |
| 66 | localize( | |
| 67 | "iosRelativeProjectPathOptionIsDeprecatedUseRunArgumentsInstead", | |
| 68 | "'iosRelativeProjectPath' option is deprecated. Please use 'runArguments' instead.", | |
| 69 | ), | |
| 70 | ); | |
8a67e140Artem Egorov8 years ago | 71 | } |
| 72 | | |
34472878RedMickey5 years ago | 73 | const iosProjectFolderPath = IOSPlatform.getOptFromRunArgs( |
| 74 | this.runArguments, | |
| 75 | "--project-path", | |
| 76 | false, | |
| 77 | ); | |
| 78 | this.iosProjectRoot = path.join( | |
| 79 | this.projectPath, | |
| 80 | iosProjectFolderPath || | |
| 81 | this.runOptions.iosRelativeProjectPath || | |
| 82 | IOSPlatform.DEFAULT_IOS_PROJECT_RELATIVE_PATH, | |
| 83 | ); | |
116c3cb0Ruslan Bikkinin7 years ago | 84 | const schemeFromArgs = IOSPlatform.getOptFromRunArgs(this.runArguments, "--scheme", false); |
34472878RedMickey5 years ago | 85 | this.iosDebugModeManager = new IOSDebugModeManager( |
| 86 | this.iosProjectRoot, | |
| 87 | this.projectPath, | |
| 88 | schemeFromArgs ? schemeFromArgs : this.runOptions.scheme, | |
| 89 | ); | |
4cd25962JiglioNero4 years ago | 90 | } |
8a67e140Artem Egorov8 years ago | 91 | |
4cd25962JiglioNero4 years ago | 92 | public async getTarget(): Promise<IOSTarget> { |
| 93 | if (!this.target) { | |
| 94 | const targetFromRunArgs = await this.getTargetFromRunArgs(); | |
| 95 | if (targetFromRunArgs) { | |
| 96 | this.target = targetFromRunArgs; | |
| 97 | } else { | |
| 98 | const targets = (await this.targetManager.getTargetList()) as IDebuggableIOSTarget[]; | |
| 99 | const targetsBySpecifiedType = targets.filter(target => { | |
| 100 | switch (this.runOptions.target) { | |
| 101 | case TargetType.Simulator: | |
| 102 | return target.isVirtualTarget; | |
| 103 | case TargetType.Device: | |
| 104 | return !target.isVirtualTarget; | |
| 105 | case undefined: | |
| 106 | case "": | |
| 107 | return true; | |
| 108 | default: | |
| 109 | return ( | |
| 110 | target.id === this.runOptions.target || | |
| 111 | target.name === this.runOptions.target | |
| 112 | ); | |
| 113 | } | |
| 114 | }); | |
| 115 | if (targetsBySpecifiedType.length) { | |
| 116 | this.target = IOSTarget.fromInterface(targetsBySpecifiedType[0]); | |
| 117 | } else if (targets.length) { | |
| 118 | this.logger.warning( | |
| 119 | localize( | |
| 120 | "ThereIsNoTargetWithSpecifiedTargetType", | |
| 121 | "There is no any target with specified target type '{0}'. Continue with any target.", | |
| 122 | this.runOptions.target, | |
| 123 | ), | |
| 124 | ); | |
| 125 | this.target = IOSTarget.fromInterface(targets[0]); | |
| 126 | } else { | |
| 127 | throw ErrorHelper.getInternalError( | |
| 128 | InternalErrorCode.IOSThereIsNoAnyDebuggableTarget, | |
| 129 | ); | |
| 130 | } | |
| 131 | } | |
8022afdfVladimir Kotikov8 years ago | 132 | } |
4cd25962JiglioNero4 years ago | 133 | return this.target; |
| 134 | } | |
0db0be15Artem Egorov8 years ago | 135 | |
4cd25962JiglioNero4 years ago | 136 | public async showDevMenu(appLauncher: AppLauncher): Promise<void> { |
| 137 | const worker = appLauncher.getAppWorker(); | |
| 138 | if (worker) { | |
| 139 | worker.showDevMenuCommand(); | |
8a67e140Artem Egorov8 years ago | 140 | } |
| 141 | } | |
| 142 | | |
4cd25962JiglioNero4 years ago | 143 | public async reloadApp(appLauncher: AppLauncher): Promise<void> { |
| 144 | const worker = appLauncher.getAppWorker(); | |
| 145 | if (worker) { | |
| 146 | worker.reloadAppCommand(); | |
119d7878JiglioNero5 years ago | 147 | } |
| 148 | } | |
| 149 | | |
0d77292aJiglioNero4 years ago | 150 | public async runApp(): Promise<void> { |
e7a2c40dRedMickey4 years ago | 151 | let extProps: any = { |
031832ffArtem Egorov8 years ago | 152 | platform: { |
259c018fYuri Skorokhodov5 years ago | 153 | value: PlatformType.iOS, |
031832ffArtem Egorov8 years ago | 154 | isPii: false, |
| 155 | }, | |
| 156 | }; | |
| 157 | | |
e7a2c40dRedMickey4 years ago | 158 | if (this.runOptions.isDirect) { |
| 159 | extProps.isDirect = { | |
| 160 | value: true, | |
| 161 | isPii: false, | |
| 162 | }; | |
| 163 | this.projectObserver?.updateRNIosHermesProjectState(true); | |
| 164 | } | |
| 165 | | |
34472878RedMickey5 years ago | 166 | extProps = TelemetryHelper.addPlatformPropertiesToTelemetryProperties( |
| 167 | this.runOptions, | |
| 168 | this.runOptions.reactNativeVersions, | |
| 169 | extProps, | |
| 170 | ); | |
ba953e9fRedMickey6 years ago | 171 | |
0d77292aJiglioNero4 years ago | 172 | await TelemetryHelper.generate("iOSPlatform.runApp", extProps, async () => { |
031832ffArtem Egorov8 years ago | 173 | // Compile, deploy, and launch the app on either a simulator or a device |
34472878RedMickey5 years ago | 174 | const env = GeneralMobilePlatform.getEnvArgument( |
| 175 | process.env, | |
| 176 | this.runOptions.env, | |
| 177 | this.runOptions.envFile, | |
| 178 | ); | |
| 179 | | |
| 180 | if ( | |
| 181 | !semver.valid( | |
| 182 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
| 183 | ) /*Custom RN implementations should support this flag*/ || | |
| 184 | semver.gte( | |
| 185 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
| 186 | IOSPlatform.NO_PACKAGER_VERSION, | |
| 187 | ) | |
| 188 | ) { | |
7fa90b3bRedMickey6 years ago | 189 | this.runArguments.push("--no-packager"); |
| 190 | } | |
| 191 | // Since @react-native-community/cli@2.1.0 build output are hidden by default | |
| 192 | // we are using `--verbose` to show it as it contains `BUILD SUCCESSFUL` and other patterns | |
| 193 | if (semver.gte(this.runOptions.reactNativeVersions.reactNativeVersion, "0.60.0")) { | |
| 194 | this.runArguments.push("--verbose"); | |
| 195 | } | |
34472878RedMickey5 years ago | 196 | const runIosSpawn = new CommandExecutor( |
4dfb1c4cetatanova5 years ago | 197 | this.runOptions.nodeModulesRoot, |
34472878RedMickey5 years ago | 198 | this.projectPath, |
| 199 | this.logger, | |
| 200 | ).spawnReactCommand("run-ios", this.runArguments, { env }); | |
0d77292aJiglioNero4 years ago | 201 | await new OutputVerifier( |
ce5e88eeYuri Skorokhodov5 years ago | 202 | () => |
34472878RedMickey5 years ago | 203 | this.generateSuccessPatterns( |
| 204 | this.runOptions.reactNativeVersions.reactNativeVersion, | |
| 205 | ), | |
| 206 | () => Promise.resolve(IOSPlatform.RUN_IOS_FAILURE_PATTERNS), | |
| 207 | PlatformType.iOS, | |
| 208 | ).process(runIosSpawn); | |
031832ffArtem Egorov8 years ago | 209 | }); |
8a67e140Artem Egorov8 years ago | 210 | } |
| 211 | | |
0d77292aJiglioNero4 years ago | 212 | public async enableJSDebuggingMode(): Promise<void> { |
8a67e140Artem Egorov8 years ago | 213 | // Configure the app for debugging |
4cd25962JiglioNero4 years ago | 214 | if (!(await this.getTarget()).isVirtualTarget) { |
8a67e140Artem Egorov8 years ago | 215 | // Note that currently we cannot automatically switch the device into debug mode. |
34472878RedMickey5 years ago | 216 | this.logger.info( |
| 217 | "Application is running on a device, please shake device and select 'Debug JS Remotely' to enable debugging.", | |
| 218 | ); | |
0d77292aJiglioNero4 years ago | 219 | return; |
8a67e140Artem Egorov8 years ago | 220 | } |
| 221 | | |
| 222 | // Wait until the configuration file exists, and check to see if debugging is enabled | |
0d77292aJiglioNero4 years ago | 223 | const [debugModeEnabled, bundleId] = await Promise.all<boolean | string>([ |
1c2424f4RedMickey5 years ago | 224 | this.iosDebugModeManager.getAppRemoteDebuggingSetting( |
34472878RedMickey5 years ago | 225 | this.runOptions.configuration, |
| 226 | this.runOptions.productName, | |
| 227 | ), | |
8a67e140Artem Egorov8 years ago | 228 | this.getBundleId(), |
0d77292aJiglioNero4 years ago | 229 | ]); |
| 230 | if (debugModeEnabled) { | |
| 231 | return; | |
| 232 | } | |
| 233 | // Debugging must still be enabled | |
| 234 | // We enable debugging by writing to a plist file that backs a NSUserDefaults object, | |
| 235 | // but that file is written to by the app on occasion. To avoid races, we shut the app | |
| 236 | // down before writing to the file. | |
| 237 | const childProcess = new ChildProcess(); | |
| 238 | const output = await childProcess.execToString("xcrun simctl spawn booted launchctl list"); | |
| 239 | // Try to find an entry that looks like UIKitApplication:com.example.myApp[0x4f37] | |
| 240 | const regex = new RegExp(`(\\S+${bundleId}\\S+)`); | |
| 241 | const match = regex.exec(output); | |
| 242 | // If we don't find a match, the app must not be running and so we do not need to close it | |
| 243 | if (match) { | |
| 244 | await childProcess.exec(`xcrun simctl spawn booted launchctl stop ${match[1]}`); | |
| 245 | } | |
| 246 | // Write to the settings file while the app is not running to avoid races | |
| 247 | await this.iosDebugModeManager.setAppRemoteDebuggingSetting( | |
| 248 | /*enable=*/ true, | |
| 249 | this.runOptions.configuration, | |
| 250 | this.runOptions.productName, | |
| 251 | ); | |
| 252 | // Relaunch the app | |
| 253 | return await this.runApp(); | |
8a67e140Artem Egorov8 years ago | 254 | } |
| 255 | | |
0d77292aJiglioNero4 years ago | 256 | public async disableJSDebuggingMode(): Promise<void> { |
4cd25962JiglioNero4 years ago | 257 | if (!(await this.getTarget()).isVirtualTarget) { |
0d77292aJiglioNero4 years ago | 258 | return; |
c73f53cbJiglioNero5 years ago | 259 | } |
1c2424f4RedMickey5 years ago | 260 | return this.iosDebugModeManager.setAppRemoteDebuggingSetting( |
34472878RedMickey5 years ago | 261 | /*enable=*/ false, |
| 262 | this.runOptions.configuration, | |
| 263 | this.runOptions.productName, | |
| 264 | ); | |
0a68f8dbArtem Egorov8 years ago | 265 | } |
| 266 | | |
ce5e88eeYuri Skorokhodov5 years ago | 267 | public prewarmBundleCache(): Promise<void> { |
259c018fYuri Skorokhodov5 years ago | 268 | return this.packager.prewarmBundleCache(PlatformType.iOS); |
8a67e140Artem Egorov8 years ago | 269 | } |
| 270 | | |
cbc7ac5bArtem Egorov7 years ago | 271 | public getRunArguments(): string[] { |
8a67e140Artem Egorov8 years ago | 272 | let runArguments: string[] = []; |
0db0be15Artem Egorov8 years ago | 273 | |
| 274 | if (this.runOptions.runArguments && this.runOptions.runArguments.length > 0) { | |
b57ea017Artem Egorov8 years ago | 275 | runArguments = this.runOptions.runArguments; |
116c3cb0Ruslan Bikkinin7 years ago | 276 | if (this.runOptions.scheme) { |
34472878RedMickey5 years ago | 277 | const schemeFromArgs = IOSPlatform.getOptFromRunArgs( |
| 278 | runArguments, | |
| 279 | "--scheme", | |
| 280 | false, | |
| 281 | ); | |
116c3cb0Ruslan Bikkinin7 years ago | 282 | if (!schemeFromArgs) { |
| 283 | runArguments.push("--scheme", this.runOptions.scheme); | |
| 284 | } else { | |
34472878RedMickey5 years ago | 285 | this.logger.warning( |
| 286 | localize( | |
| 287 | "iosSchemeParameterAlreadySetInRunArguments", | |
| 288 | "'--scheme' is set as 'runArguments' configuration parameter value, 'scheme' configuration parameter value will be omitted", | |
| 289 | ), | |
| 290 | ); | |
116c3cb0Ruslan Bikkinin7 years ago | 291 | } |
| 292 | } | |
b57ea017Artem Egorov8 years ago | 293 | } else { |
| 294 | if (this.runOptions.target) { | |
de838bbfJiglioNero6 years ago | 295 | runArguments.push(...this.handleTargetArg(this.runOptions.target)); |
b57ea017Artem Egorov8 years ago | 296 | } |
8abbd163Artem Egorov8 years ago | 297 | |
b57ea017Artem Egorov8 years ago | 298 | if (this.runOptions.iosRelativeProjectPath) { |
| 299 | runArguments.push("--project-path", this.runOptions.iosRelativeProjectPath); | |
8022afdfVladimir Kotikov8 years ago | 300 | } |
8a67e140Artem Egorov8 years ago | 301 | |
b57ea017Artem Egorov8 years ago | 302 | // provide any defined scheme |
| 303 | if (this.runOptions.scheme) { | |
| 304 | runArguments.push("--scheme", this.runOptions.scheme); | |
| 305 | } | |
8a67e140Artem Egorov8 years ago | 306 | } |
| 307 | | |
| 308 | return runArguments; | |
| 309 | } | |
| 310 | | |
4cd25962JiglioNero4 years ago | 311 | public async getTargetFromRunArgs(): Promise<IOSTarget | undefined> { |
| 312 | if (this.runOptions.runArguments && this.runOptions.runArguments.length > 0) { | |
c76b733bJiglioNero4 years ago | 313 | const targets = (await this.targetManager.getTargetList()) as IDebuggableIOSTarget[]; |
| 314 | | |
4cd25962JiglioNero4 years ago | 315 | const udid = GeneralMobilePlatform.getOptFromRunArgs( |
| 316 | this.runOptions.runArguments, | |
| 317 | "--udid", | |
| 318 | ); | |
| 319 | if (udid) { | |
| 320 | const target = targets.find(target => target.id === udid); | |
| 321 | if (target) { | |
| 322 | return IOSTarget.fromInterface(target); | |
c76b733bJiglioNero4 years ago | 323 | } else { |
| 324 | this.logger.warning( | |
| 325 | localize( | |
| 326 | "ThereIsNoIosTargetWithSuchUdid", | |
| 327 | "There is no iOS target with such UDID: {0}", | |
| 328 | udid, | |
| 329 | ), | |
| 330 | ); | |
4cd25962JiglioNero4 years ago | 331 | } |
| 332 | } | |
| 333 | | |
| 334 | const device = GeneralMobilePlatform.getOptFromRunArgs( | |
| 335 | this.runOptions.runArguments, | |
| 336 | "--device", | |
| 337 | ); | |
| 338 | if (device) { | |
| 339 | const target = targets.find( | |
c76b733bJiglioNero4 years ago | 340 | target => !target.isVirtualTarget && target.name === device, |
4cd25962JiglioNero4 years ago | 341 | ); |
| 342 | if (target) { | |
| 343 | return IOSTarget.fromInterface(target); | |
c76b733bJiglioNero4 years ago | 344 | } else { |
| 345 | this.logger.warning( | |
| 346 | localize( | |
| 347 | "ThereIsNoIosDeviceWithSuchName", | |
| 348 | "There is no iOS device with such name: {0}", | |
| 349 | device, | |
| 350 | ), | |
| 351 | ); | |
4cd25962JiglioNero4 years ago | 352 | } |
| 353 | } | |
| 354 | | |
| 355 | const simulator = GeneralMobilePlatform.getOptFromRunArgs( | |
| 356 | this.runOptions.runArguments, | |
| 357 | "--simulator", | |
| 358 | ); | |
| 359 | if (simulator) { | |
| 360 | const target = targets.find( | |
c76b733bJiglioNero4 years ago | 361 | target => target.isVirtualTarget && target.name === simulator, |
4cd25962JiglioNero4 years ago | 362 | ); |
| 363 | if (target) { | |
| 364 | return IOSTarget.fromInterface(target); | |
c76b733bJiglioNero4 years ago | 365 | } else { |
| 366 | this.logger.warning( | |
| 367 | localize( | |
| 368 | "ThereIsNoIosSimulatorWithSuchName", | |
| 369 | "There is no iOS simulator with such name: {0}", | |
| 370 | simulator, | |
| 371 | ), | |
| 372 | ); | |
4cd25962JiglioNero4 years ago | 373 | } |
| 374 | } | |
| 375 | } | |
| 376 | | |
| 377 | return undefined; | |
| 378 | } | |
| 379 | | |
de838bbfJiglioNero6 years ago | 380 | private handleTargetArg(target: string): string[] { |
4cd25962JiglioNero4 years ago | 381 | if (target === TargetType.Device || target === TargetType.Simulator) { |
| 382 | return [`--${target}`]; | |
de838bbfJiglioNero6 years ago | 383 | } else { |
4cd25962JiglioNero4 years ago | 384 | return ["--udid", target]; |
de838bbfJiglioNero6 years ago | 385 | } |
| 386 | } | |
| 387 | | |
0d77292aJiglioNero4 years ago | 388 | private async generateSuccessPatterns(version: string): Promise<string[]> { |
3021756bYuri Skorokhodov6 years ago | 389 | // Clone RUN_IOS_SUCCESS_PATTERNS to avoid its runtime mutation |
| 390 | let successPatterns = [...IOSPlatform.RUN_IOS_SUCCESS_PATTERNS]; | |
4cd25962JiglioNero4 years ago | 391 | if (!(await this.getTarget()).isVirtualTarget) { |
3021756bYuri Skorokhodov6 years ago | 392 | if (semver.gte(version, "0.60.0")) { |
| 393 | successPatterns.push("success Installed the app on the device"); | |
| 394 | } else { | |
| 395 | successPatterns.push("INSTALLATION SUCCEEDED"); | |
| 396 | } | |
0d77292aJiglioNero4 years ago | 397 | return successPatterns; |
3021756bYuri Skorokhodov6 years ago | 398 | } else { |
0d77292aJiglioNero4 years ago | 399 | const bundleId = await this.getBundleId(); |
| 400 | if (semver.gte(version, "0.60.0")) { | |
| 401 | successPatterns.push( | |
| 402 | `Launching "${bundleId}"\nsuccess Successfully launched the app `, | |
| 403 | ); | |
| 404 | } else { | |
| 405 | successPatterns.push(`Launching ${bundleId}\n${bundleId}: `); | |
| 406 | } | |
| 407 | return successPatterns; | |
3021756bYuri Skorokhodov6 years ago | 408 | } |
8a67e140Artem Egorov8 years ago | 409 | } |
| 410 | | |
db6fd42aRuslan Bikkinin7 years ago | 411 | private getConfiguration(): string { |
34472878RedMickey5 years ago | 412 | return ( |
| 413 | IOSPlatform.getOptFromRunArgs(this.runArguments, this.configurationArgumentName) || | |
| 414 | this.defaultConfiguration | |
| 415 | ); | |
db6fd42aRuslan Bikkinin7 years ago | 416 | } |
| 417 | | |
ce5e88eeYuri Skorokhodov5 years ago | 418 | private getBundleId(): Promise<string> { |
116c3cb0Ruslan Bikkinin7 years ago | 419 | let scheme = this.runOptions.scheme; |
| 420 | if (!scheme) { | |
34472878RedMickey5 years ago | 421 | const schemeFromArgs = IOSPlatform.getOptFromRunArgs( |
| 422 | this.runArguments, | |
| 423 | "--scheme", | |
| 424 | false, | |
| 425 | ); | |
116c3cb0Ruslan Bikkinin7 years ago | 426 | if (schemeFromArgs) { |
| 427 | scheme = schemeFromArgs; | |
| 428 | } | |
| 429 | } | |
34472878RedMickey5 years ago | 430 | return this.plistBuddy.getBundleId( |
| 431 | this.iosProjectRoot, | |
| 432 | this.projectPath, | |
1c2424f4RedMickey5 years ago | 433 | PlatformType.iOS, |
34472878RedMickey5 years ago | 434 | true, |
| 435 | this.runOptions.configuration, | |
| 436 | this.runOptions.productName, | |
| 437 | scheme, | |
| 438 | ); | |
8a67e140Artem Egorov8 years ago | 439 | } |
| 440 | } |