Browse Source

Copy src/$(PROJECT).appup to ebin/ on build if any

Loïc Hoguin 5 years ago
parent
commit
b6b3111b33
2 changed files with 28 additions and 0 deletions
  1. 3 0
      core/erlc.mk
  2. 25 0
      test/core_app.mk

+ 3 - 0
core/erlc.mk

@@ -331,6 +331,9 @@ else
 		| sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(subst /,\/,$(GITDESCRIBE))\"}/" \
 		> ebin/$(PROJECT).app
 endif
+ifneq ($(wildcard src/$(PROJECT).appup),)
+	$(verbose) cp src/$(PROJECT).appup ebin/
+endif
 
 clean:: clean-app
 

+ 25 - 0
test/core_app.mk

@@ -27,6 +27,31 @@ core-app-appsrc-change: init
 	$t rm $(APP)/EXPECT
 endif
 
+core-app-appup: 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 "Generate a .appup file"
+	$t touch $(APP)/src/$(APP).appup
+
+	$i "Build the application"
+	$t $(MAKE) -C $(APP) $v
+
+	$i "Check that the appup file was copied into ebin/"
+	$t test -f $(APP)/ebin/$(APP).appup
+
+	$i "Clean the application"
+	$t $(MAKE) -C $(APP) clean $v
+
+	$i "Check that the source file still exists"
+	$t test -f $(APP)/src/$(APP).appup
+
+	$i "Check that the file copied into ebin/ was removed"
+	$t test ! -e $(APP)/ebin/$(APP).appup
+
 core-app-asn1: init
 
 	$i "Bootstrap a new OTP library named $(APP)"