Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2019-12-03 13:53:29 -0500
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-02-24 14:56:28 -0500
commit0acc21f16f098b2784b1382b82816889d694f91a (patch)
tree3910ff74a85e1b70bbcf83818d233f8caecf7214 /tamer/configure.ac
parente1076ce3880f5533cad311543f551a50be58c53e (diff)
downloadtame-0acc21f16f098b2784b1382b82816889d694f91a.tar.gz
tame-0acc21f16f098b2784b1382b82816889d694f91a.tar.bz2
tame-0acc21f16f098b2784b1382b82816889d694f91a.zip
Makefile.am (check): Check whether formatting is required
Given that developers should be doing TDD and therefore running this target frequently, this has the effect of providing immediate feedback when formatting is needed and outputting a diff. Developers will then quickly understand what changes need to be made to avoid future issues (and can run `cargo fmt` to fix it), at which point they'll rarely ever encounter formatting errors. The original purpose was to ensure pipelines fail when the formatter has not been run.
Diffstat (limited to 'tamer/configure.ac')
-rw-r--r--tamer/configure.ac9
1 files changed, 9 insertions, 0 deletions
diff --git a/tamer/configure.ac b/tamer/configure.ac
index 9ed3526..350b77b 100644
--- a/tamer/configure.ac
+++ b/tamer/configure.ac
@@ -55,6 +55,15 @@ AX_COMPARE_VERSION([$rustc_version], [ge], [$rustc_ver_req],
AC_ARG_VAR([CARGO_BUILD_FLAGS],
[Flags to be passed to `cargo build' when invoked via Make])
+# Cargo commands may be available but not necessarily installed for the
+# active toolchain. Let's check that.
+AC_MSG_CHECKING([whether cargo-fmt is available for active toolchain])
+AS_IF([cargo fmt --help &>/dev/null],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ cargo fmt --help # run again so user can see output
+ AC_MSG_ERROR([missing cargo-fmt for active toolchain])])
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT