Unverified Commit 27293857 authored by Dan Field's avatar Dan Field Committed by GitHub

Make host app test actually test host app (#24131)

* Make host app test actually test host app

* mark updated test as flaky
parent 846a5eea
...@@ -14,7 +14,6 @@ import 'package:path/path.dart' as path; ...@@ -14,7 +14,6 @@ import 'package:path/path.dart' as path;
/// adding Flutter to an existing iOS app. /// adding Flutter to an existing iOS app.
Future<void> main() async { Future<void> main() async {
await task(() async { await task(() async {
section('Create Flutter module project'); section('Create Flutter module project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.'); final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
...@@ -23,7 +22,12 @@ Future<void> main() async { ...@@ -23,7 +22,12 @@ Future<void> main() async {
await inDirectory(tempDir, () async { await inDirectory(tempDir, () async {
await flutter( await flutter(
'create', 'create',
options: <String>['--org', 'io.flutter.devicelab', '--template=module', 'hello'], options: <String>[
'--org',
'io.flutter.devicelab',
'--template=module',
'hello'
],
); );
}); });
await prepareProvisioningCertificates(projectDir.path); await prepareProvisioningCertificates(projectDir.path);
...@@ -127,11 +131,51 @@ Future<void> main() async { ...@@ -127,11 +131,51 @@ Future<void> main() async {
if (!editableHostAppBuilt) { if (!editableHostAppBuilt) {
return TaskResult.failure('Failed to build editable host .app'); return TaskResult.failure('Failed to build editable host .app');
} }
section('Add to existing iOS app');
final Directory hostApp = Directory(path.join(tempDir.path, 'hello_host_app'));
mkdir(hostApp);
recursiveCopy(
Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app')),
hostApp,
);
await inDirectory(hostApp, () async {
await exec('pod', <String>['install']);
await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGNING_IDENTITY=""',
'EXPANDED_CODE_SIGN_IDENTITY=""',
'CONFIGURATION_BUILD_DIR=${tempDir.path}',
],
);
});
final bool existingAppBuilt = exists(File(path.join(
tempDir.path,
'Host.app',
'Host',
)));
if (!existingAppBuilt) {
return TaskResult.failure('Failed to build existing app .app');
}
return TaskResult.success(null); return TaskResult.success(null);
} catch (e) { } catch (e) {
return TaskResult.failure(e.toString()); return TaskResult.failure(e.toString());
} finally { } finally {
//rmTree(tempDir); rmTree(tempDir);
} }
}); });
} }
...@@ -326,6 +326,7 @@ tasks: ...@@ -326,6 +326,7 @@ tasks:
Checks that the module project template works and supports add2app on iOS. Checks that the module project template works and supports add2app on iOS.
stage: devicelab stage: devicelab
required_agent_capabilities: ["mac/ios"] required_agent_capabilities: ["mac/ios"]
flaky: true
external_ui_integration_test_ios: external_ui_integration_test_ios:
description: > description: >
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; shellScript = "\"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n\"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed\n";
}; };
EDACAC7378E52BD5BBDB34D5 /* [CP] Check Pods Manifest.lock */ = { EDACAC7378E52BD5BBDB34D5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
......
# iOS host app
iOS host app for a Flutter module created using
```
$ flutter create -t module hello
```
and placed in a sibling folder to (a clone of) the host app.
Used by the `module_test_ios.dart` device lab test.
...@@ -367,9 +367,10 @@ EmbedFlutterFrameworks() { ...@@ -367,9 +367,10 @@ EmbedFlutterFrameworks() {
# Sign the binaries we moved. # Sign the binaries we moved.
local identity="${EXPANDED_CODE_SIGN_IDENTITY_NAME:-$CODE_SIGN_IDENTITY}" local identity="${EXPANDED_CODE_SIGN_IDENTITY_NAME:-$CODE_SIGN_IDENTITY}"
if (${identity} != ""); then
RunCommand codesign --force --verbose --sign "${identity}" -- "${xcode_frameworks_dir}/App.framework/App" RunCommand codesign --force --verbose --sign "${identity}" -- "${xcode_frameworks_dir}/App.framework/App"
RunCommand codesign --force --verbose --sign "${identity}" -- "${xcode_frameworks_dir}/Flutter.framework/Flutter" RunCommand codesign --force --verbose --sign "${identity}" -- "${xcode_frameworks_dir}/Flutter.framework/Flutter"
fi
} }
# Main entry point. # Main entry point.
......
...@@ -68,7 +68,7 @@ post_install do |installer| ...@@ -68,7 +68,7 @@ post_install do |installer|
config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['ENABLE_BITCODE'] = 'NO'
xcconfig_path = config.base_configuration_reference.real_path xcconfig_path = config.base_configuration_reference.real_path
File.open(xcconfig_path, 'a+') do |file| File.open(xcconfig_path, 'a+') do |file|
file.puts "#include \"#{File.join(framework_dir, 'Generated.xcconfig')}\"" file.puts "#include \"#{File.realpath(File.join(framework_dir, 'Generated.xcconfig'))}\""
end end
end end
end end
......
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