Skip to content

Commit

Permalink
[make] separate dune build @runtest from dune build @fmt
Browse files Browse the repository at this point in the history
Summary:
It was annoying that `make runtest` would also run `dune build fmt`:
- the second step runs over all files, which is slow
- it made it hard to debug the `dune build runtest` step in isolation
  because the dune logs would get overwritten by the second run
- it made the Makefile more complex

Reviewed By: martintrojer

Differential Revision: D32170178

fbshipit-source-id: fef7cecbf
  • Loading branch information
jvillard authored and facebook-github-bot committed Nov 4, 2021
1 parent 09a1012 commit ee499cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions infer/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ endif
.PHONY: src_build_common
src_build_common: $(SRC_BUILD_COMMON)

# NOTE: the complexity below is because @runtest and @fmt interact poorly: we want dune to format
# test files *after* having promoted them when the test outputs change
.PHONY: runtest
runtest: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST)
$(QUIET)exit_code=0; \
$(DUNE_BUILD) @runtest --auto-promote || exit_code=$$?; \
$(DUNE_BUILD) @fmt --auto-promote || exit_code=$$?; \
exit $$exit_code
$(DUNE_BUILD) @runtest --auto-promote

# we want dune to format test files *after* having promoted them
.PHONY: runtest_formatted
runtest_formatted: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST) runtest
$(DUNE_BUILD) @fmt --auto-promote

.PHONY: test
test: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST) runtest
test: $(SRC_BUILD_COMMON) $(MAKEFILE_LIST) runtest_formatted
$(DUNE_BUILD) \
$(patsubst %.exe, %.bc.exe, $(INFER_CONFIG_TARGETS)) \
scripts/$(CHECKCOPYRIGHT_MAIN).bc.exe $(INFERUNIT_MAIN).bc.exe $(INFERTOP_MAIN).bc.exe
Expand Down

0 comments on commit ee499cf

Please sign in to comment.