Skip to content

Commit 4988af5

Browse files
[pigeon] Convert test plugins to SPM (#9105)
Updates the test harness plugins to support SPM, so that tests won't rely on CocoaPods going forward. For now I've left CocoaPods support in the plugins and the integration in the example app, so that local tests won't rely on SPM support being on, but in the future when needing to disable it locally for testing plugins is rare we can fully remove CocoaPods from the test plugins and their apps since they aren't public plugins and thus don't need to support both modes once we don't use both ourselves. Part of flutter/flutter#146922 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 6317cd6 commit 4988af5

File tree

26 files changed

+255
-69
lines changed

26 files changed

+255
-69
lines changed

packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ A plugin to test Pigeon generation for secondary languages (e.g., Java, Objectiv
1313
s.license = { :type => 'BSD', :file => '../../../LICENSE' }
1414
s.author = { 'Your Company' => '[email protected]' }
1515
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' }
16-
s.source_files = 'Classes/**/*'
17-
s.public_header_files = 'Classes/**/*.h'
16+
s.source_files = 'alternate_language_test_plugin/Sources/alternate_language_test_plugin/**/*.{h,m}'
17+
s.public_header_files = 'alternate_language_test_plugin/Sources/alternate_language_test_plugin/include/**/*.h'
1818
s.ios.dependency 'Flutter'
1919
s.osx.dependency 'FlutterMacOS'
2020
s.ios.deployment_target = '12.0'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
// Copyright 2013 The Flutter Authors. All rights reserved.
5+
// Use of this source code is governed by a BSD-style license that can be
6+
// found in the LICENSE file.
7+
8+
import PackageDescription
9+
10+
let package = Package(
11+
name: "alternate_language_test_plugin",
12+
platforms: [
13+
.iOS("12.0"),
14+
.macOS("10.14"),
15+
],
16+
products: [
17+
.library(name: "alternate-language-test-plugin", targets: ["alternate_language_test_plugin"])
18+
],
19+
dependencies: [],
20+
targets: [
21+
.target(
22+
name: "alternate_language_test_plugin",
23+
dependencies: [],
24+
resources: [],
25+
cSettings: [
26+
.headerSearchPath("include/alternate_language_test_plugin")
27+
]
28+
)
29+
]
30+
)

packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/Classes/CoreTests.gen.m renamed to packages/pigeon/platform_tests/alternate_language_test_plugin/darwin/alternate_language_test_plugin/Sources/alternate_language_test_plugin/CoreTests.gen.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Autogenerated from Pigeon, do not edit directly.
66
// See also: https://pub.dev/packages/pigeon
77

8-
#import "CoreTests.gen.h"
8+
#import "./include/alternate_language_test_plugin/CoreTests.gen.h"
99

1010
#if TARGET_OS_OSX
1111
#import <FlutterMacOS/FlutterMacOS.h>

packages/pigeon/platform_tests/alternate_language_test_plugin/example/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
3030
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
3131
EB2133B34553CD36D4AE374F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F87F49FAD891F66A75D95E85 /* libPods-Runner.a */; };
32+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
3233
/* End PBXBuildFile section */
3334

3435
/* Begin PBXContainerItemProxy section */
@@ -109,6 +110,7 @@
109110
isa = PBXFrameworksBuildPhase;
110111
buildActionMask = 2147483647;
111112
files = (
113+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
112114
EB2133B34553CD36D4AE374F /* libPods-Runner.a in Frameworks */,
113115
);
114116
runOnlyForDeploymentPostprocessing = 0;
@@ -240,6 +242,9 @@
240242
productType = "com.apple.product-type.bundle.unit-test";
241243
};
242244
97C146ED1CF9000F007C117D /* Runner */ = {
245+
packageProductDependencies = (
246+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
247+
);
243248
isa = PBXNativeTarget;
244249
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
245250
buildPhases = (
@@ -264,6 +269,9 @@
264269

265270
/* Begin PBXProject section */
266271
97C146E61CF9000F007C117D /* Project object */ = {
272+
packageReferences = (
273+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
274+
);
267275
isa = PBXProject;
268276
attributes = {
269277
LastUpgradeCheck = 1510;
@@ -745,6 +753,18 @@
745753
defaultConfigurationName = Release;
746754
};
747755
/* End XCConfigurationList section */
756+
/* Begin XCLocalSwiftPackageReference section */
757+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
758+
isa = XCLocalSwiftPackageReference;
759+
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
760+
};
761+
/* End XCLocalSwiftPackageReference section */
762+
/* Begin XCSwiftPackageProductDependency section */
763+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
764+
isa = XCSwiftPackageProductDependency;
765+
productName = FlutterGeneratedPluginSwiftPackage;
766+
};
767+
/* End XCSwiftPackageProductDependency section */
748768
};
749769
rootObject = 97C146E61CF9000F007C117D /* Project object */;
750770
}

packages/pigeon/platform_tests/alternate_language_test_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<PreActions>
9+
<ExecutionAction
10+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
11+
<ActionContent
12+
title = "Run Prepare Flutter Framework Script"
13+
scriptText = "/bin/sh &quot;$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh&quot; prepare&#10;">
14+
<EnvironmentBuildable>
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
18+
BuildableName = "Runner.app"
19+
BlueprintName = "Runner"
20+
ReferencedContainer = "container:Runner.xcodeproj">
21+
</BuildableReference>
22+
</EnvironmentBuildable>
23+
</ActionContent>
24+
</ExecutionAction>
25+
</PreActions>
826
<BuildActionEntries>
927
<BuildActionEntry
1028
buildForTesting = "YES"
@@ -26,6 +44,7 @@
2644
buildConfiguration = "Debug"
2745
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2846
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2948
shouldUseLaunchSchemeArgsEnv = "YES">
3049
<MacroExpansion>
3150
<BuildableReference
@@ -54,11 +73,13 @@
5473
buildConfiguration = "Debug"
5574
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5675
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
76+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5777
launchStyle = "0"
5878
useCustomWorkingDirectory = "NO"
5979
ignoresPersistentStateOnLaunch = "NO"
6080
debugDocumentVersioning = "YES"
6181
debugServiceExtension = "internal"
82+
enableGPUValidationMode = "1"
6283
allowLocationSimulation = "YES">
6384
<BuildableProductRunnable
6485
runnableDebuggingMode = "0">

packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
3030
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
3131
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
32+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
3233
/* End PBXBuildFile section */
3334

3435
/* Begin PBXContainerItemProxy section */
@@ -103,6 +104,7 @@
103104
isa = PBXFrameworksBuildPhase;
104105
buildActionMask = 2147483647;
105106
files = (
107+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
106108
0D7AA04F867B850C58216739 /* Pods_Runner.framework in Frameworks */,
107109
);
108110
runOnlyForDeploymentPostprocessing = 0;
@@ -240,14 +242,16 @@
240242
33CC10EB2044A3C60003C045 /* Resources */,
241243
33CC110E2044A8840003C045 /* Bundle Framework */,
242244
3399D490228B24CF009A79C7 /* ShellScript */,
243-
271CA0FEC73C4F272B016320 /* [CP] Embed Pods Frameworks */,
244245
);
245246
buildRules = (
246247
);
247248
dependencies = (
248249
33CC11202044C79F0003C045 /* PBXTargetDependency */,
249250
);
250251
name = Runner;
252+
packageProductDependencies = (
253+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
254+
);
251255
productName = Runner;
252256
productReference = 33CC10ED2044A3C60003C045 /* alternate_language_test_plugin_example.app */;
253257
productType = "com.apple.product-type.application";
@@ -259,7 +263,7 @@
259263
isa = PBXProject;
260264
attributes = {
261265
LastSwiftUpdateCheck = 0920;
262-
LastUpgradeCheck = 1430;
266+
LastUpgradeCheck = 1510;
263267
ORGANIZATIONNAME = "";
264268
TargetAttributes = {
265269
331C80D4294CF70F00263BE5 = {
@@ -291,6 +295,9 @@
291295
Base,
292296
);
293297
mainGroup = 33CC10E42044A3C60003C045;
298+
packageReferences = (
299+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
300+
);
294301
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
295302
projectDirPath = "";
296303
projectRoot = "";
@@ -322,23 +329,6 @@
322329
/* End PBXResourcesBuildPhase section */
323330

324331
/* Begin PBXShellScriptBuildPhase section */
325-
271CA0FEC73C4F272B016320 /* [CP] Embed Pods Frameworks */ = {
326-
isa = PBXShellScriptBuildPhase;
327-
buildActionMask = 2147483647;
328-
files = (
329-
);
330-
inputFileListPaths = (
331-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
332-
);
333-
name = "[CP] Embed Pods Frameworks";
334-
outputFileListPaths = (
335-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
336-
);
337-
runOnlyForDeploymentPostprocessing = 0;
338-
shellPath = /bin/sh;
339-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
340-
showEnvVarsInLog = 0;
341-
};
342332
3399D490228B24CF009A79C7 /* ShellScript */ = {
343333
isa = PBXShellScriptBuildPhase;
344334
alwaysOutOfDate = 1;
@@ -786,6 +776,20 @@
786776
defaultConfigurationName = Release;
787777
};
788778
/* End XCConfigurationList section */
779+
780+
/* Begin XCLocalSwiftPackageReference section */
781+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
782+
isa = XCLocalSwiftPackageReference;
783+
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
784+
};
785+
/* End XCLocalSwiftPackageReference section */
786+
787+
/* Begin XCSwiftPackageProductDependency section */
788+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
789+
isa = XCSwiftPackageProductDependency;
790+
productName = FlutterGeneratedPluginSwiftPackage;
791+
};
792+
/* End XCSwiftPackageProductDependency section */
789793
};
790794
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
791795
}

packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<PreActions>
9+
<ExecutionAction
10+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
11+
<ActionContent
12+
title = "Run Prepare Flutter Framework Script"
13+
scriptText = "&quot;$FLUTTER_ROOT&quot;/packages/flutter_tools/bin/macos_assemble.sh prepare&#10;">
14+
<EnvironmentBuildable>
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
18+
BuildableName = "alternate_language_test_plugin_example.app"
19+
BlueprintName = "Runner"
20+
ReferencedContainer = "container:Runner.xcodeproj">
21+
</BuildableReference>
22+
</EnvironmentBuildable>
23+
</ActionContent>
24+
</ExecutionAction>
25+
</PreActions>
826
<BuildActionEntries>
927
<BuildActionEntry
1028
buildForTesting = "YES"
@@ -59,6 +77,7 @@
5977
ignoresPersistentStateOnLaunch = "NO"
6078
debugDocumentVersioning = "YES"
6179
debugServiceExtension = "internal"
80+
enableGPUValidationMode = "1"
6281
allowLocationSimulation = "YES">
6382
<BuildableProductRunnable
6483
runnableDebuggingMode = "0">

packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Runner/AppDelegate.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
import Cocoa
66
import FlutterMacOS
77

8-
@NSApplicationMain
8+
@main
99
class AppDelegate: FlutterAppDelegate {
1010
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
1111
return true
1212
}
13+
14+
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
15+
return true
16+
}
1317
}

packages/pigeon/platform_tests/test_plugin/darwin/test_plugin.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
1313
s.license = { :type => 'BSD', :file => '../../../LICENSE' }
1414
s.author = { 'Your Company' => '[email protected]' }
1515
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/pigeon' }
16-
s.source_files = 'Classes/**/*'
16+
s.source_files = 'test_plugin/Sources/test_plugin/**/*.swift'
1717
s.ios.dependency 'Flutter'
1818
s.osx.dependency 'FlutterMacOS'
1919
s.ios.deployment_target = '12.0'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
// Copyright 2013 The Flutter Authors. All rights reserved.
5+
// Use of this source code is governed by a BSD-style license that can be
6+
// found in the LICENSE file.
7+
8+
import PackageDescription
9+
10+
let package = Package(
11+
name: "test_plugin",
12+
platforms: [
13+
.iOS("12.0"),
14+
.macOS("10.14"),
15+
],
16+
products: [
17+
.library(name: "test-plugin", targets: ["test_plugin"])
18+
],
19+
dependencies: [],
20+
targets: [
21+
.target(
22+
name: "test_plugin",
23+
dependencies: [],
24+
resources: []
25+
)
26+
]
27+
)

0 commit comments

Comments
 (0)