aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/core.mk6
-rw-r--r--core/deps.mk51
-rw-r--r--core/erlc.mk4
-rw-r--r--plugins/bootstrap.mk72
-rw-r--r--plugins/dialyzer.mk2
-rw-r--r--test/Makefile46
-rw-r--r--test/core_app.mk44
-rw-r--r--test/core_compat.mk21
-rw-r--r--test/core_deps.mk554
-rw-r--r--test/core_plugins.mk12
-rw-r--r--test/core_upgrade.mk9
11 files changed, 612 insertions, 209 deletions
diff --git a/core/core.mk b/core/core.mk
index a9cb808..407b940 100644
--- a/core/core.mk
+++ b/core/core.mk
@@ -174,13 +174,15 @@ endif
core_eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
-core_find = $(if $(wildcard $1),$(shell find $1 -type f -name $(subst *,\*,$2)))
+core_find = $(if $(wildcard $1),$(shell find $(1:%/=%) -type f -name $(subst *,\*,$2)))
core_lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1)))))))))))))))))))))))))))
-# @todo On Windows: $(shell dir /B $(1)); make sure to handle when no file exists.
core_ls = $(filter-out $(1),$(shell echo $(1)))
+# @todo Use a solution that does not require using perl.
+core_relpath = $(shell perl -e 'use File::Spec; print File::Spec->abs2rel(@ARGV) . "\n"' $1 $2)
+
# Automated update.
ERLANG_MK_REPO ?= https://github.com/ninenines/erlang.mk
diff --git a/core/deps.mk b/core/deps.mk
index 814e7db..00cc05f 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -1,26 +1,34 @@
# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
-.PHONY: distclean-deps distclean-pkg
+.PHONY: distclean-deps
# Configuration.
+ifdef OTP_DEPS
+$(warning The variable OTP_DEPS is deprecated in favor of LOCAL_DEPS.)
+endif
+
IGNORE_DEPS ?=
export IGNORE_DEPS
+APPS_DIR ?= $(CURDIR)/apps
+export APPS_DIR
+
DEPS_DIR ?= $(CURDIR)/deps
export DEPS_DIR
REBAR_DEPS_DIR = $(DEPS_DIR)
export REBAR_DEPS_DIR
+ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d)))
ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)))
-ifeq ($(filter $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
+ifeq ($(filter $(APPS_DIR) $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
ifeq ($(ERL_LIBS),)
- ERL_LIBS = $(DEPS_DIR)
+ ERL_LIBS = $(APPS_DIR):$(DEPS_DIR)
else
- ERL_LIBS := $(ERL_LIBS):$(DEPS_DIR)
+ ERL_LIBS := $(ERL_LIBS):$(APPS_DIR):$(DEPS_DIR)
endif
endif
export ERL_LIBS
@@ -36,6 +44,11 @@ ifneq ($(SKIP_DEPS),)
deps::
else
deps:: $(ALL_DEPS_DIRS)
+ifndef IS_APP
+ $(verbose) for dep in $(ALL_APPS_DIRS) ; do \
+ $(MAKE) -C $$dep IS_APP=1 || exit $$?; \
+ done
+endif
ifneq ($(IS_DEP),1)
$(verbose) rm -f $(ERLANG_MK_TMP)/deps.log
endif
@@ -48,15 +61,13 @@ endif
if [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ]; then \
$(MAKE) -C $$dep IS_DEP=1 || exit $$?; \
else \
- echo "ERROR: No Makefile to build dependency $$dep."; \
- exit 1; \
+ echo "Error: No Makefile to build dependency $$dep."; \
+ exit 2; \
fi \
fi \
done
endif
-distclean:: distclean-deps distclean-pkg
-
# Deps related targets.
# @todo rename GNUmakefile and makefile into Makefile first, if they exist
@@ -510,7 +521,7 @@ define dep_fetch_hex
endef
define dep_fetch_fail
- echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \
+ echo "Error: Unknown or invalid dependency: $(1)." >&2; \
exit 78;
endef
@@ -538,6 +549,10 @@ dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word
define dep_target
$(DEPS_DIR)/$(1):
+ $(verbose) if test -d $(APPS_DIR)/$1; then \
+ echo "Error: Dependency $1 conflicts with application found in $(APPS_DIR)/$1."; \
+ exit 17; \
+ fi
$(verbose) mkdir -p $(DEPS_DIR)
$(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$(1))),$(1))
$(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
@@ -572,6 +587,24 @@ endef
$(foreach dep,$(BUILD_DEPS) $(DEPS),$(eval $(call dep_target,$(dep))))
+ifndef IS_APP
+clean:: clean-apps
+
+clean-apps:
+ $(verbose) for dep in $(ALL_APPS_DIRS) ; do \
+ $(MAKE) -C $$dep clean IS_APP=1 || exit $$?; \
+ done
+
+distclean:: distclean-apps
+
+distclean-apps:
+ $(verbose) for dep in $(ALL_APPS_DIRS) ; do \
+ $(MAKE) -C $$dep distclean IS_APP=1 || exit $$?; \
+ done
+endif
+
+distclean:: distclean-deps
+
distclean-deps:
$(gen_verbose) rm -rf $(DEPS_DIR)
diff --git a/core/erlc.mk b/core/erlc.mk
index b215374..2cc0e77 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -60,7 +60,7 @@ define app_file
{id$(comma)$(space)"$(1)"}$(comma))
{modules, [$(call comma_list,$(2))]},
{registered, []},
- {applications, [$(call comma_list,kernel stdlib $(OTP_DEPS) $(DEPS))]}
+ {applications, [$(call comma_list,kernel stdlib $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS))]}
]}.
endef
else
@@ -71,7 +71,7 @@ define app_file
{id$(comma)$(space)"$(1)"}$(comma))
{modules, [$(call comma_list,$(2))]},
{registered, [$(call comma_list,$(PROJECT)_sup $(PROJECT_REGISTERED))]},
- {applications, [$(call comma_list,kernel stdlib $(OTP_DEPS) $(DEPS))]},
+ {applications, [$(call comma_list,kernel stdlib $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS))]},
{mod, {$(PROJECT)_app, []}}
]}.
endef
diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk
index 44f10ea..019e697 100644
--- a/plugins/bootstrap.mk
+++ b/plugins/bootstrap.mk
@@ -11,13 +11,16 @@ help::
" bootstrap Generate a skeleton of an OTP application" \
" bootstrap-lib Generate a skeleton of an OTP library" \
" bootstrap-rel Generate the files needed to build a release" \
+ " new-app n=NAME Create a new local OTP application NAME" \
+ " new-lib n=NAME Create a new local OTP library NAME" \
" new t=TPL n=NAME Generate a module NAME based on the template TPL" \
+ " new t=T n=N in=APP Generate a module NAME based on the template TPL in APP" \
" list-templates List available templates"
# Bootstrap templates.
define bs_appsrc
-{application, $(PROJECT), [
+{application, $p, [
{description, ""},
{vsn, "0.1.0"},
{id, "git"},
@@ -27,13 +30,13 @@ define bs_appsrc
kernel,
stdlib
]},
- {mod, {$(PROJECT)_app, []}},
+ {mod, {$p_app, []}},
{env, []}
]}.
endef
define bs_appsrc_lib
-{application, $(PROJECT), [
+{application, $p, [
{description, ""},
{vsn, "0.1.0"},
{id, "git"},
@@ -48,7 +51,7 @@ endef
ifdef SP
define bs_Makefile
-PROJECT = $(PROJECT)
+PROJECT = $p
PROJECT_DESCRIPTION = New project
PROJECT_VERSION = 0.0.1
@@ -59,27 +62,32 @@ include erlang.mk
endef
else
define bs_Makefile
-PROJECT = $(PROJECT)
+PROJECT = $p
include erlang.mk
endef
endif
+define bs_apps_Makefile
+PROJECT = $p
+include $(call core_relpath,$(dir $(ERLANG_MK_FILENAME)),$(APPS_DIR)/app)/erlang.mk
+endef
+
define bs_app
--module($(PROJECT)_app).
+-module($p_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
start(_Type, _Args) ->
- $(PROJECT)_sup:start_link().
+ $p_sup:start_link().
stop(_State) ->
ok.
endef
define bs_relx_config
-{release, {$(PROJECT)_release, "1"}, [$(PROJECT)]}.
+{release, {$p_release, "1"}, [$p]}.
{extended_start_script, true}.
{sys_config, "rel/sys.config"}.
{vm_args, "rel/vm.args"}.
@@ -91,8 +99,8 @@ define bs_sys_config
endef
define bs_vm_args
--name $(PROJECT)@127.0.0.1
--setcookie $(PROJECT)
+-setcookie $p
-heart
endef
@@ -355,19 +363,21 @@ bootstrap:
ifneq ($(wildcard src/),)
$(error Error: src/ directory already exists)
endif
+ $(eval p := $(PROJECT))
+ $(eval n := $(PROJECT)_sup)
$(call render_template,bs_Makefile,Makefile)
$(verbose) mkdir src/
ifdef LEGACY
$(call render_template,bs_appsrc,src/$(PROJECT).app.src)
endif
$(call render_template,bs_app,src/$(PROJECT)_app.erl)
- $(eval n := $(PROJECT)_sup)
$(call render_template,tpl_supervisor,src/$(PROJECT)_sup.erl)
bootstrap-lib:
ifneq ($(wildcard src/),)
$(error Error: src/ directory already exists)
endif
+ $(eval p := $(PROJECT))
$(call render_template,bs_Makefile,Makefile)
$(verbose) mkdir src/
ifdef LEGACY
@@ -381,25 +391,61 @@ endif
ifneq ($(wildcard rel/),)
$(error Error: rel/ directory already exists)
endif
+ $(eval p := $(PROJECT))
$(call render_template,bs_relx_config,relx.config)
$(verbose) mkdir rel/
$(call render_template,bs_sys_config,rel/sys.config)
$(call render_template,bs_vm_args,rel/vm.args)
+new-app:
+ifndef in
+ $(error Usage: $(MAKE) new-app in=APP)
+endif
+ifneq ($(wildcard $(APPS_DIR)/$in),)
+ $(error Error: Application $in already exists)
+endif
+ $(eval p := $(in))
+ $(eval n := $(in)_sup)
+ $(verbose) mkdir -p $(APPS_DIR)/$p/src/
+ $(call render_template,bs_apps_Makefile,$(APPS_DIR)/$p/Makefile)
+ifdef LEGACY
+ $(call render_template,bs_appsrc,$(APPS_DIR)/$p/src/$p.app.src)
+endif
+ $(call render_template,bs_app,$(APPS_DIR)/$p/src/$p_app.erl)
+ $(call render_template,tpl_supervisor,$(APPS_DIR)/$p/src/$p_sup.erl)
+
+new-lib:
+ifndef in
+ $(error Usage: $(MAKE) new-lib in=APP)
+endif
+ifneq ($(wildcard $(APPS_DIR)/$in),)
+ $(error Error: Application $in already exists)
+endif
+ $(eval p := $(in))
+ $(verbose) mkdir -p $(APPS_DIR)/$p/src/
+ $(call render_template,bs_apps_Makefile,$(APPS_DIR)/$p/Makefile)
+ifdef LEGACY
+ $(call render_template,bs_appsrc_lib,$(APPS_DIR)/$p/src/$p.app.src)
+endif
+
new:
ifeq ($(wildcard src/),)
$(error Error: src/ directory does not exist)
endif
ifndef t
- $(error Usage: $(MAKE) new t=TEMPLATE n=NAME)
+ $(error Usage: $(MAKE) new t=TEMPLATE n=NAME [in=APP])
endif
ifndef tpl_$(t)
$(error Unknown template)
endif
ifndef n
- $(error Usage: $(MAKE) new t=TEMPLATE n=NAME)
+ $(error Usage: $(MAKE) new t=TEMPLATE n=NAME [in=APP])
endif
+ifdef in
+ $(verbose) $(MAKE) -C $(APPS_DIR)/$(in)/ new t=$t n=$n in=
+else
$(call render_template,tpl_$(t),src/$(n).erl)
+endif
list-templates:
$(verbose) echo Available templates: $(sort $(patsubst tpl_%,%,$(filter tpl_%,$(.VARIABLES))))
diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk
index ddced75..709b43f 100644
--- a/plugins/dialyzer.mk
+++ b/plugins/dialyzer.mk
@@ -28,7 +28,7 @@ help::
# Plugin-specific targets.
$(DIALYZER_PLT): deps app
- $(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(ALL_DEPS_DIRS)
+ $(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS)
plt: $(DIALYZER_PLT)
diff --git a/test/Makefile b/test/Makefile
index ba612fa..20b2328 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,6 +2,14 @@
# Copyright (c) 2014, Viktor Söderqvist <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
+# ZSH users have a more modern shell which doesn't need to
+# have the same safeguards as other shells. To use ZSH instead
+# of the default shell, set ZSH=1.
+
+ifdef ZSH
+SHELL := $(shell which zsh)
+endif
+
# Temporary application name, taken from rule name.
APP = $(subst -,_,$@)
@@ -11,12 +19,36 @@ APP_TO_CLEAN = $(subst -,_,$(patsubst clean-%,%,$@))
ERL = erl +A0 -noinput -boot start_clean
-# Platform, condensed version.
+# Platform detection, condensed version.
-ifeq ($(shell uname -o),Msys)
- PLATFORM = msys2
+UNAME_S := $(shell uname -s)
+
+ifeq ($(UNAME_S),Darwin)
+PLATFORM = darwin
+else ifeq ($(UNAME_S),FreeBSD)
+PLATFORM = freebsd
+else ifeq ($(shell uname -o),Msys)
+PLATFORM = msys2
else
- PLATFORM = unix
+PLATFORM = unix
+endif
+
+# Some systems do not have sub-second file times resolution.
+# This is the case for older systems like OSX that uses the HFS+
+# file system. HFS+ has a 1 second time resolution. This is a
+# problem because the Erlang.mk tests rely on file modification
+# times to ensure files were rebuilt. To fix this issue, we
+# detect here whether the system supports sub-second resolution,
+# and maybe sleep during test execution.
+#
+# Also see:
+# * http://arstechnica.com/apple/2011/07/mac-os-x-10-7/12/#hfs-problems
+# * https://apple.stackexchange.com/questions/51650/linus-torvalds-and-the-os-x-filesystem
+
+ifeq ($(shell touch a; sleep 0.01; touch b; sleep 0.01; touch c; test c -nt b -a b -nt a; echo $$?; rm a b c),1)
+SLEEP = sleep 1
+else
+SLEEP =
endif
# OTP master, for downloading files for testing.
@@ -47,11 +79,11 @@ else ifeq ($V,1)
else ifeq ($V,2)
t = @echo " TEST " $@;
v = V=0
- i = @echo == $@:
+ i = @echo "== $@:"
else
t =
v = V=1
- i = @echo == $@:
+ i = @echo "== $@:"
endif
# Main targets.
@@ -132,7 +164,7 @@ core-distclean-tmp: build clean-core-distclean-tmp
$i "Distclean the application"
$t $(MAKE) -C $(APP) distclean $v
- $i "Check if .erlang.mk directory got removed"
+ $i "Check that .erlang.mk directory got removed"
$t test ! -e $(APP)/.erlang.mk
core-help: build clean-core-help
diff --git a/test/core_app.mk b/test/core_app.mk
index 84c6588..f95d593 100644
--- a/test/core_app.mk
+++ b/test/core_app.mk
@@ -69,7 +69,9 @@ core-app-asn1: build clean-core-app-asn1
$(APP)/include/CAP.hrl \
$(APP)/src/CAP.erl \
$(APP)/src/use_cap.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/asn1/CAP.asn1
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/asn1/CAP.asn1 | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -322,7 +324,9 @@ core-app-generate-erl: build clean-core-app-generate-erl
$(APP)/ebin/$(APP).app \
$(APP)/ebin/generated.beam \
$(APP)/src/generated.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/script.sh
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -430,7 +434,9 @@ core-app-generate-erl-include: build clean-core-app-generate-erl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/generated.beam \
$(APP)/src/generated.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/include/included.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/include/included.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -489,7 +495,9 @@ core-app-generate-erl-prepend: build clean-core-app-generate-erl-prepend
$(APP)/ebin/$(APP).app \
$(APP)/ebin/generated.beam \
$(APP)/src/generated.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/script.sh
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -589,7 +597,9 @@ core-app-hrl: build clean-core-app-hrl
$(APP)/ebin/$(APP).app \
$(APP)/ebin/use_red.beam \
$(APP)/src/use_red.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/include/red.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -677,7 +687,9 @@ core-app-hrl-recursive: build clean-core-app-hrl-recursive
$(APP)/ebin/$(APP).app \
$(APP)/ebin/use_red.beam \
$(APP)/src/use_red.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/include/pill.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/include/pill.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -776,7 +788,9 @@ core-app-mib: build clean-core-app-mib
$(APP)/include/EX1-MIB.hrl \
$(APP)/priv/mibs/EX1-MIB.bin \
$(APP)/src/use_v1.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/mibs/EX1-MIB.mib
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/mibs/EX1-MIB.mib | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -851,9 +865,7 @@ core-app-no-makedep: build clean-core-app-no-makedep
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Set NO_MAKEDEP ?= 1 in the Makefile"
- $t sed -i.bak '2i\
-NO_MAKEDEP ?= 1\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "NO_MAKEDEP ?= 1\n"}' $(APP)/Makefile
$i "Generate .hrl files"
$t mkdir $(APP)/include/
@@ -886,7 +898,9 @@ NO_MAKEDEP ?= 1\
$(APP)/ebin/$(APP).app \
$(APP)/ebin/use_red.beam \
$(APP)/src/use_red.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/include/red.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -906,7 +920,9 @@ NO_MAKEDEP ?= 1\
$(APP)/ebin/$(APP).app \
$(APP)/ebin/use_red.beam \
$(APP)/src/use_red.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/include/red.hrl
+ $t $(SLEEP)
$t NO_MAKEDEP= $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -978,7 +994,7 @@ core-app-pt: build clean-core-app-pt
$t echo "COMPILE_FIRST += my_pt" >> $(APP)/Makefile
$i "Build the application; confirm the parse_transform is used"
- $t $(MAKE) -C $(APP) | grep "*** Running my_pt parse_transform."
+ $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
@@ -1008,9 +1024,7 @@ core-app-pt-erlc-opts: build clean-core-app-pt-erlc-opts
" Forms." > $(APP)/deps/my_pt_dep/src/my_pt.erl
$i "Add my_pt_dep to the list of dependencies"
- $t sed -i.bak '2i\
-BUILD_DEPS = my_pt_dep\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = my_pt_dep\n"}' $(APP)/Makefile
$i "Generate .erl files"
$t echo "-module(boy)." > $(APP)/src/boy.erl
@@ -1020,7 +1034,7 @@ BUILD_DEPS = my_pt_dep\
$t echo "ERLC_OPTS += +'{parse_transform, my_pt}'" >> $(APP)/Makefile
$i "Build the application; confirm the parse_transform is used"
- $t $(MAKE) -C $(APP) | grep "*** Running my_pt parse_transform."
+ $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
@@ -1074,7 +1088,9 @@ core-app-xrl: build clean-core-app-xrl
$(APP)/ebin/$(APP).app \
$(APP)/ebin/erlang_scan.beam \
$(APP)/src/erlang_scan.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/erlang_scan.xrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/erlang_scan.xrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1174,7 +1190,9 @@ core-app-xrl-include: build clean-core-app-xrl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/xfl_lexer.beam \
$(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/xfl_lexer.xrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/xfl_lexer.xrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1193,7 +1211,9 @@ core-app-xrl-include: build clean-core-app-xrl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/xfl_lexer.beam \
$(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/typechecks.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/typechecks.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1212,7 +1232,9 @@ core-app-xrl-include: build clean-core-app-xrl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/xfl_lexer.beam \
$(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/errvals.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/errvals.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1308,7 +1330,9 @@ core-app-yrl: build clean-core-app-yrl
$(APP)/ebin/$(APP).app \
$(APP)/ebin/xref_parser.beam \
$(APP)/src/xref_parser.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/xref_parser.yrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/xref_parser.yrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1402,7 +1426,9 @@ core-app-yrl-include: build clean-core-app-yrl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/core_parse.beam \
$(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/core_parse.yrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/core_parse.yrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
@@ -1421,7 +1447,9 @@ core-app-yrl-include: build clean-core-app-yrl-include
$(APP)/ebin/$(APP).app \
$(APP)/ebin/core_parse.beam \
$(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
+ $t $(SLEEP)
$t touch $(APP)/src/core_parse.hrl
+ $t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP) -type f -newer $(APP)/src/core_parse.hrl | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
diff --git a/test/core_compat.mk b/test/core_compat.mk
index b8c0681..06d5211 100644
--- a/test/core_compat.mk
+++ b/test/core_compat.mk
@@ -38,9 +38,7 @@ core-compat-auto-rebar: build clean-core-compat-auto-rebar
$i "Create a temporary file"
$t touch $(APP)/older_file
-
- $i "Wait a second"
- $t sleep 1
+ $t $(SLEEP)
$i "Build the application again"
$t $(MAKE) -C $(APP) $v
@@ -79,9 +77,7 @@ core-compat-rebar: build clean-core-compat-rebar
$i "Create a temporary file"
$t touch $(APP)/older_file
-
- $i "Wait a second"
- $t sleep 1
+ $t $(SLEEP)
$i "Run 'make rebar.config' again"
$t $(MAKE) -C $(APP) rebar.config $v
@@ -110,10 +106,7 @@ core-compat-rebar-deps: build clean-core-compat-rebar-deps
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy as a dependency"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\n"}' $(APP)/Makefile
$i "Run 'make rebar.config'"
$t $(MAKE) -C $(APP) rebar.config $v
@@ -145,9 +138,7 @@ core-compat-rebar-deps-pkg: build clean-core-compat-rebar-deps-pkg
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy package as a dependency"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
$i "Run 'make rebar.config'"
$t $(MAKE) -C $(APP) rebar.config $v
@@ -232,9 +223,7 @@ core-compat-rebar-pt: build clean-core-compat-rebar-pt
$t echo "-module(girl)." > $(APP)/src/girl.erl
$i "Add lager to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = lager\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
$i "Add the lager_transform parse_transform to ERLC_OPTS"
$t echo "ERLC_OPTS += +'{parse_transform, lager_transform}'" >> $(APP)/Makefile
diff --git a/test/core_deps.mk b/test/core_deps.mk
index 3d01eb7..0ae1bdf 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -1,6 +1,6 @@
# Core: Packages and dependencies.
-CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test
+CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test
CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
@@ -13,6 +13,373 @@ $(CORE_DEPS_CLEAN_TARGETS):
core-deps: $(CORE_DEPS_TARGETS)
+core-deps-apps: build clean-core-deps-apps
+
+ $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
+
+# Bootstrap the application manually to make sure it works as intended.
+ $i "Bootstrap a repository-local application my_app"
+ $t mkdir -p $(APP)/apps/my_app/src/
+ $t touch $(APP)/apps/file.erl
+ $t echo "DEPS = cowlib" > $(APP)/apps/my_app/Makefile
+ $t echo "include ../../erlang.mk" >> $(APP)/apps/my_app/Makefile
+ $t echo "-module(boy)." > $(APP)/apps/my_app/src/boy.erl
+ $t echo "-module(girl)." > $(APP)/apps/my_app/src/girl.erl
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/apps/my_app/my_app.d
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/boy.beam
+ $t test -f $(APP)/apps/my_app/ebin/girl.beam
+ $t test -d $(APP)/deps/cowlib
+
+# Applications in apps are compiled automatically but not added
+# to the application resource file unless they are listed in LOCAL_DEPS.
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
+ [ok = application:load(App) || App <- [$(APP), my_app]], \
+ {ok, Deps} = application:get_key($(APP), applications), \
+ false = lists:member(my_app, Deps), \
+ {ok, MyAppDeps} = application:get_key(my_app, applications), \
+ true = lists:member(cowlib, MyAppDeps), \
+ {ok, []} = application:get_key($(APP), modules), \
+ {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
+ [{module, M} = code:load_file(M) || M <- Mods], \
+ halt()"
+
+ $i "Clean the application"
+ $t $(MAKE) -C $(APP) clean $v
+
+ $i "Check that Cowlib is still here"
+ $t test -d $(APP)/deps/cowlib
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/$(APP).d
+ $t test ! -e $(APP)/ebin/$(APP).app
+ $t test ! -e $(APP)/apps/my_app/my_app.d
+ $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
+ $t test ! -e $(APP)/apps/my_app/ebin/boy.beam
+ $t test ! -e $(APP)/apps/my_app/ebin/girl.beam
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/deps
+
+ $i "Add my_app to the local dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add my_app to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_app,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/apps/my_app/my_app.d
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/boy.beam
+ $t test -f $(APP)/apps/my_app/ebin/girl.beam
+ $t test -d $(APP)/deps/cowlib
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
+ [ok = application:load(App) || App <- [$(APP), my_app]], \
+ {ok, Deps} = application:get_key($(APP), applications), \
+ true = lists:member(my_app, Deps), \
+ {ok, MyAppDeps} = application:get_key(my_app, applications), \
+ true = lists:member(cowlib, MyAppDeps), \
+ {ok, []} = application:get_key($(APP), modules), \
+ {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
+ [{module, M} = code:load_file(M) || M <- Mods], \
+ halt()"
+
+core-deps-apps-conflict: build clean-core-deps-apps-conflict
+
+ $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 Cowlib to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
+
+ $i "Create a new library Cowlib"
+ $t $(MAKE) -C $(APP) new-lib in=cowlib $v
+
+ $i "Check that building the application fails because of a conflict"
+ $t if $(MAKE) -C $(APP) $v; then false; fi
+
+ $i "Check that Cowlib wasn't fetched"
+ $t test ! -e $(APP)/deps/cowlib
+
+core-deps-apps-deep-conflict: build clean-core-deps-apps-deep-conflict
+
+ $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 Cowboy to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
+
+ $i "Create a new library Cowlib"
+ $t $(MAKE) -C $(APP) new-lib in=cowlib $v
+
+ $i "Check that building the application fails because of a conflict"
+ $t if $(MAKE) -C $(APP) $v; then false; fi
+
+ $i "Check that Cowlib wasn't fetched"
+ $t test ! -e $(APP)/deps/cowlib
+
+core-deps-apps-dir: build clean-core-deps-apps-dir
+
+ $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 "Set a custom APPS_DIR"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR = \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
+
+ $i "Create a new library my_app"
+ $t $(MAKE) -C $(APP) new-lib in=my_app $v
+
+ $i "Add Cowlib as a dependency to my_app"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/deep/libs/my_app/Makefile
+
+ifdef LEGACY
+ $i "Add Cowlib to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deep/libs/my_app/src/my_app.app.src
+endif
+
+ $i "Generate .erl files in my_app"
+ $t echo "-module(boy)." > $(APP)/deep/libs/my_app/src/boy.erl
+ $t echo "-module(girl)." > $(APP)/deep/libs/my_app/src/girl.erl
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/deep/libs/my_app/my_app.d
+ $t test -f $(APP)/deep/libs/my_app/ebin/my_app.app
+ $t test -f $(APP)/deep/libs/my_app/ebin/boy.beam
+ $t test -f $(APP)/deep/libs/my_app/ebin/girl.beam
+ $t test -d $(APP)/deps/cowlib
+
+# Applications in apps are compiled automatically but not added
+# to the application resource file unless they are listed in LOCAL_DEPS.
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
+ [ok = application:load(App) || App <- [$(APP), my_app]], \
+ {ok, Deps} = application:get_key($(APP), applications), \
+ false = lists:member(my_app, Deps), \
+ {ok, MyAppDeps} = application:get_key(my_app, applications), \
+ true = lists:member(cowlib, MyAppDeps), \
+ {ok, []} = application:get_key($(APP), modules), \
+ {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
+ [{module, M} = code:load_file(M) || M <- Mods], \
+ halt()"
+
+ $i "Clean the application"
+ $t $(MAKE) -C $(APP) clean $v
+
+ $i "Check that Cowlib is still here"
+ $t test -d $(APP)/deps/cowlib
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/$(APP).d
+ $t test ! -e $(APP)/ebin/$(APP).app
+ $t test ! -e $(APP)/libs/my_app/my_app.d
+ $t test ! -e $(APP)/libs/my_app/ebin/my_app.app
+ $t test ! -e $(APP)/libs/my_app/ebin/boy.beam
+ $t test ! -e $(APP)/libs/my_app/ebin/girl.beam
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/deps
+
+core-deps-apps-new-app: build clean-core-deps-apps-new-app
+
+ $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 "Create a new application my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Check that all bootstrapped files exist"
+ $t test -f $(APP)/apps/my_app/Makefile
+ifdef LEGACY
+ $t test -f $(APP)/apps/my_app/src/my_app.app.src
+endif
+ $t test -f $(APP)/apps/my_app/src/my_app_app.erl
+ $t test -f $(APP)/apps/my_app/src/my_app_sup.erl
+
+ $i "Create a new module my_server in my_app"
+ $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
+
+ $i "Check that the file exists"
+ $t test -f $(APP)/apps/my_app/src/my_server.erl
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/apps/my_app/my_app.d
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_server.beam
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
+ ok = application:start(my_app), \
+ {ok, [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
+ {module, my_app_app} = code:load_file(my_app_app), \
+ {module, my_app_sup} = code:load_file(my_app_sup), \
+ {module, my_server} = code:load_file(my_server), \
+ halt()"
+
+core-deps-apps-new-lib: build clean-core-deps-apps-new-lib
+
+ $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 "Create a new application my_app"
+ $t $(MAKE) -C $(APP) new-lib in=my_app $v
+
+ $i "Check that all bootstrapped files exist"
+ $t test -f $(APP)/apps/my_app/Makefile
+ifdef LEGACY
+ $t test -f $(APP)/apps/my_app/src/my_app.app.src
+endif
+
+ $i "Create a new module my_server in my_app"
+ $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
+
+ $i "Check that the file exists"
+ $t test -f $(APP)/apps/my_app/src/my_server.erl
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/apps/my_app/my_app.d
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/my_server.beam
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
+ ok = application:start(my_app), \
+ {ok, [my_server]} = application:get_key(my_app, modules), \
+ {module, my_server} = code:load_file(my_server), \
+ halt()"
+
+core-deps-apps-new-tpl: build clean-core-deps-apps-new-tpl
+
+ $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 "Create a new library my_app"
+ $t $(MAKE) -C $(APP) new-lib in=my_app $v
+
+ $i "Generate one of each template"
+ $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_fsm n=my_fsm
+ $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_server n=my_server
+ $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=supervisor n=my_sup
+
+# Here we disable warnings because templates contain missing behaviors.
+ $i "Build the application"
+ $t $(MAKE) -C $(APP)/apps/my_app ERLC_OPTS=+debug_info $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/my_fsm.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_server.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_sup.beam
+
+ $i "Check that all the modules can be loaded"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
+ ok = application:start(my_app), \
+ {ok, Mods = [my_fsm, my_server, my_sup]} = application:get_key(my_app, modules), \
+ [{module, M} = code:load_file(M) || M <- Mods], \
+ halt()"
+
+core-deps-apps-only: build clean-core-deps-apps-only
+
+ $i "Create a multi application repository with no root application"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t echo "include erlang.mk" > $(APP)/Makefile
+
+ $i "Create a new application my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Add Cowlib to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/apps/my_app/my_app.d
+ $t test -f $(APP)/apps/my_app/ebin/my_app.app
+ $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
+ $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
+ $t test -d $(APP)/deps/cowlib/
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
+ ok = application:load(my_app), \
+ {ok, Mods = [my_app_app, my_app_sup]} = application:get_key(my_app, modules), \
+ [{module, M} = code:load_file(M) || M <- Mods], \
+ halt()"
+
+ $i "Clean the application"
+ $t $(MAKE) -C $(APP) clean $v
+
+ $i "Check that Cowlib is still here"
+ $t test -d $(APP)/deps/cowlib
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/apps/my_app/my_app.d
+ $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
+ $t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
+ $t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that all relevant files were removed"
+ $t test ! -e $(APP)/deps
+
ifneq ($(PLATFORM),msys2)
core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
@@ -22,10 +389,7 @@ core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add 8cc to the list of build dependencies"
- $t sed -i.bak '2i\
-BUILD_DEPS = 8cc\
-dep_8cc = git https://github.com/rui314/8cc master\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -37,13 +401,14 @@ dep_8cc = git https://github.com/rui314/8cc master\
$t $(APP)/deps/8cc/8cc -h $v
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member('8cc', Deps), \
halt()"
endif
+ifneq ($(PLATFORM),freebsd)
core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
$i "Bootstrap a new OTP library named $(APP)"
@@ -52,10 +417,7 @@ core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add imagejs to the list of build dependencies"
- $t sed -i.bak '2i\
-BUILD_DEPS = imagejs\
-dep_imagejs = git https://github.com/jklmnn/imagejs master\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -68,11 +430,12 @@ dep_imagejs = git https://github.com/jklmnn/imagejs master\
$t test -f $(APP)/deps/imagejs/Makefile.bmp
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(imagejs, Deps), \
halt()"
+endif
core-deps-build-erl: build clean-core-deps-build-erl
@@ -82,9 +445,7 @@ core-deps-build-erl: build clean-core-deps-build-erl
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add cowlib to the list of build dependencies"
- $t sed -i.bak '2i\
-BUILD_DEPS = cowlib\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -107,10 +468,7 @@ core-deps-build-js: build clean-core-deps-build-js
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add jquery to the list of build dependencies"
- $t sed -i.bak '2i\
-BUILD_DEPS = jquery\
-dep_jquery = git https://github.com/jquery/jquery master\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -119,7 +477,7 @@ dep_jquery = git https://github.com/jquery/jquery master\
$t test -d $(APP)/deps/jquery
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(jquery, Deps), \
@@ -133,15 +491,11 @@ core-deps-dep-commit: build clean-core-deps-dep-commit
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-dep_cowboy_commit = 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -168,15 +522,11 @@ core-deps-dir: build clean-core-deps-dir
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-DEPS_DIR ?= \$$(CURDIR)/libs\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/libs\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -206,10 +556,7 @@ core-deps-doc: build clean-core-deps-doc
$t echo "-module(girl)." > $(APP)/src/girl.erl
$i "Add Edown as a documentation building dependency"
- $t sed -i.bak '2i\
-DOC_DEPS = edown\
-EDOC_OPTS = {doclet, edown_doclet}\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -218,7 +565,7 @@ EDOC_OPTS = {doclet, edown_doclet}\
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(edown, Deps), \
@@ -247,15 +594,11 @@ core-deps-fetch-cp: build clean-core-deps-fetch-cp
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
$i "Add my_dep to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = my_dep\
-dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add my_dep to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- my_dep,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -279,16 +622,11 @@ core-deps-fetch-custom: build clean-core-deps-fetch-custom
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add dependency boop using custom fetch method beep to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = boop\
-dep_boop = beep boop\
-dep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = boop\ndep_boop = beep boop\ndep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1/ebin/\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add boop to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- boop,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -312,10 +650,7 @@ core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib as a dependency using a non-existing fetch method named oops"
- $t sed -i.bak '2i\
-DEPS = cowlib\
-dep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t if $(MAKE) -C $(APP) $v; then false; fi
@@ -328,9 +663,7 @@ core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add an unknown application as a dependency"
- $t sed -i.bak '2i\
-DEPS = unknown\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t if $(MAKE) -C $(APP) $v; then false; fi
@@ -343,15 +676,11 @@ core-deps-fetch-git: build clean-core-deps-fetch-git
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -378,15 +707,11 @@ core-deps-fetch-hex: build clean-core-deps-fetch-hex
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-dep_cowboy = hex 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -413,15 +738,11 @@ core-deps-fetch-hg: build clean-core-deps-fetch-hg
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Ehsa 4.0.3 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = ehsa\
-dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = ehsa\ndep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add ehsa to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- ehsa,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -447,10 +768,7 @@ core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib as a dependency using a non-existing fetch method named oops"
- $t sed -i.bak '2i\
-DEPS = cowlib\
-dep_cowlib = https://github.com/ninenines/cowlib 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t if $(MAKE) -C $(APP) $v; then false; fi
@@ -466,15 +784,11 @@ core-deps-fetch-svn: build clean-core-deps-fetch-svn
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib 1.0.0 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowlib\
-dep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowlib,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -499,16 +813,11 @@ core-deps-ignore: build clean-core-deps-ignore
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-IGNORE_DEPS = ranch\
-TEST_DEPS = ranch\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -534,28 +843,20 @@ core-deps-order-first: build clean-core-deps-order-first
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+ $i "Add Cowboy package and my_dep to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
+
$i "Bootstrap a new OTP library named my_dep inside $(APP)"
$t mkdir $(APP)/my_dep
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
$i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
- $t sed -i.bak '2i\
-DEPS = cowlib\
-dep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\
-' $(APP)/my_dep/Makefile
-
- $i "Add Cowboy package and my_dep to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = my_dep cowboy\
-dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/my_dep/Makefile
ifdef LEGACY
$i "Add Cowboy and my_dep to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,\
- my_dep,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -584,15 +885,11 @@ core-deps-order-top: build clean-core-deps-order-top
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy cowlib\
-dep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -620,9 +917,7 @@ core-deps-otp: build clean-core-deps-otp
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Crypto to the list of OTP dependencies"
- $t sed -i.bak '2i\
-OTP_DEPS = crypto\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -631,7 +926,7 @@ OTP_DEPS = crypto\
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), crypto]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(crypto, Deps), \
@@ -646,14 +941,11 @@ core-deps-pkg: build clean-core-deps-pkg
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to the list of dependencies"
- $t sed -i.bak '2i\
-DEPS = cowboy\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
- $t sed -i.bak '8i\
- cowboy,' $(APP)/src/$(APP).app.src
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
@@ -679,9 +971,7 @@ core-deps-rel: build clean-core-deps-rel
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
$i "Add Recon to the list of release dependencies"
- $t sed -i.bak '2i\
-REL_DEPS = recon\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
$i "Add Recon to the relx.config file"
$t $(ERL) -eval " \
@@ -698,7 +988,7 @@ REL_DEPS = recon\
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(recon, Deps), \
@@ -712,7 +1002,7 @@ REL_DEPS = recon\
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
- [ok = application:load(App) || App <- [$(APP)]], \
+ [ok = application:load(App) || App <- [$(APP), recon]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(recon, Deps), \
halt()"
@@ -755,9 +1045,7 @@ core-deps-shell: build clean-core-deps-shell
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add TDDReloader to the list of shell dependencies"
- $t sed -i.bak '2i\
-SHELL_DEPS = tddreloader\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
$i "Build the application and its dependencies"
$t $(MAKE) -C $(APP) deps app $v
@@ -766,7 +1054,7 @@ SHELL_DEPS = tddreloader\
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(tddreloader, Deps), \
@@ -783,7 +1071,7 @@ SHELL_DEPS = tddreloader\
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
- [ok = application:load(App) || App <- [$(APP)]], \
+ [ok = application:load(App) || App <- [$(APP), tddreloader]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(tddreloader, Deps), \
halt()"
@@ -800,9 +1088,7 @@ core-deps-test: build clean-core-deps-test
$t echo "-module(girl)." > $(APP)/src/girl.erl
$i "Add triq to the list of test dependencies"
- $t sed -i.bak '2i\
-TEST_DEPS = triq\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
$i "Build the application and its dependencies"
$t $(MAKE) -C $(APP) deps app $v
@@ -811,7 +1097,7 @@ TEST_DEPS = triq\
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
- $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(triq, Deps), \
@@ -825,7 +1111,7 @@ TEST_DEPS = triq\
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
- [ok = application:load(App) || App <- [$(APP)]], \
+ [ok = application:load(App) || App <- [$(APP), triq]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(triq, Deps), \
halt()"
diff --git a/test/core_plugins.mk b/test/core_plugins.mk
index 5bbee3f..dfece5e 100644
--- a/test/core_plugins.mk
+++ b/test/core_plugins.mk
@@ -37,11 +37,7 @@ core-plugins-all: build clean-core-plugins-all
git commit -q -m "Tests"
$i "Add dependency and plugins to the Makefile"
- $t sed -i.bak '2i\
-DEPS = plugin_dep\
-dep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\
-DEP_PLUGINS = plugin_dep\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = plugin_dep\ndep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\nDEP_PLUGINS = plugin_dep\n"}' $(APP)/Makefile
$i "Run 'make plugin1' and check that it prints plugin1"
$t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
@@ -73,11 +69,7 @@ core-plugins-one: build clean-core-plugins-one
git commit -q -m "Tests"
$i "Add dependency and plugins to the Makefile"
- $t sed -i.bak '2i\
-DEPS = plugin_dep\
-dep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\
-DEP_PLUGINS = plugin_dep/mk/plugin1.mk\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = plugin_dep\ndep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\nDEP_PLUGINS = plugin_dep/mk/plugin1.mk\n"}' $(APP)/Makefile
$i "Run 'make plugin1' and check that it prints plugin1"
$t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
diff --git a/test/core_upgrade.mk b/test/core_upgrade.mk
index ec49a9f..d7b1744 100644
--- a/test/core_upgrade.mk
+++ b/test/core_upgrade.mk
@@ -64,9 +64,7 @@ core-upgrade-custom-repo: build clean-core-upgrade-custom-repo
$i "Fork erlang.mk locally and modify it"
$t git clone -q https://github.com/ninenines/erlang.mk $(APP)/alt-erlangmk-repo
- $t sed -i.bak '1i\
-# Copyright (c) erlang.mk Testsuite!\
-' $(APP)/alt-erlangmk-repo/core/core.mk
+ $t perl -ni.bak -e 'if ($$.==1) {print "# Copyright (c) erlang.mk Testsuite!\n";print}' $(APP)/alt-erlangmk-repo/core/core.mk
$t (cd $(APP)/alt-erlangmk-repo && \
git checkout -q -b test-copyright && \
git config user.email "[email protected]" && \
@@ -74,10 +72,7 @@ core-upgrade-custom-repo: build clean-core-upgrade-custom-repo
git commit -q -a -m 'Add Testsuite copyright')
$i "Point application to an alternate erlang.mk repository"
- $t sed -i.bak '2i\
-ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\
-ERLANG_MK_COMMIT = test-copyright\
-' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\nERLANG_MK_COMMIT = test-copyright\n"}' $(APP)/Makefile
$i "Update erlang.mk"
$t $(MAKE) -C $(APP) erlang-mk $v