Skip to content

Commit a9a9ac4

Browse files
stuartmorgan-gamantoux
authored andcommitted
[flutter_plugin_tools] Make no unit tests fatal for iOS/macOS (flutter#4341)
Brings iOS and macOS into alignment with the other platforms, where having unit tests set up is required. - For deprecated plugins with no tests, `--exclude`s them, as on other platforms. - For `quick_actions` and `share`, which have integration tests but no unit tests, sets up the unit test scaffolding. (This is done for `share` even though it's deprecated since unlike other platforms, iOS/macOS runs both native tests in the same command, and setting up a special way to exclude just units tests for that one case would be much more effort.) Fixes flutter/flutter#85469
1 parent 6241609 commit a9a9ac4

File tree

16 files changed

+543
-239
lines changed

16 files changed

+543
-239
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ task:
256256
xcode_analyze_script:
257257
- ./script/tool_runner.sh xcode-analyze --ios
258258
native_test_script:
259-
- ./script/tool_runner.sh native-test --ios --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
259+
- ./script/tool_runner.sh native-test --ios --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest" --exclude=script/configs/exclude_native_ios.yaml
260260
drive_script:
261261
# `drive-examples` contains integration tests, which changes the UI of the application.
262262
# This UI change sometimes affects `xctest`.

packages/quick_actions/quick_actions/example/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
target 'RunnerTests' do
33+
inherit! :search_paths
34+
end
3235
end
3336

3437
post_install do |installer|

packages/quick_actions/quick_actions/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11+
33E20B3526EFCDFC00A4A191 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33E20B3426EFCDFC00A4A191 /* RunnerTests.m */; };
1112
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1213
686BE83025E58CCF00862533 /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 686BE82F25E58CCF00862533 /* RunnerUITests.m */; };
1314
83C36CAF23D629E5ABE75B2A /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CCC799F2B0AB50A9C34344F0 /* libPods-Runner.a */; };
@@ -19,6 +20,13 @@
1920
/* End PBXBuildFile section */
2021

2122
/* Begin PBXContainerItemProxy section */
23+
33E20B3726EFCDFC00A4A191 /* PBXContainerItemProxy */ = {
24+
isa = PBXContainerItemProxy;
25+
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
26+
proxyType = 1;
27+
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
28+
remoteInfo = Runner;
29+
};
2230
686BE83225E58CCF00862533 /* PBXContainerItemProxy */ = {
2331
isa = PBXContainerItemProxy;
2432
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
@@ -44,6 +52,9 @@
4452
/* Begin PBXFileReference section */
4553
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4654
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
55+
33E20B3226EFCDFC00A4A191 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
56+
33E20B3426EFCDFC00A4A191 /* RunnerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerTests.m; sourceTree = "<group>"; };
57+
33E20B3626EFCDFC00A4A191 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4758
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4859
5278439583922091276A37C9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
4960
686BE82D25E58CCF00862533 /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -65,6 +76,13 @@
6576
/* End PBXFileReference section */
6677

6778
/* Begin PBXFrameworksBuildPhase section */
79+
33E20B2F26EFCDFC00A4A191 /* Frameworks */ = {
80+
isa = PBXFrameworksBuildPhase;
81+
buildActionMask = 2147483647;
82+
files = (
83+
);
84+
runOnlyForDeploymentPostprocessing = 0;
85+
};
6886
686BE82A25E58CCF00862533 /* Frameworks */ = {
6987
isa = PBXFrameworksBuildPhase;
7088
buildActionMask = 2147483647;
@@ -83,6 +101,15 @@
83101
/* End PBXFrameworksBuildPhase section */
84102

85103
/* Begin PBXGroup section */
104+
33E20B3326EFCDFC00A4A191 /* RunnerTests */ = {
105+
isa = PBXGroup;
106+
children = (
107+
33E20B3426EFCDFC00A4A191 /* RunnerTests.m */,
108+
33E20B3626EFCDFC00A4A191 /* Info.plist */,
109+
);
110+
path = RunnerTests;
111+
sourceTree = "<group>";
112+
};
86113
686BE82E25E58CCF00862533 /* RunnerUITests */ = {
87114
isa = PBXGroup;
88115
children = (
@@ -109,6 +136,7 @@
109136
9740EEB11CF90186004384FC /* Flutter */,
110137
97C146F01CF9000F007C117D /* Runner */,
111138
686BE82E25E58CCF00862533 /* RunnerUITests */,
139+
33E20B3326EFCDFC00A4A191 /* RunnerTests */,
112140
97C146EF1CF9000F007C117D /* Products */,
113141
D0FE95BE2380323DD75CB891 /* Pods */,
114142
A44AD0D63DEF785A2A2DEE28 /* Frameworks */,
@@ -120,6 +148,7 @@
120148
children = (
121149
97C146EE1CF9000F007C117D /* Runner.app */,
122150
686BE82D25E58CCF00862533 /* RunnerUITests.xctest */,
151+
33E20B3226EFCDFC00A4A191 /* RunnerTests.xctest */,
123152
);
124153
name = Products;
125154
sourceTree = "<group>";
@@ -168,6 +197,24 @@
168197
/* End PBXGroup section */
169198

170199
/* Begin PBXNativeTarget section */
200+
33E20B3126EFCDFC00A4A191 /* RunnerTests */ = {
201+
isa = PBXNativeTarget;
202+
buildConfigurationList = 33E20B3B26EFCDFC00A4A191 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
203+
buildPhases = (
204+
33E20B2E26EFCDFC00A4A191 /* Sources */,
205+
33E20B2F26EFCDFC00A4A191 /* Frameworks */,
206+
33E20B3026EFCDFC00A4A191 /* Resources */,
207+
);
208+
buildRules = (
209+
);
210+
dependencies = (
211+
33E20B3826EFCDFC00A4A191 /* PBXTargetDependency */,
212+
);
213+
name = RunnerTests;
214+
productName = RunnerTests;
215+
productReference = 33E20B3226EFCDFC00A4A191 /* RunnerTests.xctest */;
216+
productType = "com.apple.product-type.bundle.unit-test";
217+
};
171218
686BE82C25E58CCF00862533 /* RunnerUITests */ = {
172219
isa = PBXNativeTarget;
173220
buildConfigurationList = 686BE83625E58CCF00862533 /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
@@ -216,6 +263,10 @@
216263
LastUpgradeCheck = 1100;
217264
ORGANIZATIONNAME = "The Flutter Authors";
218265
TargetAttributes = {
266+
33E20B3126EFCDFC00A4A191 = {
267+
CreatedOnToolsVersion = 12.5;
268+
TestTargetID = 97C146ED1CF9000F007C117D;
269+
};
219270
686BE82C25E58CCF00862533 = {
220271
CreatedOnToolsVersion = 12.4;
221272
ProvisioningStyle = Automatic;
@@ -241,11 +292,19 @@
241292
targets = (
242293
97C146ED1CF9000F007C117D /* Runner */,
243294
686BE82C25E58CCF00862533 /* RunnerUITests */,
295+
33E20B3126EFCDFC00A4A191 /* RunnerTests */,
244296
);
245297
};
246298
/* End PBXProject section */
247299

248300
/* Begin PBXResourcesBuildPhase section */
301+
33E20B3026EFCDFC00A4A191 /* Resources */ = {
302+
isa = PBXResourcesBuildPhase;
303+
buildActionMask = 2147483647;
304+
files = (
305+
);
306+
runOnlyForDeploymentPostprocessing = 0;
307+
};
249308
686BE82B25E58CCF00862533 /* Resources */ = {
250309
isa = PBXResourcesBuildPhase;
251310
buildActionMask = 2147483647;
@@ -316,6 +375,14 @@
316375
/* End PBXShellScriptBuildPhase section */
317376

318377
/* Begin PBXSourcesBuildPhase section */
378+
33E20B2E26EFCDFC00A4A191 /* Sources */ = {
379+
isa = PBXSourcesBuildPhase;
380+
buildActionMask = 2147483647;
381+
files = (
382+
33E20B3526EFCDFC00A4A191 /* RunnerTests.m in Sources */,
383+
);
384+
runOnlyForDeploymentPostprocessing = 0;
385+
};
319386
686BE82925E58CCF00862533 /* Sources */ = {
320387
isa = PBXSourcesBuildPhase;
321388
buildActionMask = 2147483647;
@@ -337,6 +404,11 @@
337404
/* End PBXSourcesBuildPhase section */
338405

339406
/* Begin PBXTargetDependency section */
407+
33E20B3826EFCDFC00A4A191 /* PBXTargetDependency */ = {
408+
isa = PBXTargetDependency;
409+
target = 97C146ED1CF9000F007C117D /* Runner */;
410+
targetProxy = 33E20B3726EFCDFC00A4A191 /* PBXContainerItemProxy */;
411+
};
340412
686BE83325E58CCF00862533 /* PBXTargetDependency */ = {
341413
isa = PBXTargetDependency;
342414
target = 97C146ED1CF9000F007C117D /* Runner */;
@@ -364,6 +436,30 @@
364436
/* End PBXVariantGroup section */
365437

366438
/* Begin XCBuildConfiguration section */
439+
33E20B3926EFCDFC00A4A191 /* Debug */ = {
440+
isa = XCBuildConfiguration;
441+
buildSettings = {
442+
BUNDLE_LOADER = "$(TEST_HOST)";
443+
INFOPLIST_FILE = RunnerTests/Info.plist;
444+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
445+
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
446+
PRODUCT_NAME = "$(TARGET_NAME)";
447+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
448+
};
449+
name = Debug;
450+
};
451+
33E20B3A26EFCDFC00A4A191 /* Release */ = {
452+
isa = XCBuildConfiguration;
453+
buildSettings = {
454+
BUNDLE_LOADER = "$(TEST_HOST)";
455+
INFOPLIST_FILE = RunnerTests/Info.plist;
456+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
457+
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
458+
PRODUCT_NAME = "$(TARGET_NAME)";
459+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
460+
};
461+
name = Release;
462+
};
367463
686BE83425E58CCF00862533 /* Debug */ = {
368464
isa = XCBuildConfiguration;
369465
buildSettings = {
@@ -560,6 +656,15 @@
560656
/* End XCBuildConfiguration section */
561657

562658
/* Begin XCConfigurationList section */
659+
33E20B3B26EFCDFC00A4A191 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
660+
isa = XCConfigurationList;
661+
buildConfigurations = (
662+
33E20B3926EFCDFC00A4A191 /* Debug */,
663+
33E20B3A26EFCDFC00A4A191 /* Release */,
664+
);
665+
defaultConfigurationIsVisible = 0;
666+
defaultConfigurationName = Release;
667+
};
563668
686BE83625E58CCF00862533 /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
564669
isa = XCConfigurationList;
565670
buildConfigurations = (

packages/quick_actions/quick_actions/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
ReferencedContainer = "container:Runner.xcodeproj">
4848
</BuildableReference>
4949
</TestableReference>
50+
<TestableReference
51+
skipped = "NO">
52+
<BuildableReference
53+
BuildableIdentifier = "primary"
54+
BlueprintIdentifier = "33E20B3126EFCDFC00A4A191"
55+
BuildableName = "RunnerTests.xctest"
56+
BlueprintName = "RunnerTests"
57+
ReferencedContainer = "container:Runner.xcodeproj">
58+
</BuildableReference>
59+
</TestableReference>
5060
</Testables>
5161
</TestAction>
5262
<LaunchAction
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@import quick_actions;
6+
@import XCTest;
7+
8+
@interface QuickActionsTests : XCTestCase
9+
@end
10+
11+
@implementation QuickActionsTests
12+
13+
- (void)testPlugin {
14+
FLTQuickActionsPlugin* plugin = [[FLTQuickActionsPlugin alloc] init];
15+
XCTAssertNotNil(plugin);
16+
}
17+
18+
@end

packages/share/example/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
target 'RunnerTests' do
33+
inherit! :search_paths
34+
end
3235
end
3336

3437
post_install do |installer|

0 commit comments

Comments
 (0)