Unverified Commit 2ece1c3a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Revert "Build iOS apps using Swift Packages (#58522)" (#58549)

This reverts commit 2054f37a.
parent 7c22057f
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -12,7 +12,7 @@ import 'package:path/path.dart' as path;
Future<void> main() async {
await task(() async {
section('Copy app with watchOS companion and Swift Package');
section('Copy test Flutter App with WatchOS Companion');
String watchDeviceID;
String phoneDeviceID;
......@@ -47,7 +47,7 @@ Future<void> main() async {
if (!appReleaseBuilt) {
return TaskResult.failure(
'Failed to build flutter iOS app with watchOS companion and Swift Package in release mode.');
'Failed to build flutter iOS app with WatchOS companion in release mode.');
}
section('Create debug build');
......@@ -69,7 +69,7 @@ Future<void> main() async {
if (!appDebugBuilt) {
return TaskResult.failure(
'Failed to build flutter iOS app with watchOS companion and Swift Package in debug mode.');
'Failed to build flutter iOS app with WatchOS companion in debug mode.');
}
section('Create build for a simulator device');
......@@ -183,7 +183,7 @@ Future<void> main() async {
if (!appSimulatorBuilt) {
return TaskResult.failure(
'Failed to build flutter iOS app with watchOS companion and Swift Package in debug mode for simulated device.');
'Failed to build flutter iOS app with WatchOS companion in debug mode for simulated device.');
}
section('Run app on simulator device');
......@@ -229,7 +229,7 @@ Future<void> main() async {
if (exitCode != 0)
return TaskResult.failure(
'Failed to start flutter iOS app with watchOS companion and Swift Package on simulated device.');
'Failed to start flutter iOS app with WatchOS companion on simulated device.');
return TaskResult.success(null);
} catch (e) {
......
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -262,14 +262,9 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
......
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -3,4 +3,3 @@
Integration test to test building an iOS app with
non-Flutter features:
- watchOS app and extension
- Swift Package
......@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
......@@ -22,7 +22,6 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
F735C5C42485E50A002BE868 /* PlayingCard in Frameworks */ = {isa = PBXBuildFile; productRef = F735C5C32485E50A002BE868 /* PlayingCard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -116,7 +115,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F735C5C42485E50A002BE868 /* PlayingCard in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -264,9 +262,6 @@
49C15B68243E340F0025F804 /* PBXTargetDependency */,
);
name = Runner;
packageProductDependencies = (
F735C5C32485E50A002BE868 /* PlayingCard */,
);
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
......@@ -302,9 +297,6 @@
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
packageReferences = (
F735C5C22485E50A002BE868 /* XCRemoteSwiftPackageReference "example-package-playingcard" */,
);
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
......@@ -915,25 +907,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
F735C5C22485E50A002BE868 /* XCRemoteSwiftPackageReference "example-package-playingcard" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/example-package-playingcard.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.0.5;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
F735C5C32485E50A002BE868 /* PlayingCard */ = {
isa = XCSwiftPackageProductDependency;
package = F735C5C22485E50A002BE868 /* XCRemoteSwiftPackageReference "example-package-playingcard" */;
productName = PlayingCard;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
{
"object": {
"pins": [
{
"package": "PlayingCard",
"repositoryURL": "https://github.com/apple/example-package-playingcard.git",
"state": {
"branch": null,
"revision": "39ddabb01e8102ab548a8c6bb3eb20b15f3b4fbc",
"version": "3.0.5"
}
}
]
},
"version": 1
}
{
"object": {
"pins": [
{
"package": "PlayingCard",
"repositoryURL": "https://github.com/apple/example-package-playingcard.git",
"state": {
"branch": null,
"revision": "39ddabb01e8102ab548a8c6bb3eb20b15f3b4fbc",
"version": "3.0.5"
}
}
]
},
"version": 1
}
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,9 +2,9 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "self:Pods/Pods.xcodeproj">
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,9 +2,9 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "self:Pods/Pods.xcodeproj">
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,9 +2,9 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "self:Pods/Pods.xcodeproj">
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -26,7 +26,6 @@ import '../reporting/reporting.dart';
import 'code_signing.dart';
import 'migrations/ios_migrator.dart';
import 'migrations/project_base_configuration_migration.dart';
import 'migrations/project_build_location_migration.dart';
import 'migrations/remove_framework_link_and_embedding_migration.dart';
import 'migrations/xcode_build_system_migration.dart';
import 'xcodeproj.dart';
......@@ -98,7 +97,6 @@ Future<XcodeBuildResult> buildXcodeProject({
RemoveFrameworkLinkAndEmbeddingMigration(app.project, globals.logger, globals.xcode, globals.flutterUsage),
XcodeBuildSystemMigration(app.project, globals.logger),
ProjectBaseConfigurationMigration(app.project, globals.logger),
ProjectBuildLocationMigration(app.project, globals.logger),
];
final IOSMigration migration = IOSMigration(migrators);
......
......@@ -84,7 +84,7 @@ class ProjectBaseConfigurationMigration extends IOSMigrator {
newProjectContents = newProjectContents.replaceAll(releaseBaseConfigurationOriginal, releaseBaseConfigurationReplacement);
if (originalProjectContents != newProjectContents) {
logger.printStatus('Project base configurations detected, removing.');
_xcodeProjectInfoFile.writeAsStringSync(newProjectContents);
_xcodeProjectInfoFile.writeAsStringSync(newProjectContents.toString());
}
return true;
}
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../../base/file_system.dart';
import '../../base/logger.dart';
import '../../project.dart';
import 'ios_migrator.dart';
// Update the xcodeproj build location. Legacy build location does not work with Swift Packages.
class ProjectBuildLocationMigration extends IOSMigrator {
ProjectBuildLocationMigration(
IosProject project,
Logger logger,
) : _xcodeProjectWorkspaceData = project.xcodeProjectWorkspaceData,
super(logger);
final File _xcodeProjectWorkspaceData;
@override
bool migrate() {
if (!_xcodeProjectWorkspaceData.existsSync()) {
logger.printTrace('Xcode project workspace data not found, skipping build location migration.');
return true;
}
processFileLines(_xcodeProjectWorkspaceData);
return true;
}
@override
String migrateLine(String line) {
const String legacyBuildLocation = 'location = "group:';
const String defaultBuildLocation = 'location = "self:';
return line.replaceAll(legacyBuildLocation, defaultBuildLocation);
}
}
......@@ -398,11 +398,6 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
@override
File get xcodeProjectInfoFile => xcodeProject.childFile('project.pbxproj');
File get xcodeProjectWorkspaceData =>
xcodeProject
.childDirectory('project.xcworkspace')
.childFile('contents.xcworkspacedata');
@override
Directory get xcodeWorkspace => hostAppRoot.childDirectory('$_hostAppProjectName.xcworkspace');
......
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
......@@ -5,9 +5,10 @@
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/ios/migrations/ios_migrator.dart';
import 'package:flutter_tools/src/ios/migrations/project_base_configuration_migration.dart';
import 'package:flutter_tools/src/ios/migrations/project_build_location_migration.dart';
import 'package:flutter_tools/src/ios/migrations/remove_framework_link_and_embedding_migration.dart';
import 'package:flutter_tools/src/ios/migrations/xcode_build_system_migration.dart';
import 'package:flutter_tools/src/macos/xcode.dart';
......@@ -48,7 +49,15 @@ void main () {
memoryFileSystem = MemoryFileSystem();
mockXcode = MockXcode();
xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj');
testLogger = BufferLogger.test();
testLogger = BufferLogger(
terminal: AnsiTerminal(
stdio: null,
platform: const LocalPlatform(),
),
outputPreferences: OutputPreferences.test(),
);
mockIosProject = MockIosProject();
when(mockIosProject.xcodeProjectInfoFile).thenReturn(xcodeProjectInfoFile);
});
......@@ -259,7 +268,15 @@ keep this 2
setUp(() {
memoryFileSystem = MemoryFileSystem();
xcodeWorkspaceSharedSettings = memoryFileSystem.file('WorkspaceSettings.xcsettings');
testLogger = BufferLogger.test();
testLogger = BufferLogger(
terminal: AnsiTerminal(
stdio: null,
platform: const LocalPlatform(),
),
outputPreferences: OutputPreferences.test(),
);
mockIosProject = MockIosProject();
when(mockIosProject.xcodeWorkspaceSharedSettings).thenReturn(xcodeWorkspaceSharedSettings);
});
......@@ -322,87 +339,6 @@ keep this 2
});
});
group('Xcode default build location', () {
MemoryFileSystem memoryFileSystem;
BufferLogger testLogger;
MockIosProject mockIosProject;
File xcodeProjectWorkspaceData;
setUp(() {
memoryFileSystem = MemoryFileSystem();
xcodeProjectWorkspaceData = memoryFileSystem.file('contents.xcworkspacedata');
testLogger = BufferLogger.test();
mockIosProject = MockIosProject();
when(mockIosProject.xcodeProjectWorkspaceData).thenReturn(xcodeProjectWorkspaceData);
});
testWithoutContext('skipped if files are missing', () {
final ProjectBuildLocationMigration iosProjectMigration = ProjectBuildLocationMigration(
mockIosProject,
testLogger,
);
expect(iosProjectMigration.migrate(), isTrue);
expect(xcodeProjectWorkspaceData.existsSync(), isFalse);
expect(testLogger.traceText, contains('Xcode project workspace data not found, skipping build location migration.'));
expect(testLogger.statusText, isEmpty);
});
testWithoutContext('skipped if nothing to upgrade', () {
const String contents = '''
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>''';
xcodeProjectWorkspaceData.writeAsStringSync(contents);
final ProjectBuildLocationMigration iosProjectMigration = ProjectBuildLocationMigration(
mockIosProject,
testLogger,
);
expect(iosProjectMigration.migrate(), isTrue);
expect(xcodeProjectWorkspaceData.existsSync(), isTrue);
expect(testLogger.statusText, isEmpty);
});
testWithoutContext('Xcode project is migrated', () {
const String contents = '''
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>''';
xcodeProjectWorkspaceData.writeAsStringSync(contents);
final ProjectBuildLocationMigration iosProjectMigration = ProjectBuildLocationMigration(
mockIosProject,
testLogger,
);
expect(iosProjectMigration.migrate(), isTrue);
expect(xcodeProjectWorkspaceData.readAsStringSync(), '''
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Runner.xcodeproj">
</FileRef>
<FileRef
location = "self:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
''');
expect(testLogger.statusText, contains('Upgrading contents.xcworkspacedata'));
});
});
group('remove Runner project base configuration', () {
MemoryFileSystem memoryFileSystem;
BufferLogger testLogger;
......@@ -412,7 +348,15 @@ keep this 2
setUp(() {
memoryFileSystem = MemoryFileSystem();
xcodeProjectInfoFile = memoryFileSystem.file('project.pbxproj');
testLogger = BufferLogger.test();
testLogger = BufferLogger(
terminal: AnsiTerminal(
stdio: null,
platform: const LocalPlatform(),
),
outputPreferences: OutputPreferences.test(),
);
mockIosProject = MockIosProject();
when(mockIosProject.xcodeProjectInfoFile).thenReturn(xcodeProjectInfoFile);
});
......
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