mason
mason copied to clipboard
fix: Hook build/compile doesn't verify dependency changes
Description
I have a local package "shared_hook_methods" that I have added to my pubspec.yaml's dependencies within the hooks
directory. I noticed that when I modify any file within said package then re-install the brick it doesn't try to re-build/compile the hooks/build
directory. Which results in the changes made in the said package not reflected during the mason make {brick}
command.
I am sure that this is due to checking for changes within the pre_gen.dart
file, when no changes are found, then skip the build/compile.
In conjunction to file changes, are we checking for any dependency changes? Perhaps we leverage the pubspec.lock
file and check for any version changes? We could also introduce a new flag to force a new build/compile of the build
directory that can be passed into the mason add
command.
Steps To Reproduce
- Create a brick
- Add some local package (via path) to the pubspec.yaml's dependencies
- Add a pre_gen hook which uses the local package
- Add/Install brick globally
i. Notice that
building {brick}...
prints to console - Update any local dependency's file
- Add/Install brick globally i. Notice that build/compile does not print to console and appears to be skipped
- Use brick and notice that the change performed in local package is not reflected
Expected Behavior
I'd expect the brick to be recompiled with the changes performed in a dependency
Additional Context
Like I mentioned above, perhaps it would be useful to add a -b
, --force-build
flag to force a rebuild/compile of the hooks
For some code reference, check out this brick. Its not a minimal reproducible code example, so let me know if you need me to do that 👍