@@ -16,6 +16,7 @@ import 'test_utils.dart';
1616void main () {
1717 group ('iOS app validation' , () {
1818 String flutterRoot;
19+ Directory pluginRoot;
1920 String projectRoot;
2021 String flutterBin;
2122 Directory tempDir;
@@ -29,18 +30,20 @@ void main() {
2930 'flutter' ,
3031 );
3132
33+ // Test a plugin example app to allow plugins validation.
3234 processManager.runSync (< String > [
3335 flutterBin,
3436 ...getLocalEngineArguments (),
3537 'create' ,
3638 '--verbose' ,
3739 '--platforms=ios' ,
38- '-i ' ,
39- 'objc ' ,
40+ '-t ' ,
41+ 'plugin ' ,
4042 'hello' ,
4143 ], workingDirectory: tempDir.path);
4244
43- projectRoot = tempDir.childDirectory ('hello' ).path;
45+ pluginRoot = tempDir.childDirectory ('hello' );
46+ projectRoot = pluginRoot.childDirectory ('example' ).path;
4447 });
4548
4649 tearDownAll (() {
@@ -56,6 +59,7 @@ void main() {
5659 File outputFlutterFrameworkBinary;
5760 Directory outputAppFramework;
5861 File outputAppFrameworkBinary;
62+ File outputPluginFrameworkBinary;
5963
6064 setUpAll (() {
6165 processManager.runSync (< String > [
@@ -85,11 +89,13 @@ void main() {
8589
8690 outputAppFramework = frameworkDirectory.childDirectory ('App.framework' );
8791 outputAppFrameworkBinary = outputAppFramework.childFile ('App' );
92+
93+ outputPluginFrameworkBinary = frameworkDirectory.childDirectory ('hello.framework' ).childFile ('hello' );
8894 });
8995
9096 testWithoutContext ('flutter build ios builds a valid app' , () {
91- // Should only contain Flutter.framework and App.framework.
92- expect (frameworkDirectory. listSync ().length, 2 );
97+ expect (outputPluginFrameworkBinary, exists);
98+
9399 expect (outputAppFrameworkBinary, exists);
94100 expect (outputAppFramework.childFile ('Info.plist' ), exists);
95101
@@ -202,17 +208,61 @@ void main() {
202208 }, skip: ! platform.isMacOS || buildMode != BuildMode .release); // [intended] only makes sense on macos.
203209
204210 testWithoutContext ('validate obfuscation' , () {
205- final ProcessResult grepResult = processManager.runSync (< String > [
211+ // HelloPlugin class is present in project.
212+ ProcessResult grepResult = processManager.runSync (< String > [
213+ 'grep' ,
214+ '-r' ,
215+ 'HelloPlugin' ,
216+ pluginRoot.path,
217+ ]);
218+ // Matches exits 0.
219+ expect (grepResult.exitCode, 0 );
220+
221+ // Not present in binary.
222+ grepResult = processManager.runSync (< String > [
206223 'grep' ,
207- '-i' ,
208- 'hello' ,
224+ 'HelloPlugin' ,
209225 outputAppFrameworkBinary.path,
210226 ]);
211- expect (grepResult.stdout, isNot (contains ('matches' )));
227+ // Does not match exits 1.
228+ expect (grepResult.exitCode, 1 );
212229 });
213230 });
214231 }
215232
233+ testWithoutContext ('builds all plugin architectures for simulator' , () {
234+ final ProcessResult buildSimulator = processManager.runSync (
235+ < String > [
236+ flutterBin,
237+ ...getLocalEngineArguments (),
238+ 'build' ,
239+ 'ios' ,
240+ '--simulator' ,
241+ '--verbose' ,
242+ '--no-codesign' ,
243+ ],
244+ workingDirectory: projectRoot,
245+ );
246+ expect (buildSimulator.exitCode, 0 );
247+
248+ final File pluginFrameworkBinary = fileSystem.file (fileSystem.path.join (
249+ projectRoot,
250+ 'build' ,
251+ 'ios' ,
252+ 'iphonesimulator' ,
253+ 'Runner.app' ,
254+ 'Frameworks' ,
255+ 'hello.framework' ,
256+ 'hello' ,
257+ ));
258+ expect (pluginFrameworkBinary, exists);
259+ final ProcessResult archs = processManager.runSync (
260+ < String > ['file' , pluginFrameworkBinary.path],
261+ );
262+ expect (archs.stdout, contains ('Mach-O 64-bit dynamically linked shared library x86_64' ));
263+ expect (archs.stdout, contains ('Mach-O 64-bit dynamically linked shared library arm64' ));
264+ });
265+
216266 testWithoutContext ('build for simulator with all available architectures' , () {
217267 final ProcessResult buildSimulator = processManager.runSync (
218268 < String > [
@@ -250,6 +300,6 @@ void main() {
250300 expect (archs.stdout, contains ('Mach-O 64-bit dynamically linked shared library arm64' ));
251301 });
252302 }, skip: ! platform.isMacOS, // [intended] only makes sense for macos platform.
253- timeout: const Timeout (Duration (minutes: 5 ))
303+ timeout: const Timeout (Duration (minutes: 7 ))
254304 );
255305}
0 commit comments