0

I have an flutter based application consisting of serveral "apps" that share some common source code. I tried to setup a snapcraft file for my application, but I can't figure out is make snap build a subdirectory.

This is an example layout that I have

appa/lib/main.dart
appb/lib/main.dart
packages/foundation

This is an example snapcraft file I have

parts:
  appa:
    source: .
    source-type: local
    plugin: flutter
    flutter-target: lib/main.dart # The main entry-point file of the application
    build-snaps: [ yq ]
    override-build: |
      cd appa
      snapcraftctl build
      snapcraftctl set-version "$(yq r pubspec.yaml version)"

In the above code I am sharing the the root directory . because otherwise I get an error that flutter cannot get ../packages/. When I build with the root directory I get an error that the working directory isn't a project root and flutter pub get fails.

Most examples I'm able to find online have a easier setup so haven't had any luck deriving a solution for this on my own. I am quite new snapcraft in general and terminology is a bit confusing to me. Would appreciate if somebody can point me in the right direction?

Lawrence Kok
  • 1,568
  • 11
  • 29

0 Answers0