This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Massively improve Makefile performance
Instead of running all the commands all the time, we conditionally define rules based on the dev's machine and the files that need to be committed.
- Loading branch information
1 parent
2d02c0b
commit 6b13fb1
Showing
2 changed files
with
57 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e # grep failure does not trigger exit. | ||
make check_format | ||
|
||
dry=0 # Set to 1 to enable dry run. | ||
|
||
function check_rs() { | ||
if (( dry == 0 )); then | ||
make check_rust_format | ||
else | ||
echo "check_rs ran" | ||
fi | ||
} | ||
|
||
function check_ts() { | ||
if (( dry == 0 )); then | ||
make check_ts_format | ||
else | ||
echo "check_ts ran" | ||
fi | ||
} | ||
|
||
function check_cargo_toml() { | ||
if (( dry == 0 )); then | ||
make check_toml_format | ||
else | ||
echo "check_cargo_toml ran" | ||
fi | ||
} | ||
|
||
git status --untracked-files=no --short | grep -E '.rs$' > /dev/null 2>&1 && check_rs | ||
git status --untracked-files=no --short | grep -E '.ts$|.json$|.yml$' > /dev/null 2>&1 && check_ts | ||
git status --untracked-files=no --short | grep -E '.toml$' > /dev/null 2>&1 && check_cargo_toml | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters