diff options
author | Loïc Hoguin <[email protected]> | 2025-06-19 16:19:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-06-19 16:19:34 +0200 |
commit | ce2a1ba5ed37586dacbf1def01f23a9f550767e1 (patch) | |
tree | 3fed4908c67d588e2202d0e11d9c3e2ea9398d39 | |
parent | e13b4c71d764cc92a1e5a92f5f2dd1c1f59b4a3c (diff) | |
download | erlang.mk-ce2a1ba5ed37586dacbf1def01f23a9f550767e1.tar.gz erlang.mk-ce2a1ba5ed37586dacbf1def01f23a9f550767e1.tar.bz2 erlang.mk-ce2a1ba5ed37586dacbf1def01f23a9f550767e1.zip |
Fix Mix autopatch being enabled by default
By default Erlang projects should not have Elixir enabled.
-rw-r--r-- | core/deps.mk | 8 | ||||
-rw-r--r-- | core/elixir.mk | 6 | ||||
-rw-r--r-- | test/core_elixir.mk | 35 |
3 files changed, 40 insertions, 9 deletions
diff --git a/core/deps.mk b/core/deps.mk index 8b158b7..da7f7c4 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -142,6 +142,14 @@ export ERL_LIBS export NO_AUTOPATCH +# Elixir. + +# Elixir is automatically enabled in all cases except when +# an Erlang project uses an Elixir dependency. In that case +# $(ELIXIR) must be set explicitly. +ELIXIR ?= $(if $(filter elixir,$(BUILD_DEPS) $(DEPS)),dep,$(if $(EX_FILES),system,disable)) +export ELIXIR + # Verbosity. dep_verbose_0 = @echo " DEP $1 ($(call query_version,$1))"; diff --git a/core/elixir.mk b/core/elixir.mk index eb5c487..cd62e78 100644 --- a/core/elixir.mk +++ b/core/elixir.mk @@ -2,12 +2,6 @@ # Copyright (c) 2024, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. -# Elixir is automatically enabled in all cases except when -# an Erlang project uses an Elixir dependency. In that case -# $(ELIXIR) must be set explicitly. -ELIXIR ?= $(if $(filter elixir,$(BUILD_DEPS) $(DEPS)),dep,$(if $(EX_FILES),system,disable)) -export ELIXIR - ifeq ($(ELIXIR),system) # We expect 'elixir' to be on the path. ELIXIR_BIN ?= $(shell readlink -f `which elixir`) diff --git a/test/core_elixir.mk b/test/core_elixir.mk index 6a6997b..c2cec70 100644 --- a/test/core_elixir.mk +++ b/test/core_elixir.mk @@ -117,6 +117,22 @@ core-elixir-disable-autopatch-fail: init $i "Building the application should fail" $t ! $(MAKE) -C $(APP) $v +core-elixir-disable-autopatch-erlang-mk: init + + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Add Jose to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = jose\ndep_jose = git https://github.com/potatosalad/erlang-jose main\n"}' $(APP)/Makefile + + $i "Disable Elixir in the Makefile" + $t perl -ni.bak -e 'print;if ($$.==1) {print "ELIXIR = disable\n"}' $(APP)/Makefile + + $i "Building the application should work as Jose is Erlang.mk-compatible" + $t $(MAKE) -C $(APP) $v + core-elixir-disable-autopatch-make: init $i "Bootstrap a new OTP library named $(APP)" @@ -145,13 +161,26 @@ core-elixir-disable-autopatch-rebar3: init $t cp ../erlang.mk $(APP)/ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v - $i "Add Jose to the list of dependencies" - $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = jose\ndep_jose = git https://github.com/potatosalad/erlang-jose main\n"}' $(APP)/Makefile + $i "Add OpenTelemetry_API to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = opentelemetry_api\ndep_opentelemetry_api = hex 1.3.0\n"}' $(APP)/Makefile $i "Disable Elixir in the Makefile" $t perl -ni.bak -e 'print;if ($$.==1) {print "ELIXIR = disable\n"}' $(APP)/Makefile - $i "Building the application should work as Jose is Rebar3-compatible" + $i "Building the application should work as OpenTelemetry_API is Rebar3-compatible" + $t $(MAKE) -C $(APP) $v + +core-elixir-disable-by-default-autopatch-rebar3: init + + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Add OpenTelemetry_API to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = opentelemetry_api\ndep_opentelemetry_api = hex 1.3.0\n"}' $(APP)/Makefile + + $i "Building the application should work as OpenTelemetry_API is Rebar3-compatible" $t $(MAKE) -C $(APP) $v core-elixir-from-dep: init |