There are almost no behavioral changes. Because `dart test` runs with assertions, and the former command does not, I had to tweak some of the engine tool tests because they would assert that there were duplicate names - but I didn't change any actual code besides the test expectations themselves/the fixtures. This is not all of the engine, but is approximately 1/3 of all imports of `package:litetest` migrated.
Git Hooks
The behavior of git commands can be customized through the use of "hooks".
These hooks are described in detail in git's
documentation.
git looks for an executables by name in the directory specified by
the core.hooksPath git config setting. The script setup.py here points
core.hooksPath at this directory. It runs during a gclient sync or a
gclient runhooks.
The hooks here are implemented in Dart by the program with
entrypoint bin/main.dart in this directory. The commands of the program
are the implementation of the different hooks, for example
bin/main.dart pre-push .... Since the Dart program itself isn't an executable,
these commands are invoked by small Python wrapper scripts. These wrapper
scripts have the names that git will look for.
pre-push
This hooks runs when pushing commits to a remote branch, for example to
create or update a pull request: git push origin my-local-branch.
The pre-push hook runs ci/clang_tidy.sh, ci/pylint.sh and ci/format.sh.
ci/analyze.sh and ci/licenses.sh are more expensive and are not run.
Adding new pre-push checks
Since the pre-push checks run on every git push, they should run quickly.
New checks can be added by modifying the run() method of the PrePushCommand
class in lib/src/pre_push_command.dart.
Creating a new hook
- Check the
gitdocumentation, and copypre-pushinto a script with the right name. - Make sure the script has the executable bit set
(
chmod +x <script>). - Add a new
Commandimplementation underlib/src. Give the newCommandthe same name as the new hook. - Add the new
Commandto theCommandRunnerinlib/githooks.dart. - Make sure the script from step (1) is passing the new command to the Dart program.