Snapcraft with flutter plugin: source code section is related to version section?

Hi there!

I have setup my project snapcraft.yaml to use the “git” value at version section.

name: my_app
version: git  

Inside parts section, I have set the git repo (instead of using . ; as I found some issues for this option).

parts:
  my_app:
    source: https://github.com/andreclinio/my_app.git
    plugin: flutter
    build-snaps: [ yq ]
    flutter-target: lib/main.dart # The main entry-point file of the application

However, I am confused about the source code that will be used. When the ‘source’ is set to https://github.com/andreclinio/my_app.git, the source code (used for building) will be pulled based on the git describe of my local directory?

PS.: I have tried to use

parts:
  my_app:
    source: .
    plugin: flutter
    build-snaps: [ yq ]
    flutter-target: lib/main.dart # The main entry-point file of the application

to guarantee that source code will be always the content of the local directory. Would this be the best approach?

Regards,

– André

If the source is a git repository the local directory content is not used (but you can set a specific tag, branch or commit using the appropriate part properties such as source-tag, source-branch or source-commit). Using source as a local directory makes sense when snap packaging is integrated into the main application (as opposed to being in a separate repository, in which case the source points to the upstream application repository).

1 Like