Browse Source

fixup! Upgrade to Relx 4 which is now used as a library

Loïc Hoguin 3 years ago
parent
commit
6f9ee4c520
4 changed files with 28 additions and 46 deletions
  1. 20 22
      CHANGELOG.asciidoc
  2. 0 19
      plugins/relx.mk
  3. 5 5
      test/core_deps.mk
  4. 3 0
      test/plugin_bootstrap.mk

+ 20 - 22
CHANGELOG.asciidoc

@@ -1,25 +1,3 @@
-2018/12/03: Relx has been updated to v3.27.0.
-
-2018/12/03: Dependencies are no longer always rebuilt by
-            default. Please check the documentation for
-            information. A quick fix if this causes an
-            issue is to add `FULL = 1` at the top of your
-            Makefile.
-
-2018/12/06: Change the default COVER_DATA_DIR to be the
-            same as COVER_REPORT_DIR.
-
-2019/06/20: `list-deps` now includes local applications
-            found in the `APPS_DIR` directory.
-
-2020/03/25: The `-lerl_interface` argument has been removed
-            from the default `LDLIBS`. This is an old library
-            that is getting removed in OTP-23 and should no
-            longer be used. Note that the default still includes
-            `-lei` which is part of the Erlang/OTP Erl_Interface
-            *application* but is built as a separate C library.
-            The removal only applies to `-lerl_interface` itself.
-
 2020/06/18: Concuerror integration has been added. It is
 2020/06/18: Concuerror integration has been added. It is
             currently minimal but usable. Experimentation
             currently minimal but usable. Experimentation
             and feedback is welcome.
             and feedback is welcome.
@@ -27,3 +5,23 @@
 2020/11/30: Support for publishing Hex releases and docs
 2020/11/30: Support for publishing Hex releases and docs
             has been added. It is currently experimental.
             has been added. It is currently experimental.
             Feedback is more than welcome.
             Feedback is more than welcome.
+
+2022/03/25: The -Wrace_conditions Dialyzer flag was removed
+            as it is no longer available starting from OTP 25.
+
+2022/??/??: Relx has been updated to v4. Relx v4 is no longer
+            an escript, therefore breaking changes were
+            introduced. The `RELX`, `RELX_URL` and `RELX_OPTS`
+            variables were removed. The `relx` project must
+            be added as a `DEPS`, `BUILD_DEPS` or `REL_DEPS`
+            dependency to enable building releases. For example:
+            `REL_DEPS = relx`. Relx itself has had some
+            additional changes: the `start` command has
+            been replaced by `daemon`, and configuration
+            defaults have changed so that you may need
+            to add the following to your relx.config file:
+
+            ``` erlang
+            {dev_mode, false}.
+            {include_erts, true}.
+            ```

+ 0 - 19
plugins/relx.mk

@@ -6,11 +6,8 @@ ifeq ($(filter relx,$(BUILD_DEPS) $(DEPS) $(REL_DEPS)),relx)
 
 
 # Configuration.
 # Configuration.
 
 
-#RELX ?= $(ERLANG_MK_TMP)/relx
 RELX_CONFIG ?= $(CURDIR)/relx.config
 RELX_CONFIG ?= $(CURDIR)/relx.config
 
 
-#RELX_URL ?= https://erlang.mk/res/relx-v3.27.0-22
-#RELX_OPTS ?=
 RELX_OUTPUT_DIR ?= _rel
 RELX_OUTPUT_DIR ?= _rel
 RELX_REL_EXT ?=
 RELX_REL_EXT ?=
 RELX_TAR ?= 1
 RELX_TAR ?= 1
@@ -19,12 +16,6 @@ ifdef SFX
 	RELX_TAR = 1
 	RELX_TAR = 1
 endif
 endif
 
 
-#ifeq ($(firstword $(RELX_OPTS)),-o)
-#	RELX_OUTPUT_DIR = $(word 2,$(RELX_OPTS))
-#else
-#	RELX_OPTS += -o $(RELX_OUTPUT_DIR)
-#endif
-
 # Core targets.
 # Core targets.
 
 
 ifeq ($(IS_DEP),)
 ifeq ($(IS_DEP),)
@@ -39,10 +30,6 @@ distclean:: distclean-relx-rel
 
 
 # Plugin-specific targets.
 # Plugin-specific targets.
 
 
-#$(RELX): | $(ERLANG_MK_TMP)
-#	$(gen_verbose) $(call core_http_get,$(RELX),$(RELX_URL))
-#	$(verbose) chmod +x $(RELX)
-
 define relx_release.erl
 define relx_release.erl
 	{ok, Config} = file:consult("$(call core_native_path,$(RELX_CONFIG))"),
 	{ok, Config} = file:consult("$(call core_native_path,$(RELX_CONFIG))"),
 	{release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config),
 	{release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config),
@@ -78,26 +65,20 @@ define relx_relup.erl
 		{semver, _} -> "";
 		{semver, _} -> "";
 		VsnStr -> Vsn0
 		VsnStr -> Vsn0
 	end,
 	end,
-	io:format("~p~n~n", [Vsn]),
 	{ok, _} = relx:build_relup(Name, Vsn, undefined, Config ++ [{output_dir, "$(RELX_OUTPUT_DIR)"}]),
 	{ok, _} = relx:build_relup(Name, Vsn, undefined, Config ++ [{output_dir, "$(RELX_OUTPUT_DIR)"}]),
 	halt(0).
 	halt(0).
 endef
 endef
 
 
 relx-rel: rel-deps app
 relx-rel: rel-deps app
-#	$(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) release
 	$(call erlang,$(call relx_release.erl),-pa ebin/)
 	$(call erlang,$(call relx_release.erl),-pa ebin/)
 	$(verbose) $(MAKE) relx-post-rel
 	$(verbose) $(MAKE) relx-post-rel
 ifeq ($(RELX_TAR),1)
 ifeq ($(RELX_TAR),1)
-#	$(verbose) touch $(RELX_OUTPUT_DIR)/$(PROJECT)_release/releases/RELEASES
-#	$(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) tar
 	$(call erlang,$(call relx_tar.erl),-pa ebin/)
 	$(call erlang,$(call relx_tar.erl),-pa ebin/)
 endif
 endif
 
 
 relx-relup: rel-deps app
 relx-relup: rel-deps app
-#	$(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) release
 	$(call erlang,$(call relx_release.erl),-pa ebin/)
 	$(call erlang,$(call relx_release.erl),-pa ebin/)
 	$(MAKE) relx-post-rel
 	$(MAKE) relx-post-rel
-#	$(verbose) $(RELX) $(if $(filter 1,$V),-V 3) -c $(RELX_CONFIG) $(RELX_OPTS) relup $(if $(filter 1,$(RELX_TAR)),tar)
 	$(call erlang,$(call relx_relup.erl),-pa ebin/)
 	$(call erlang,$(call relx_relup.erl),-pa ebin/)
 ifeq ($(RELX_TAR),1)
 ifeq ($(RELX_TAR),1)
 	$(call erlang,$(call relx_tar.erl),-pa ebin/)
 	$(call erlang,$(call relx_tar.erl),-pa ebin/)

+ 5 - 5
test/core_deps.mk

@@ -1260,8 +1260,8 @@ core-deps-rel: init
 	$t cp ../erlang.mk $(APP)/
 	$t cp ../erlang.mk $(APP)/
 	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
 	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
 
 
-	$i "Add Recon to the list of release dependencies"
-	$t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
+	$i "Add Relx and Recon to the list of release dependencies"
+	$t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = relx recon\n"}' $(APP)/Makefile
 
 
 	$i "Add Recon to the relx.config file"
 	$i "Add Recon to the relx.config file"
 	$t $(ERL) -eval " \
 	$t $(ERL) -eval " \
@@ -1302,17 +1302,17 @@ core-deps-rel: init
 ifeq ($(PLATFORM),msys2)
 ifeq ($(PLATFORM),msys2)
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
-#	$t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
+#	$t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpc \
 #		application loaded_applications | grep recon`"
 #		application loaded_applications | grep recon`"
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
 #	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
 else
 else
 	$i "Start the release and check that Recon is loaded"
 	$i "Start the release and check that Recon is loaded"
-	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
+	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release daemon $v
 	$t apps="Node is not running!"; \
 	$t apps="Node is not running!"; \
 		while test "$$apps" = "Node is not running!"; do \
 		while test "$$apps" = "Node is not running!"; do \
 			apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
 			apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
-			rpcterms \ application loaded_applications); \
+			rpc application loaded_applications); \
 		done; \
 		done; \
 		echo "$$apps" | grep -q recon
 		echo "$$apps" | grep -q recon
 	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
 	$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v

+ 3 - 0
test/plugin_bootstrap.mk

@@ -201,6 +201,9 @@ bootstrap-rel: init
 	$t cp ../erlang.mk $(APP)/
 	$t cp ../erlang.mk $(APP)/
 	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap bootstrap-rel $v
 	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap bootstrap-rel $v
 
 
+	$i "Add Relx to the list of release dependencies"
+	$t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = relx\n"}' $(APP)/Makefile
+
 	$i "Check that all bootstrapped files exist"
 	$i "Check that all bootstrapped files exist"
 	$t test -f $(APP)/Makefile
 	$t test -f $(APP)/Makefile
 	$t test -f $(APP)/relx.config
 	$t test -f $(APP)/relx.config