Unverified Commit dff7ea1c authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

Revert "Avoid thinning frameworks in iOS extensions (#64674)" (#64829)

This reverts commit ce9cde8c.
parent 6f02c0b2
...@@ -7,14 +7,12 @@ import 'dart:convert'; ...@@ -7,14 +7,12 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:meta/meta.dart';
Future<void> main() async { Future<void> main() async {
await task(() async { await task(() async {
section('Copy test Flutter App with watchOS Companion'); section('Copy test Flutter App with WatchOS Companion');
String watchDeviceID; String watchDeviceID;
String phoneDeviceID; String phoneDeviceID;
...@@ -35,54 +33,22 @@ Future<void> main() async { ...@@ -35,54 +33,22 @@ Future<void> main() async {
await inDirectory(projectDir, () async { await inDirectory(projectDir, () async {
await flutter( await flutter(
'build', 'build',
options: <String>['ios', '--no-codesign', '--release'], options: <String>['ios', '--no-codesign'],
); );
}); });
final String appBundle = Directory(path.join( final bool appReleaseBuilt = exists(Directory(path.join(
projectDir.path, projectDir.path,
'build', 'build',
'ios', 'ios',
'iphoneos', 'iphoneos',
'Runner.app', 'Runner.app',
)).path; )));
final String appFrameworkPath = path.join( if (!appReleaseBuilt) {
appBundle, return TaskResult.failure(
'Frameworks', 'Failed to build flutter iOS app with WatchOS companion in release mode.');
'App.framework', }
'App',
);
final String flutterFrameworkPath = path.join(
appBundle,
'Frameworks',
'Flutter.framework',
'Flutter',
);
checkDirectoryExists(appBundle);
await _checkFlutterFrameworkArchs(appFrameworkPath, isSimulator: false);
await _checkFlutterFrameworkArchs(flutterFrameworkPath, isSimulator: false);
// Check the watch extension framework added in the Podfile
// is in place with the expected watch archs.
final String watchExtensionFrameworkPath = path.join(
appBundle,
'Watch',
'watch.app',
'PlugIns',
'watch Extension.appex',
'Frameworks',
'EFQRCode.framework',
'EFQRCode',
);
_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath);
section('Clean build');
await inDirectory(projectDir, () async {
await flutter('clean');
});
section('Create debug build'); section('Create debug build');
...@@ -93,18 +59,20 @@ Future<void> main() async { ...@@ -93,18 +59,20 @@ Future<void> main() async {
); );
}); });
checkDirectoryExists(appBundle); final bool appDebugBuilt = exists(Directory(path.join(
await _checkFlutterFrameworkArchs(appFrameworkPath, isSimulator: false); projectDir.path,
await _checkFlutterFrameworkArchs(flutterFrameworkPath, isSimulator: false); 'build',
_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath); 'ios',
'iphoneos',
section('Clean build'); 'Runner.app',
)));
await inDirectory(projectDir, () async { if (!appDebugBuilt) {
await flutter('clean'); return TaskResult.failure(
}); 'Failed to build flutter iOS app with WatchOS companion in debug mode.');
}
section('Run app on simulator device'); section('Create build for a simulator device');
// Xcode 11.4 simctl create makes the runtime argument optional, and defaults to latest. // Xcode 11.4 simctl create makes the runtime argument optional, and defaults to latest.
// TODO(jmagman): Remove runtime parsing when devicelab upgrades to Xcode 11.4 https://github.com/flutter/flutter/issues/54889 // TODO(jmagman): Remove runtime parsing when devicelab upgrades to Xcode 11.4 https://github.com/flutter/flutter/issues/54889
...@@ -192,6 +160,34 @@ Future<void> main() async { ...@@ -192,6 +160,34 @@ Future<void> main() async {
workingDirectory: flutterDirectory.path, workingDirectory: flutterDirectory.path,
); );
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'ios',
'--debug',
'--no-codesign',
'-d',
phoneDeviceID
],
);
});
final bool appSimulatorBuilt = exists(Directory(path.join(
projectDir.path,
'build',
'ios',
'iphoneos',
'Runner.app',
)));
if (!appSimulatorBuilt) {
return TaskResult.failure(
'Failed to build flutter iOS app with WatchOS companion in debug mode for simulated device.');
}
section('Run app on simulator device');
// Boot simulator devices. // Boot simulator devices.
await eval( await eval(
'xcrun', 'xcrun',
...@@ -231,36 +227,9 @@ Future<void> main() async { ...@@ -231,36 +227,9 @@ Future<void> main() async {
final int exitCode = await process.exitCode; final int exitCode = await process.exitCode;
if (exitCode != 0) { if (exitCode != 0)
return TaskResult.failure( return TaskResult.failure(
'Failed to start flutter iOS app with WatchOS companion on simulated device.'); 'Failed to start flutter iOS app with WatchOS companion on simulated device.');
}
final String simulatorAppBundle = Directory(path.join(
projectDir.path,
'build',
'ios',
'iphonesimulator',
'Runner.app',
)).path;
checkDirectoryExists(simulatorAppBundle);
final String simulatorAppFrameworkPath = path.join(
simulatorAppBundle,
'Frameworks',
'App.framework',
'App',
);
final String simulatorFlutterFrameworkPath = path.join(
simulatorAppBundle,
'Frameworks',
'Flutter.framework',
'Flutter',
);
await _checkFlutterFrameworkArchs(simulatorAppFrameworkPath, isSimulator: true);
await _checkFlutterFrameworkArchs(simulatorFlutterFrameworkPath, isSimulator: true);
return TaskResult.success(null); return TaskResult.success(null);
} catch (e) { } catch (e) {
...@@ -299,35 +268,3 @@ Future<void> main() async { ...@@ -299,35 +268,3 @@ Future<void> main() async {
} }
}); });
} }
Future<void> _checkFlutterFrameworkArchs(String frameworkPath, {
@required bool isSimulator
}) async {
checkFileExists(frameworkPath);
final String archs = await fileType(frameworkPath);
if (isSimulator == archs.contains('armv7')) {
throw TaskResult.failure('$frameworkPath armv7 architecture unexpected');
}
if (isSimulator == archs.contains('arm64')) {
throw TaskResult.failure('$frameworkPath arm64 architecture unexpected');
}
if (isSimulator != archs.contains('x86_64')) {
throw TaskResult.failure(
'$frameworkPath x86_64 architecture unexpected');
}
}
Future<void> _checkWatchExtensionFrameworkArchs(String frameworkPath) async {
checkFileExists(frameworkPath);
final String archs = await fileType(frameworkPath);
if (!archs.contains('armv7k')) {
throw TaskResult.failure('$frameworkPath armv7k architecture missing');
}
if (!archs.contains('arm64_32')) {
throw TaskResult.failure('$frameworkPath arm64_32 architecture missing');
}
}
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
target 'watch Extension' do
platform :watchos
use_frameworks!
use_modular_headers!
pod 'EFQRCode/watchOS', '5.1.6'
end
...@@ -4,7 +4,4 @@ ...@@ -4,7 +4,4 @@
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "group:Runner.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace> </Workspace>
...@@ -257,10 +257,11 @@ ThinFramework() { ...@@ -257,10 +257,11 @@ ThinFramework() {
} }
ThinAppFrameworks() { ThinAppFrameworks() {
local xcode_frameworks_dir="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" local app_path="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
local frameworks_dir="${app_path}/Frameworks"
[[ -d "${xcode_frameworks_dir}" ]] || return 0 [[ -d "$frameworks_dir" ]] || return 0
find "${xcode_frameworks_dir}" -type d -name "*.framework" | while read framework_dir; do find "${app_path}" -type d -name "*.framework" | while read framework_dir; do
ThinFramework "$framework_dir" "$ARCHS" ThinFramework "$framework_dir" "$ARCHS"
done done
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment