Skip to content

Flags --explicit-package-dependencies and --enable-swift-package-manager collide #163272

@matanlurey

Description

@matanlurey

You can reproduce this in the swift_package_manager_test.dart integration test.

First, opt-in to --explicit-package-dependencies:

flutter config --explicit-package-dependencies

Then, run the integration test. All of the tests fail, so just picking one is quite a bit faster to iterate on:

$ cd packages/tools
$ dart test test/integration.shard/swift_package_manager_test.dart -n "Swift Package Manager integration for ios with objc"

...

  stderr: 
  [  +15 ms] Parse Issue (Xcode): Module 'ios_objc_cocoapods_plugin' not found
             /var/folders/qw/qw_3qd1x4kz5w975jhdq4k58007b7h/T/swift_package_manager_enabled.1xqwz9/ios_objc_spm_app/ios/Runner/GeneratedPluginRegistrant.m:17:8

GeneratedPluginRegistrant.m looks like this:

//
//  Generated file. Do not edit.
//

// clang-format off

#import "GeneratedPluginRegistrant.h"

#if __has_include(<integration_test/IntegrationTestPlugin.h>)
#import <integration_test/IntegrationTestPlugin.h>
#else
@import integration_test;
#endif

#if __has_include(<ios_objc_cocoapods_plugin/IosObjcCocoapodsPlugin.h>)
#import <ios_objc_cocoapods_plugin/IosObjcCocoapodsPlugin.h>
#else
@import ios_objc_cocoapods_plugin;
#endif

@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
  [IntegrationTestPlugin registerWithRegistrar:[registry registrarForPlugin:@"IntegrationTestPlugin"]];
  [IosObjcCocoapodsPlugin registerWithRegistrar:[registry registrarForPlugin:@"IosObjcCocoapodsPlugin"]];
}

@end

In the test project, there are no dev-only dependencies:

# pubspec.yaml

dependencies:
  ios_objc_cocoapods_plugin:
    path: /var/folders/qw/qw_3qd1x4kz5w975jhdq4k58007b7h/T/swift_package_manager_enabled.1xqwz9/ios_objc_cocoapods_plugin
  integration_test:
    path: /Users/matanl/Developer/flutter/packages/integration_test

And indeed, none of them are detected as dev:

# .flutter-plugins-dependencies

{
  "info": "This is a generated file; do not edit or check into version control.",
  "plugins": {
    "ios": [
      {
        "name": "integration_test",
        "path": "/Users/matanl/Developer/flutter/packages/integration_test/",
        "native_build": true,
        "dependencies": [],
        "dev_dependency": false
      },
      {
        "name": "ios_objc_cocoapods_plugin",
        "path": "/var/folders/qw/qw_3qd1x4kz5w975jhdq4k58007b7h/T/swift_package_manager_enabled.1xqwz9/ios_objc_cocoapods_plugin/",
        "native_build": true,
        "dependencies": [],
        "dev_dependency": false
      }
    ],
    "android": [
      {
        "name": "integration_test",
        "path": "/Users/matanl/Developer/flutter/packages/integration_test/",
        "native_build": true,
        "dependencies": [],
        "dev_dependency": false
      }
    ],
    "macos": [],
    "linux": [],
    "windows": [],
    "web": []
  },
  "dependencyGraph": [
    {
      "name": "integration_test",
      "dependencies": []
    },
    {
      "name": "ios_objc_cocoapods_plugin",
      "dependencies": []
    }
  ],
  "date_created": "2025-02-13 16:08:11.766458",
  "version": "3.30.0-1.0.pre.163",
  "swift_package_manager_enabled": {
    "ios": true,
    "macos": false
  }
}

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is nowfyi-iosFor the attention of iOS platform teamteam-toolOwned by Flutter Tool team

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions