From d0a29dc10c2889904650b8fa6723417358539786 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Sat, 13 Mar 2021 14:38:02 -0800 Subject: [PATCH] Allow local networking Info.plist insertion to fail (#78085) --- packages/flutter_tools/bin/xcode_backend.sh | 6 ++++-- .../test/integration.shard/xcode_backend_test.dart | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 008df973db..e82a32ea72 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -235,8 +235,10 @@ AddObservatoryBonjourService() { local built_products_plist="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}" if [[ ! -f "${built_products_plist}" ]]; then - EchoError "error: ${INFOPLIST_PATH} does not exist. The Flutter \"Thin Binary\" build phase must run after \"Copy Bundle Resources\"." - exit -1 + # Very occasionally Xcode hasn't created an Info.plist when this runs. + # The file will be present on re-run. + echo "${INFOPLIST_PATH} does not exist. Skipping _dartobservatory._tcp NSBonjourServices insertion. Try re-building to enable \"flutter attach\"." + return fi # If there are already NSBonjourServices specified by the app (uncommon), insert the observatory service name to the existing list. if plutil -extract NSBonjourServices xml1 -o - "${built_products_plist}"; then diff --git a/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart b/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart index f2f94bcd21..3667208a1a 100644 --- a/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart +++ b/packages/flutter_tools/test/integration.shard/xcode_backend_test.dart @@ -96,7 +96,7 @@ void main() { infoPlist = buildDirectory.childFile('Info.plist'); }); - test('fails when the Info.plist is missing', () async { + test('handles when the Info.plist is missing', () async { final ProcessResult result = await Process.run( xcodeBackendPath, ['test_observatory_bonjour_service'], @@ -106,8 +106,8 @@ void main() { 'INFOPLIST_PATH': 'Info.plist', }, ); - expect(result.stderr, startsWith('error: Info.plist does not exist.')); - expect(result.exitCode, isNot(0)); + expect(result.stdout, contains('Info.plist does not exist.')); + expect(result.exitCode, 0); }); const String emptyPlist = '''