Skip to content

UsePlugin.isDevDependency to influence .flutter-plugins-dependencies #157948

@matanlurey

Description

@matanlurey

This issue is predicated on #157462 landing first.


In #157462, we added the field Plugin { bool isDevDependency }, which describes whether a plugin was resolved explicitly because it came from an application's pubspec.yaml in dev_dependencies (with additional checks to make sure that the dependency is not used in a non-dev fashion elsewhere in the transitive dependencies, see compute_dev_dependencies_test.dart).

This was a good first step to excluding dev-only plugins from release applications, however we need to go a step further and now serialized (and save) that property to .flutter-plugins-dependencies, so that tools (such as the Flutter Android Gradle plugin, and other tools such as the iOS/macOS flutter_tools extensions) can read that file, and conditionally exclude dev-only plugins.

Here is a rough example of .flutter-plugins-dependencies today:

{
    "plugins": {
      "android": [
        {
          "name": "plugin-a",
          "path": "/path/to/plugin-a",
          "dependencies": ["plugin-b", "plugin-c"],
          "native_build": true
        },
        {
          "name": "plugin-b",
          "path": "/path/to/plugin-b",
          "dependencies": ["plugin-c"],
          "native_build": true
        },
        {
          "name": "plugin-c",
          "path": "/path/to/plugin-c",
          "dependencies": [],
          "native_build": true
        },
      ],
    },
    "dependencyGraph": [
      {
        "name": "plugin-a",
        "dependencies": ["plugin-b","plugin-c"]
      },
      {
        "name": "plugin-b",
        "dependencies": ["plugin-c"]
       },
      {
        "name": "plugin-c",
        "dependencies": []
      }
    ]
}

I imagine we'd make slight alternations to this file, i.e.:

{
    "plugins": {
      "android": [
        {
          "name": "plugin-a",
          "path": "/path/to/plugin-a",
          "dependencies": ["plugin-b", "plugin-c"],
          "native_build": true,
+        "dev_dependency" true
        },
        {
          "name": "plugin-b",
          "path": "/path/to/plugin-b",
          "dependencies": ["plugin-c"],
          "native_build": true,
+        "dev_dependency" true
        },
        {
          "name": "plugin-c",
          "path": "/path/to/plugin-c",
          "dependencies": [],
          "native_build": true,
+        "dev_dependency" false
        },
      ],
    },
    "dependencyGraph": [
      {
        "name": "plugin-a",
        "dependencies": ["plugin-b","plugin-c"]
      },
      {
        "name": "plugin-b",
        "dependencies": ["plugin-c"]
       },
      {
        "name": "plugin-c",
        "dependencies": []
      }
    ]
}

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions