hey24sheep / azure-flutter-tasks

Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
https://marketplace.visualstudio.com/items?itemName=Hey24sheep.flutter
MIT License
89 stars 22 forks source link

Error Did not find the file passed to "--dart-define-from-file" on extraArgs #125

Open diegolmauro opened 2 months ago

diegolmauro commented 2 months ago

Hi.

I'm fallowing the instructions of the answered of this issue: https://github.com/hey24sheep/azure-flutter-tasks/issues/84, and I'm trying to use --dart-define-from-file by passing it to extraArgs, but I always get the error Did not find the file passed to "--dart-define-from-file". I've tried several patterns, such as "/configs/dev.json", "$(Build.SourcesDirectory)/configs/dev.json" and "configs/dev.json". Can you please help me with this?

hey24sheep commented 2 months ago

Hi, I will check and see what can be done. I am busy with work and life, give me some time and I will push a fix ASAP

hey24sheep commented 2 months ago

Hi @diegolmauro, I have updated the version from 0.3.18 to 0.4.0 to denote major changes (this fixes #124).

If previous version of this extension is needed then you download it from releases

For a week I will leave the extension as is on the latest update to validate everything is working fine with the updated node & packages. Next week, I will try my best to push a fix for this (I do not have access to Flutter/Azure project anymore so most of my fixes are blind, so bear with me here)

Thanks

hey24sheep commented 2 months ago

Can you try one thing, - check this https://stackoverflow.com/questions/77445120/flutter-dart-define-from-file-is-not-working

and try extraArgs as

diegolmauro commented 2 months ago

Hi @hey24sheep, thank you for the quick response.

Here’s the structure of my project’s path:

main folder
   |_ configs
       |_ dev.json
   |_ lib
       |_ main.dart

I've tried all the suggested patterns and using both ../configs/dev.json and ~/configs/dev.json patterns, but none of them work when running from the FlutterBuild task. However, when I run the flutter build command directly from a bash script, everything works fine with the configs/dev.json pattern.

If I move the configs folder into the lib folder, it works.

Thanks. Best regards.

hey24sheep commented 2 months ago

Can you try move config to lib folder and try with the build task, does that work?

Actually, it should work with extraArgs. I'm wondering why it isn't working

diegolmauro commented 2 months ago

Yes, moving the configs folder to the lib directory works perfectly with the build task. However, running the flutter build command directly works fine even with the original folder structure.

main folder
   |_ configs
       |_ dev.json
   |_ lib
       |_ main.dart
hey24sheep commented 2 months ago

Okay, I'm sorry but I'm a little confused now. Is it working now with extraArgs? With the current build task? Because I don't want to add one more configuration option if it's working.

diegolmauro commented 2 months ago

The build task only works when I move the configs folder to the lib folder. If I keep my original folder structure, it doesn't work.

What I'm trying to explain is that when using the flutter build command directly in a script (instead of the build task), it works in both cases, even when the configs folder is kept in the root directory.

But don't worry about it, I'll move the configs folder to the lib directory—it's not a problem. Thank you so much for your time.

hey24sheep commented 2 months ago

Ohh, I got it now. So, then if I add one more option it could be a shot in the dark. It might work or won't. I could try and add during the weekend but I'm pretty sure it won't work because that argument will be passed the same way as extraArgs is processing it right now.