diff --git a/CHANGELOG.md b/CHANGELOG.md index d8aba1bf3c74d4edb1ebb4cc3d4dab0b27d4bf9d..9ffdd30d01f53082e73e0ecdea1e7243ff9fe1b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed duplicated entries from generated `.dep` files * Removed `dev` targets from modules that function in "local source mode" * Fixed issue where `.hpp` files were not installed correctly with `KEEP_HEADER_SUBDIRS` +* Missing `REQUIRED` dependencies now cause the build to fail instead of providing a warning ### Other changes * Removed `<module>_TEMPLATES` in favour of `<module>_DB` diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile index fb6bd69030b9aef426ca0fdfe055ef9f90886bfc..0052e94aeac922beece2f73e8ea441c7f0fb81f1 100644 --- a/require-ess/tools/driver.makefile +++ b/require-ess/tools/driver.makefile @@ -925,7 +925,7 @@ ${DEPFILE}: ${LIBOBJS} $(USERMAKEFILE) # Check dependencies on other module headers. cat *.d 2>/dev/null | sed 's/ /\n/g' | grep -v '$(EPICS_BASE)/include' | sed -n '$(DEP_PARSER)' >> $@.tmp # Manully added dependencies: ${REQ} - @$(foreach m,${REQ},echo "$m $(or $(call FETCH_BUILD_NUMBER,$(E3_SITEMODS_PATH),$m),$(and $(wildcard ${E3_SITEMODS_PATH}/$m),$(error REQUIRED module $m has no numbered version. Set $m_VERSION)),$(warning REQUIRED module $m not found for ${T_A}.))" >> $@.tmp;) + @$(foreach m,${REQ},echo "$m $(or $(and $(wildcard $(E3_SITEMODS_PATH)/$m/$($m_VERSION)),$($m_VERSION)),$(error REQUIRED module '$m' version '$($m_VERSION)' does not exist))" >> $@.tmp;) cat $@.tmp | sort -u >> $@ endif # In O.* directory diff --git a/tests/test_build.py b/tests/test_build.py index cab6b2dfece42af1f79c3caa2551716d970fb8ed..477f02c6c3defd01180301be8312697cb1e6c917 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -102,3 +102,12 @@ def test_missing_source_file(wrapper): RE_MISSING_FILE.format(filename=re.escape("nonexistent.o")), errs.decode("utf-8"), ) + + +def test_missing_requirement(wrapper): + with open(wrapper / f"{TEST_MODULE_NAME}.Makefile", "a") as f: + f.write("REQUIRED += foo") + + rc, _, errs = run_make(wrapper, "build") + assert rc == 2 + assert "REQUIRED module 'foo' version '' does not exist" in errs.decode("utf-8")