mason icon indicating copy to clipboard operation
mason copied to clipboard

fix: Hook build/compile doesn't verify dependency changes

Open mrgnhnt96 opened this issue 1 year ago • 2 comments

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

  1. Create a brick
  2. Add some local package (via path) to the pubspec.yaml's dependencies
  3. Add a pre_gen hook which uses the local package
  4. Add/Install brick globally i. Notice that building {brick}... prints to console
  5. Update any local dependency's file
  6. Add/Install brick globally i. Notice that build/compile does not print to console and appears to be skipped
  7. 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 👍

mrgnhnt96 avatar Jun 08 '23 21:06 mrgnhnt96