Skip to content

Support for git submodules #2807

Open
Open
@olof-dev

Description

@olof-dev

Use case

I'm using the git: functionality of pubspec.yaml to depend on a package distributed via a git repository. That repository consists of a Flutter plugin that uses native code, with the native code placed in the plugin's ios directory. This native code is itself a library, coming from external sources, and the natural way of doing version control seems to be to include it as a git submodule in the plugin's repository.

Being a submodule, its code doesn't get automatically pulled in when the plugin repository is cloned, meaning that the plugin pulled in by pub doesn't include the native library. Would it be possible to offer the option for pub to recursively pull in submodules?

Changes needed

The relevant command is probably

git clone --recurse-submodules

Perhaps one can offer syntax like

dependencies:
  my_package:
    git:
      url: https://github.com/username/repo_name.git
      recurse-submodules: true

Workarounds

One can of course move the submodule to another location and copy the files across to the plugin directory, but this is far from ideal. I'm not sure if there's a better method. Iirc git doesn't like symlinks.

Edit: I just discovered git subtrees. I think they can also be used as a workaround, though they seem a lot less convenient than submodules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions