@@ -256,8 +256,6 @@ class IosProject extends XcodeBasedProject {
256
256
BuildInfo ? buildInfo, {
257
257
EnvironmentType environmentType = EnvironmentType .physical,
258
258
String ? deviceId,
259
- String ? scheme,
260
- bool isWatch = false ,
261
259
}) async {
262
260
if (! existsSync ()) {
263
261
return null ;
@@ -267,11 +265,9 @@ class IosProject extends XcodeBasedProject {
267
265
return null ;
268
266
}
269
267
268
+ final String ? scheme = info.schemeFor (buildInfo);
270
269
if (scheme == null ) {
271
- scheme = info.schemeFor (buildInfo);
272
- if (scheme == null ) {
273
- info.reportFlavorNotFoundAndExit ();
274
- }
270
+ info.reportFlavorNotFoundAndExit ();
275
271
}
276
272
277
273
final String ? configuration = (await projectInfo ())? .buildConfigurationFor (
@@ -283,7 +279,6 @@ class IosProject extends XcodeBasedProject {
283
279
scheme: scheme,
284
280
configuration: configuration,
285
281
deviceId: deviceId,
286
- isWatch: isWatch,
287
282
);
288
283
final Map <String , String >? currentBuildSettings = _buildSettingsByBuildContext[buildContext];
289
284
if (currentBuildSettings == null ) {
@@ -332,12 +327,7 @@ class IosProject extends XcodeBasedProject {
332
327
}
333
328
334
329
/// Check if one the [targets] of the project is a watchOS companion app target.
335
- Future <bool > containsWatchCompanion ({
336
- required List <String > targets,
337
- required List <String > schemes,
338
- required BuildInfo buildInfo,
339
- String ? deviceId,
340
- }) async {
330
+ Future <bool > containsWatchCompanion (List <String > targets, BuildInfo buildInfo, String ? deviceId) async {
341
331
final String ? bundleIdentifier = await productBundleIdentifier (buildInfo);
342
332
// A bundle identifier is required for a companion app.
343
333
if (bundleIdentifier == null ) {
@@ -346,8 +336,8 @@ class IosProject extends XcodeBasedProject {
346
336
for (final String target in targets) {
347
337
// Create Info.plist file of the target.
348
338
final File infoFile = hostAppRoot.childDirectory (target).childFile ('Info.plist' );
349
- // In older versions of Xcode, if the target was a watchOS companion app ,
350
- // the Info.plist file of the target contained the key WKCompanionAppBundleIdentifier .
339
+ // The Info.plist file of a target contains the key WKCompanionAppBundleIdentifier ,
340
+ // if it is a watchOS companion app .
351
341
if (infoFile.existsSync ()) {
352
342
final String ? fromPlist = globals.plistParser.getStringValueFromFile (infoFile.path, 'WKCompanionAppBundleIdentifier' );
353
343
if (bundleIdentifier == fromPlist) {
@@ -367,34 +357,6 @@ class IosProject extends XcodeBasedProject {
367
357
}
368
358
}
369
359
}
370
-
371
- // If key not found in Info.plist above, do more expensive check of build settings.
372
- // In newer versions of Xcode, the build settings of the watchOS companion
373
- // app's scheme should contain the key INFOPLIST_KEY_WKCompanionAppBundleIdentifier.
374
- final bool watchIdentifierFound = xcodeProjectInfoFile.readAsStringSync ().contains ('WKCompanionAppBundleIdentifier' );
375
- if (watchIdentifierFound == false ) {
376
- return false ;
377
- }
378
- for (final String scheme in schemes) {
379
- final Map <String , String >? allBuildSettings = await buildSettingsForBuildInfo (
380
- buildInfo,
381
- deviceId: deviceId,
382
- scheme: scheme,
383
- isWatch: true ,
384
- );
385
- if (allBuildSettings != null ) {
386
- final String ? fromBuild = allBuildSettings['INFOPLIST_KEY_WKCompanionAppBundleIdentifier' ];
387
- if (bundleIdentifier == fromBuild) {
388
- return true ;
389
- }
390
- if (fromBuild != null && fromBuild.contains (r'$' )) {
391
- final String substitutedVariable = substituteXcodeVariables (fromBuild, allBuildSettings);
392
- if (substitutedVariable == bundleIdentifier) {
393
- return true ;
394
- }
395
- }
396
- }
397
- }
398
360
return false ;
399
361
}
400
362
0 commit comments