@@ -77,11 +77,6 @@ class PluginTest {
7777 final _FlutterProject app = await _FlutterProject .create (tempDir, options, buildTarget,
7878 name: 'plugintestapp' , template: 'app' , environment: appCreateEnvironment);
7979 try {
80- if (cocoapodsTransitiveFlutterDependency) {
81- section ('Disable Swift Package Manager' );
82- await app.disableSwiftPackageManager ();
83- }
84-
8580 section ('Add plugins' );
8681 await app.addPlugin ('plugintest' ,
8782 pluginPath: path.join ('..' , 'plugintest' ));
@@ -152,20 +147,6 @@ class _FlutterProject {
152147 return _FlutterProject (Directory (path.join (rootPath)), 'example' );
153148 }
154149
155- Future <void > disableSwiftPackageManager () async {
156- final File pubspec = pubspecFile;
157- String content = await pubspec.readAsString ();
158- content = content.replaceFirst (
159- '# The following section is specific to Flutter packages.\n '
160- 'flutter:\n ' ,
161- '# The following section is specific to Flutter packages.\n '
162- 'flutter:\n '
163- '\n '
164- ' disable-swift-package-manager: true\n '
165- );
166- await pubspec.writeAsString (content, flush: true );
167- }
168-
169150 Future <void > addPlugin (String plugin, {String ? pluginPath}) async {
170151 final File pubspec = pubspecFile;
171152 String content = await pubspec.readAsString ();
@@ -263,14 +244,9 @@ class $dartPluginClass {
263244 await podspec.writeAsString (podspecContent, flush: true );
264245
265246 // Make PlugintestPlugin.swift compile on iOS and macOS with target conditionals.
266- // If SwiftPM is disabled, the file will be in `darwin/Classes/`.
267- // Otherwise, the file will be in `darwin/<plugin>/Sources/<plugin>/`.
268247 final String pluginClass = '${name [0 ].toUpperCase ()}${name .substring (1 )}Plugin' ;
269248 print ('pluginClass: $pluginClass ' );
270- File pluginRegister = File (path.join (darwinDir.path, 'Classes' , '$pluginClass .swift' ));
271- if (! pluginRegister.existsSync ()) {
272- pluginRegister = File (path.join (darwinDir.path, name, 'Sources' , name, '$pluginClass .swift' ));
273- }
249+ final File pluginRegister = File (path.join (darwinDir.path, 'Classes' , '$pluginClass .swift' ));
274250 final String pluginRegisterContent = '''
275251#if os(macOS)
276252import FlutterMacOS
@@ -518,55 +494,42 @@ s.dependency 'AppAuth', '1.6.0'
518494 }
519495
520496 if (validateNativeBuildProject) {
521- final File generatedSwiftManifest = File (path.join (
522- rootPath,
523- target,
524- 'Flutter' ,
525- 'ephemeral' ,
526- 'Packages' ,
527- 'FlutterGeneratedPluginSwiftPackage' ,
528- 'Package.swift'
529- ));
530- final bool swiftPackageManagerEnabled = generatedSwiftManifest.existsSync ();
531-
532- if (! swiftPackageManagerEnabled) {
533- final File podsProject = File (path.join (rootPath, target, 'Pods' , 'Pods.xcodeproj' , 'project.pbxproj' ));
534- if (! podsProject.existsSync ()) {
535- throw TaskResult .failure ('Xcode Pods project file missing at ${podsProject .path }' );
536- }
497+ final File podsProject = File (path.join (rootPath, target, 'Pods' , 'Pods.xcodeproj' , 'project.pbxproj' ));
498+ if (! podsProject.existsSync ()) {
499+ throw TaskResult .failure ('Xcode Pods project file missing at ${podsProject .path }' );
500+ }
537501
538- final String podsProjectContent = podsProject.readAsStringSync ();
539- if (target == 'ios' ) {
540- // Plugins with versions lower than the app version should not have IPHONEOS_DEPLOYMENT_TARGET set.
541- // The plugintest plugin target should not have IPHONEOS_DEPLOYMENT_TARGET set since it has been lowered
542- // in _reduceDarwinPluginMinimumVersion to 10, which is below the target version of 11.
543- if (podsProjectContent.contains ('IPHONEOS_DEPLOYMENT_TARGET = 10' )) {
544- throw TaskResult .failure ('Plugin build setting IPHONEOS_DEPLOYMENT_TARGET not removed' );
545- }
546- // Transitive dependency AppAuth targeting too-low 8.0 was not fixed.
547- if (podsProjectContent.contains ('IPHONEOS_DEPLOYMENT_TARGET = 8' )) {
548- throw TaskResult .failure ('Transitive dependency build setting IPHONEOS_DEPLOYMENT_TARGET=8 not removed' );
549- }
550- if (! podsProjectContent.contains (r'"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited) i386";' )) {
551- throw TaskResult .failure (r'EXCLUDED_ARCHS is not "$(inherited) i386"' );
552- }
553- } else if (target == 'macos' ) {
554- // Same for macOS deployment target, but 10.8.
555- // The plugintest target should not have MACOSX_DEPLOYMENT_TARGET set.
556- if (podsProjectContent.contains ('MACOSX_DEPLOYMENT_TARGET = 10.8' )) {
557- throw TaskResult .failure ('Plugin build setting MACOSX_DEPLOYMENT_TARGET not removed' );
558- }
559- // Transitive dependency AppAuth targeting too-low 10.9 was not fixed.
560- if (podsProjectContent.contains ('MACOSX_DEPLOYMENT_TARGET = 10.9' )) {
561- throw TaskResult .failure ('Transitive dependency build setting MACOSX_DEPLOYMENT_TARGET=10.9 not removed' );
562- }
502+ final String podsProjectContent = podsProject.readAsStringSync ();
503+ if (target == 'ios' ) {
504+ // Plugins with versions lower than the app version should not have IPHONEOS_DEPLOYMENT_TARGET set.
505+ // The plugintest plugin target should not have IPHONEOS_DEPLOYMENT_TARGET set since it has been lowered
506+ // in _reduceDarwinPluginMinimumVersion to 10, which is below the target version of 11.
507+ if (podsProjectContent.contains ('IPHONEOS_DEPLOYMENT_TARGET = 10' )) {
508+ throw TaskResult .failure ('Plugin build setting IPHONEOS_DEPLOYMENT_TARGET not removed' );
509+ }
510+ // Transitive dependency AppAuth targeting too-low 8.0 was not fixed.
511+ if (podsProjectContent.contains ('IPHONEOS_DEPLOYMENT_TARGET = 8' )) {
512+ throw TaskResult .failure ('Transitive dependency build setting IPHONEOS_DEPLOYMENT_TARGET=8 not removed' );
563513 }
514+ if (! podsProjectContent.contains (r'"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited) i386";' )) {
515+ throw TaskResult .failure (r'EXCLUDED_ARCHS is not "$(inherited) i386"' );
516+ }
517+ } else if (target == 'macos' ) {
518+ // Same for macOS deployment target, but 10.8.
519+ // The plugintest target should not have MACOSX_DEPLOYMENT_TARGET set.
520+ if (podsProjectContent.contains ('MACOSX_DEPLOYMENT_TARGET = 10.8' )) {
521+ throw TaskResult .failure ('Plugin build setting MACOSX_DEPLOYMENT_TARGET not removed' );
522+ }
523+ // Transitive dependency AppAuth targeting too-low 10.9 was not fixed.
524+ if (podsProjectContent.contains ('MACOSX_DEPLOYMENT_TARGET = 10.9' )) {
525+ throw TaskResult .failure ('Transitive dependency build setting MACOSX_DEPLOYMENT_TARGET=10.9 not removed' );
526+ }
527+ }
564528
565- if (localEngine != null ) {
566- final RegExp localEngineSearchPath = RegExp ('FRAMEWORK_SEARCH_PATHS\\ s*=[^;]*${localEngine .path }' );
567- if (! localEngineSearchPath.hasMatch (podsProjectContent)) {
568- throw TaskResult .failure ('FRAMEWORK_SEARCH_PATHS does not contain the --local-engine path' );
569- }
529+ if (localEngine != null ) {
530+ final RegExp localEngineSearchPath = RegExp ('FRAMEWORK_SEARCH_PATHS\\ s*=[^;]*${localEngine .path }' );
531+ if (! localEngineSearchPath.hasMatch (podsProjectContent)) {
532+ throw TaskResult .failure ('FRAMEWORK_SEARCH_PATHS does not contain the --local-engine path' );
570533 }
571534 }
572535 }
0 commit comments