mono_repo.dart
mono_repo.dart copied to clipboard
Override commands from the root mono_repo.yaml
Add the ability to override a command on a specific subfolder in the mono_repo.yaml
Potentially we'd have
// mono_repo.yaml
pkg_a:
published: true
pkg_b:
published: true
packages_get: flutter pakages get
packages_update: flutter packages upgrade
Do we want to support overriding commands like this, or would it be better to just bake support for flutter into the mono_repo tool?
I.e., if your pubspec specified the flutter sdk, then we would always run flutter packages get
instead of pub get
I think we should have both. This issue is more about customizing.
Who knows, maybe you want a project to specify some custom arguments such as
--[no-]packages-dir
The fact that it helps with flutter support is just a side-effect
Pull requests welcome!
I'm trying to address this issue, in the way suggested by @alorenzen. In the pub
method in tool/ci.sh
I now check (grep) for sdk: flutter
and if so, call flutter
instead of pub
.
This does of course require the user to install flutter, which I'm currently doing in a before_script
in my mono_repo.yaml
config.
I'll open a pull request for this asap.
@BenVercammen Could you share a full example of how you are currently using mono_repo with flutter?
That would be very helpful, 😁
@BenVercammen Could you share a full example of how you are currently using mono_repo with flutter?
So, my set up is nothing special:
- /dart_package_1
- mono_pkg.yaml
- /dart_package_2
- mono_pkg.yaml
- /flutter_package
- mono_pkg.yaml
- /mono_repo.yaml
In the root folder of my project, I use the default mono_repo commands:
-
mono_repo pub get
for dependencies -
mono_repo generate
to generate travis/CI script
There's really nothing special to it, I guess...
I do have a "trick" in order to make this work on Travis CI, in the before_script
in my mono_repo.yaml file:
self_validate: analyzer_and_format
travis:
branches:
- master
- develop
before_script:
- git clone https://github.com/flutter/flutter.git ${TRAVIS_HOME}/flutter-sdk -b master
- export FLUTTER_SDK="${TRAVIS_HOME}/flutter-sdk"
- export PATH="$FLUTTER_SDK/bin:$PATH"
- export NO_PROXY=localhost,127.0.0.1
- flutter doctor
after_failure:
- tool/report_failure.sh
merge_stages:
- analyzer_and_format
- ensure_build
- unit_test
This script is taking care of setting up flutter on Travis CI before running the other scripts. Otherwise, my fix to call flutter pub get
in stead of pub get
will fail because flutter is not present.
I guess there is still some work to do if you also want to run flutter (integration) tests on Travis CI. However, for now this is enough for me. I'll probably also switch to codemagic in a while, as it is supposed to have better (out of the box?) support for testing and deploying flutter apps.
Hope this helps...
PS: of course, you'll need to have the latest release installed (4.0.0) for this to work.
I see, thanks a lot :D
I am using github actions, so I do not have the option to define a before_script
. not sure if there is an equivalent.
Besides that the Github Actions generated, execute:
run: pub upgrade --no-precompile
which fails ofc for my flutter app.
It should probably execute mono_repo pub
instead.
Seems that is not happening in travis.