Reverts "Enable Swift Package Manager by default on master channel (#152049)" (#152243)

Reverts: flutter/flutter#152049
Initiated by: cbracken
Reason for reverting: iOS builds failing in post-submit
Original PR Author: loic-sharma

Reviewed By: {jmagman}

This change reverts the following previous change:
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
This commit is contained in:
auto-submit[bot]
2024-07-24 16:49:25 +00:00
committed by GitHub
parent 08d8a7fa81
commit f55ab0e77e
9 changed files with 84 additions and 214 deletions

View File

@@ -151,7 +151,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
section('Check debug build has no Dart AOT');
final String aotSymbols = await dumpSymbolTable(debugAppFrameworkPath);
final String aotSymbols = await _dylibSymbols(debugAppFrameworkPath);
if (aotSymbols.contains('architecture') ||
aotSymbols.contains('_kDartVmSnapshot')) {
@@ -172,7 +172,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
await _checkDylib(appFrameworkPath);
final String aotSymbols = await dumpSymbolTable(appFrameworkPath);
final String aotSymbols = await _dylibSymbols(appFrameworkPath);
if (!aotSymbols.contains('_kDartVmSnapshot')) {
throw TaskResult.failure('$mode App.framework missing Dart AOT');
@@ -562,7 +562,7 @@ Future<void> _testBuildMacOSFramework(Directory projectDir) async {
section('Check debug build has no Dart AOT');
final String aotSymbols = await dumpSymbolTable(debugAppFrameworkPath);
final String aotSymbols = await _dylibSymbols(debugAppFrameworkPath);
if (aotSymbols.contains('architecture') ||
aotSymbols.contains('_kDartVmSnapshot')) {
@@ -583,7 +583,7 @@ Future<void> _testBuildMacOSFramework(Directory projectDir) async {
await _checkDylib(appFrameworkPath);
final String aotSymbols = await dumpSymbolTable(appFrameworkPath);
final String aotSymbols = await _dylibSymbols(appFrameworkPath);
if (!aotSymbols.contains('_kDartVmSnapshot')) {
throw TaskResult.failure('$mode App.framework missing Dart AOT');
@@ -939,6 +939,15 @@ Future<void> _checkStatic(String pathToLibrary) async {
}
}
Future<String> _dylibSymbols(String pathToDylib) {
return eval('nm', <String>[
'-g',
pathToDylib,
'-arch',
'arm64',
]);
}
Future<bool> _linksOnFlutter(String pathToBinary) async {
final String loadCommands = await eval('otool', <String>[
'-l',

View File

@@ -703,7 +703,13 @@ Future<bool> _isAppAotBuild(Directory app) async {
'App',
);
final String symbolTable = await dumpSymbolTable(binary);
final String symbolTable = await eval(
'nm',
<String> [
'-gU',
binary,
],
);
return symbolTable.contains('kDartIsolateSnapshotInstructions');
}

View File

@@ -6,7 +6,6 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
@@ -210,7 +209,6 @@ public class DummyPluginAClass {
final String flutterPluginsDependenciesFileContent = flutterPluginsDependenciesFile.readAsStringSync();
final Map<String, dynamic> jsonContent = json.decode(flutterPluginsDependenciesFileContent) as Map<String, dynamic>;
final bool swiftPackageManagerEnabled = jsonContent['swift_package_manager_enabled'] as bool? ?? false;
// Verify the dependencyGraph object is valid. The rest of the contents of this file are not relevant to the
// dependency graph and are tested by unit tests.
@@ -304,35 +302,28 @@ public class DummyPluginAClass {
return TaskResult.failure('Failed to build plugin A example iOS app');
}
if (swiftPackageManagerEnabled) {
// Check plugins are built statically if using SwiftPM.
final String executable = path.join(appBundle.path, 'Runner');
final String symbols = await dumpSymbolTable(executable);
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_a.framework',
));
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_b.framework',
));
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_c.framework',
));
final bool foundA = symbols.contains('plugin_a');
final bool foundB = symbols.contains('plugin_b');
final bool foundC = symbols.contains('plugin_c');
final bool foundD = symbols.contains('plugin_d');
if (!foundA || !foundB || !foundC) {
return TaskResult.failure(
'Failed to find plugins_a, plugin_b, or plugin_c symbols in the app'
);
}
if (foundD) {
return TaskResult.failure(
'Found Android plugin_d symbols in iOS app'
);
}
} else {
// Check plugins are built dynamically if using CocoaPods.
checkDirectoryExists(path.join(appBundle.path, 'Frameworks', 'plugin_a.framework'));
checkDirectoryExists(path.join(appBundle.path, 'Frameworks', 'plugin_b.framework'));
checkDirectoryExists(path.join(appBundle.path, 'Frameworks', 'plugin_c.framework'));
checkDirectoryNotExists(path.join(appBundle.path, 'Frameworks', 'plugin_d.framework'));
}
// Plugin D is Android only and should not be embedded.
checkDirectoryNotExists(path.join(
appBundle.path,
'Frameworks',
'plugin_d.framework',
));
}
return TaskResult.success(null);