Repository: flutter
Issue: Investigate integrating integration_test as Swift package instead of pod
Labels: a: tests,tool,t: xcode,f: integration_test,P3,team-tool,triaged-tool

[integration_test](https://github.com/flutter/flutter/tree/master/packages/integration_test) is currently included in a newly `flutter create`d pubspec.  It is embedded in iOS projects via CocoaPods as is normal for a plugin (though really it should only be embedded in a test target, but that's a [fixable bug](https://github.com/flutter/flutter/issues/56591#issuecomment-746889739)).  This means that every project will need to be opted into CocoaPods (currently a dependency only required with plugins), even though `integration_test` has no pod dependencies and is not even distributed via pub.

This plugin is shipped in the repository proper, so it may instead possible to integrate it into test projects via Swift Package Manager, bypassing CocoaPods completely.

I have a prototype working with a `Package.swift` file in the root of the Flutter repo:
```swift
// swift-tools-version:5.3

import PackageDescription

let package = Package(
  name: "Flutter",
  platforms: [
    .iOS(.v9)
  ],
  products: [
    .library(
      name: "integration_test",
      targets: ["integration_test"]),
  ],
  targets: [
    .target(
      name: "integration_test",
      dependencies: ["Flutter"],
      path: "packages/integration_test/ios",
      exclude: ["integration_test.podspec"],
      sources: ["Classes"],
      publicHeadersPath: "Classes"
    ),
    .binaryTarget(
      name: "Flutter",
      path: "bin/cache/artifacts/engine/ios-release/Flutter.xcframework"),
  ]
)
```
To test this, drag the flutter repo directory into Frameworks:
![Screen Shot 2020-12-16 at 6 03 09 PM](https://user-images.githubusercontent.com/682784/102434136-02a0c880-3fc9-11eb-9112-747d06dddac2.png)

Create a test target with `@import integration_test`, `Link Binary with Libraries`, and choose `integration_test`
![Screen Shot 2020-12-16 at 6 03 19 PM](https://user-images.githubusercontent.com/682784/102434133-00d70500-3fc9-11eb-9a06-665ab481cd73.png)
It should then build.

Notes:
1. The Flutter `binaryTarget` is required since `integration_test` imports `Flutter`.  I wasn't able to get any linker tricks working to avoid this.
2. Since `binaryTarget` is required, this will only work in Xcode 12+ (Swift 5.3) where the feature was introduced.  Currently the minimum Xcode version enforced in the tool is 11.0.
3. All places where plugins==CocoaPods is assumed needs to be hard coded to avoid integration_test the tool.  For example, don't generate a `Podfile` when it's the only plugin, etc.
4. `integration_test` should be removed from `GeneratedPluginRegistrant` since the app proper should never link on this.
5. The `path` to the Package.swift will need to be a property in the Xcode project.  The path can't actually be the absolute path to the user's Flutter SDK since that will be different on every machine, and this file is checked in and shared between team members.  That probably means creating a symlink to the project to the repo (in `ios/.symlinks/flutter`?) recreated on every `ensureReadyForPlatformSpecificTooling`.
```
F7FA93DA258AEF2200C1C93B /* flutter */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter; path = path/to/flutter; sourceTree = "<group>"; };
```

Blocked by https://github.com/flutter/flutter/issues/57083