Revert "Add observatory Bonjour service to built iOS Info.plist bundle (#64988)" (#65109)

This reverts commit 4fde217dea.
This commit is contained in:
Jenn Magder
2020-09-02 12:31:17 -07:00
committed by GitHub
parent 237c0ab424
commit cb819504f3
5 changed files with 97 additions and 323 deletions

View File

@@ -14,6 +14,8 @@ import 'package:path/path.dart' as path;
Future<void> main() async {
await task(() async {
try {
bool foundProjectName = false;
bool bitcode = false;
await runProjectTest((FlutterProject flutterProject) async {
section('Build app with with --obfuscate');
await inDirectory(flutterProject.rootPath, () async {
@@ -50,13 +52,6 @@ Future<void> main() async {
fail('Failed to produce expected output at ${outputAppFrameworkBinary.path}');
}
if (await dartObservatoryBonjourServiceFound(outputAppPath)) {
throw TaskResult.failure('Release bundle has unexpected NSBonjourServices');
}
if (await localNetworkUsageFound(outputAppPath)) {
throw TaskResult.failure('Release bundle has unexpected NSLocalNetworkUsageDescription');
}
section('Validate obfuscation');
// Verify that an identifier from the Dart project code is not present
@@ -68,11 +63,11 @@ Future<void> main() async {
canFail: true,
);
if (response.trim().contains('matches')) {
throw TaskResult.failure('Found project name in obfuscated dart library');
foundProjectName = true;
}
});
section('Validate release contents');
section('Validate bitcode');
final Directory outputFlutterFramework = Directory(path.join(
flutterProject.rootPath,
@@ -88,13 +83,7 @@ Future<void> main() async {
if (!outputFlutterFrameworkBinary.existsSync()) {
fail('Failed to produce expected output at ${outputFlutterFrameworkBinary.path}');
}
// Archiving should contain a bitcode blob, but not building in release.
// This mimics Xcode behavior and present a developer from having to install a
// 300+MB app to test devices.
if (await containsBitcode(outputFlutterFrameworkBinary.path)) {
throw TaskResult.failure('Bitcode present in Flutter.framework');
}
bitcode = await containsBitcode(outputFlutterFrameworkBinary.path);
section('Xcode backend script');
@@ -112,7 +101,7 @@ Future<void> main() async {
'xcode_backend.sh'
);
// Simulate a common Xcode build setting misconfiguration
// Simulate a commonly Xcode build setting misconfiguration
// where FLUTTER_APPLICATION_PATH is missing
final int result = await exec(
xcodeBackendPath,
@@ -122,7 +111,6 @@ Future<void> main() async {
'TARGET_BUILD_DIR': buildPath,
'FRAMEWORKS_FOLDER_PATH': 'Runner.app/Frameworks',
'VERBOSE_SCRIPT_LOGGING': '1',
'FLUTTER_BUILD_MODE': 'release',
'ACTION': 'install', // Skip bitcode stripping since we just checked that above.
},
);
@@ -138,36 +126,18 @@ Future<void> main() async {
if (!outputAppFrameworkBinary.existsSync()) {
fail('Failed to re-embed ${outputAppFrameworkBinary.path}');
}
section('Clean build');
await inDirectory(flutterProject.rootPath, () async {
await flutter('clean');
});
section('Validate debug contents');
await inDirectory(flutterProject.rootPath, () async {
await flutter('build', options: <String>[
'ios',
'--debug',
'--no-codesign',
]);
});
// Debug should also not contain bitcode.
if (await containsBitcode(outputFlutterFrameworkBinary.path)) {
throw TaskResult.failure('Bitcode present in Flutter.framework');
}
if (!await dartObservatoryBonjourServiceFound(outputAppPath)) {
throw TaskResult.failure('Debug bundle is missing NSBonjourServices');
}
if (!await localNetworkUsageFound(outputAppPath)) {
throw TaskResult.failure('Debug bundle is missing NSLocalNetworkUsageDescription');
}
});
if (foundProjectName) {
return TaskResult.failure('Found project name in obfuscated dart library');
}
// Archiving should contain a bitcode blob, but not building in release.
// This mimics Xcode behavior and present a developer from having to install a
// 300+MB app to test devices.
if (bitcode) {
return TaskResult.failure('Bitcode present in Flutter.framework');
}
return TaskResult.success(null);
} on TaskResult catch (taskResult) {
return taskResult;

View File

@@ -5,8 +5,6 @@
import 'dart:async';
import 'dart:convert';
import 'package:path/path.dart' as path;
import 'utils.dart';
typedef SimulatorFunction = Future<void> Function(String deviceId);
@@ -104,40 +102,6 @@ Future<bool> containsBitcode(String pathToBinary) async {
return !emptyBitcodeMarkerFound;
}
Future<bool> dartObservatoryBonjourServiceFound(String appBundlePath) async =>
(await eval(
'plutil',
<String>[
'-extract',
'NSBonjourServices',
'xml1',
'-o',
'-',
path.join(
appBundlePath,
'Info.plist',
),
],
canFail: true,
)).contains('_dartobservatory._tcp');
Future<bool> localNetworkUsageFound(String appBundlePath) async =>
await exec(
'plutil',
<String>[
'-extract',
'NSLocalNetworkUsageDescription',
'xml1',
'-o',
'-',
path.join(
appBundlePath,
'Info.plist',
),
],
canFail: true,
) == 0;
/// Creates and boots a new simulator, passes the new simulator's identifier to
/// `testFunction`.
///