From 467ac3aec41dcf0c7f33127f50f10815b8aa605f Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 24 Aug 2024 16:17:44 +0200 Subject: [PATCH] build: don't clean obj.target directory if it doesn't exist This can happen to ninja builds, which would then throw an error instead of being a noop if the command is executed. PR-URL: https://github.com/nodejs/node/pull/54337 Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Chengzhong Wu --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 381ab741b21f29..1e8516644858df 100644 --- a/Makefile +++ b/Makefile @@ -241,8 +241,10 @@ coverage-clean: $(RM) -r node_modules $(RM) -r gcovr $(RM) -r coverage/tmp - $(FIND) out/$(BUILDTYPE)/obj.target \( -name "*.gcda" -o -name "*.gcno" \) \ - -type f -exec $(RM) {} \; + @if [ -d "out/Release/obj.target" ]; then \ + $(FIND) out/$(BUILDTYPE)/obj.target \( -name "*.gcda" -o -name "*.gcno" \) \ + -type f -exec $(RM) {};\ + fi .PHONY: coverage # Build and test with code coverage reporting. HTML coverage reports will be @@ -266,7 +268,9 @@ coverage-build-js: .PHONY: coverage-test coverage-test: coverage-build - $(FIND) out/$(BUILDTYPE)/obj.target -name "*.gcda" -type f -exec $(RM) {} \; + @if [ -d "out/Release/obj.target" ]; then \ + $(FIND) out/$(BUILDTYPE)/obj.target -name "*.gcda" -type f -exec $(RM) {}; \ + fi -NODE_V8_COVERAGE=coverage/tmp \ TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS) $(MAKE) coverage-report-js