leanflutter / flutter_distributor

An all-in-one Flutter application packaging and distribution tool, providing you with a one-stop solution to meet various distribution needs.
https://distributor.leanflutter.dev/
MIT License
812 stars 114 forks source link

How to use flutter_distributor with fvm package? #107

Closed Wizzel1 closed 1 year ago

Wizzel1 commented 1 year ago

I tried to run flutter_distributor package --platform windows --targets exe but it failed because I have no global flutter version installed. Instead I am using FVM to manage my SDK installations. How can I alter the SDK location for flutter_distributor?

cybrox commented 1 year ago

I have not personally worked with FVM, but if I understand this correctly, the issue is that flutter_distributor attempts to run multiple commands using the flutter command but this does not work on your system, since FVM does not register it but you instead use fvm flutter ... in everyday use, right?

Currently, I don't think flutter_distributor offers a way to change the command it is using. A few possible solutions that come to mind are:

  1. FVM - like most other version management systems - most likely installs the different versions of Flutter it uses in a cache directory. Get the path to the flutter version you want to use and add it to your path temporarily in the shell you're working (e.g. set PATH=%PATH%;C:\path\to\chachedir\flutter-3.0\bin)
  2. You might be able to use Powershell aliases on Windows to alias flutter to fvm flutter ... but I'm afraid I don't know much about powershell.

Ideally, we'd add a possiblity to change the main Flutter command to flutter_distributor but these are some workarounds you could explore in the meantime.

Wizzel1 commented 1 year ago

I have not personally worked with FVM, but if I understand this correctly, the issue is that flutter_distributor attempts to run > multiple commands using the flutter command but this does not work on your system, since FVM does not register it but you instead use fvm flutter ... in everyday use, right?

Yes, that is correct.

I will try your recommended workarounds, thanks for the quick response!

Wizzel1 commented 1 year ago

Just wanted to check if there are any updates on this

lijy91 commented 1 year ago

Please see this commit https://github.com/leanflutter/flutter_distributor/commit/8b8acf02324d499e6b190d28835932edc7633c05 , Will be able to specify flutter version for any job. By the way, even the required variable for publisher can be defined into the job.

output: dist/
variables:
  FLUTTER_ROOT: ~/fvm/versions/3.10.0
releases:
  - variables:
      FLUTTER_ROOT: ~/fvm/versions/3.10.1
    name: dev-release
    jobs:
      - name: android-aab
        variables:
          FLUTTER_ROOT: ~/fvm/versions/3.10.2
        package:
          platform: android
          target: aab
          build_args:
            target-platform: android-arm,android-arm64
Wizzel1 commented 1 year ago

Thats great, so I will close this. Thanks

lijy91 commented 1 year ago

@Wizzel1 Please update to 0.3.4