diff options
-rw-r--r-- | circle.yml | 21 | ||||
-rw-r--r-- | core/deps.mk | 89 | ||||
-rw-r--r-- | core/erlc.mk | 4 | ||||
-rw-r--r-- | core/test.mk | 2 | ||||
-rw-r--r-- | plugins/ci.mk | 10 | ||||
-rw-r--r-- | test/Makefile | 6 |
6 files changed, 84 insertions, 48 deletions
diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..73b087e --- /dev/null +++ b/circle.yml @@ -0,0 +1,21 @@ +general: + artifacts: + - "test/pkgs.log" + +dependencies: + cache_directories: + - "~/.kerl" + - "~/erlang" + + pre: + - sudo apt-get update + - sudo apt-get install autoconf2.59 + - cd $HOME/bin && ln -s /usr/bin/autoconf2.59 autoconf + - cd $HOME/bin && ln -s /usr/bin/autoheader2.59 autoheader + - CI_OTP=OTP-18.0.2 make -f core/core.mk -f plugins/ci.mk ci-prepare: + timeout: 3600 + +test: + override: + - source $HOME/erlang/OTP-18.0.2/activate && make check: + timeout: 7200 diff --git a/core/deps.mk b/core/deps.mk index cfbf9a4..c3842d1 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -201,7 +201,7 @@ define dep_autopatch_rebar.erl false -> ok; {Name, Source} -> {Method, Repo, Commit} = case Source of - {hex, V} -> {hex, undefined, V}; + {hex, V} -> {hex, V, undefined}; {git, R} -> {git, R, master}; {M, R, {branch, C}} -> {M, R, C}; {M, R, {ref, C}} -> {M, R, C}; @@ -472,7 +472,25 @@ define dep_autopatch_appsrc.erl halt() endef -define hex_fetch.erl +define dep_fetch_git + git clone -q -n -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \ + cd $(DEPS_DIR)/$(call dep_name,$(1)) && git checkout -q $(call dep_commit,$(1)); +endef + +define dep_fetch_hg + hg clone -q -U $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \ + cd $(DEPS_DIR)/$(call dep_name,$(1)) && hg update -q $(call dep_commit,$(1)); +endef + +define dep_fetch_svn + svn checkout -q $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); +endef + +define dep_fetch_cp + cp -R $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); +endef + +define dep_fetch_hex.erl ssl:start(), inets:start(), {ok, {{_, 200, _}, _, Body}} = httpc:request(get, @@ -484,49 +502,42 @@ define hex_fetch.erl halt() endef +# Hex only has a package version. No need to look in the Erlang.mk packages. +define dep_fetch_hex + $(call erlang,$(call dep_fetch_hex.erl,$(1),$(strip $(word 2,$(dep_$(1)))))); +endef + +define dep_fetch_fail + echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \ + exit 78; +endef + +# Kept for compatibility purposes with older Erlang.mk configuration. +define dep_fetch_legacy + $(warning WARNING: '$(1)' dependency configuration uses deprecated format.) \ + git clone -q -n -- $(word 1,$(dep_$(1))) $(DEPS_DIR)/$(1); \ + cd $(DEPS_DIR)/$(1) && git checkout -q $(if $(word 2,$(dep_$(1))),$(word 2,$(dep_$(1))),master); +endef + define dep_fetch - if [ "$(2)" = "git" ]; then \ - git clone -q -n -- $(3) $(DEPS_DIR)/$(1); \ - cd $(DEPS_DIR)/$(1) && git checkout -q $(4); \ - elif [ "$(2)" = "hg" ]; then \ - hg clone -q -U $(3) $(DEPS_DIR)/$(1); \ - cd $(DEPS_DIR)/$(1) && hg update -q $(4); \ - elif [ "$(2)" = "svn" ]; then \ - svn checkout -q $(3) $(DEPS_DIR)/$(1); \ - elif [ "$(2)" = "cp" ]; then \ - cp -R $(3) $(DEPS_DIR)/$(1); \ - elif [ "$(2)" = "hex" ]; then \ - $(call erlang,$(call hex_fetch.erl,$(1),$(strip $(4)))); \ - else \ - echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \ - exit 78; \ - fi + $(if $(dep_$(1)), \ + $(if $(dep_fetch_$(word 1,$(dep_$(1)))), \ + $(word 1,$(dep_$(1))), \ + legacy), \ + $(if $(filter $(1),$(PACKAGES)), \ + $(pkg_$(1)_fetch), \ + fail)) endef +dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name)) +dep_repo = $(patsubst git://github.com/%,https://github.com/%, \ + $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))) +dep_commit = $(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)) + define dep_target $(DEPS_DIR)/$(1): $(verbose) mkdir -p $(DEPS_DIR) -ifeq (,$(dep_$(1))) - $(dep_verbose) $(call dep_fetch,$(pkg_$(1)_name),$(pkg_$(1)_fetch), \ - $(patsubst git://github.com/%,https://github.com/%,$(pkg_$(1)_repo)), \ - $(pkg_$(1)_commit)) -else -ifeq (1,$(words $(dep_$(1)))) - $(dep_verbose) $(call dep_fetch,$(1),git, \ - $(patsubst git://github.com/%,https://github.com/%,$(dep_$(1))), \ - master) -else -ifeq (2,$(words $(dep_$(1)))) - $(dep_verbose) $(call dep_fetch,$(1),git, \ - $(patsubst git://github.com/%,https://github.com/%,$(word 1,$(dep_$(1)))), \ - $(word 2,$(dep_$(1)))) -else - $(dep_verbose) $(call dep_fetch,$(1),$(word 1,$(dep_$(1))), \ - $(patsubst git://github.com/%,https://github.com/%,$(word 2,$(dep_$(1)))), \ - $(word 3,$(dep_$(1)))) -endif -endif -endif + $(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 \ echo " AUTO " $(1); \ cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \ diff --git a/core/erlc.mk b/core/erlc.mk index f6bd6fd..88895a2 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -72,7 +72,7 @@ endif app-build: erlc-include ebin/$(PROJECT).app $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true)) - $(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename $(wildcard ebin/*.beam)))))) + $(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename $(shell find ebin -type f -name *.beam)))))) ifeq ($(wildcard src/$(PROJECT).app.src),) $(app_verbose) echo $(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES)))) \ > ebin/$(PROJECT).app @@ -93,7 +93,7 @@ erlc-include: fi define compile_erl - $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \ + $(erlc_verbose) erlc -v $(if $(IS_DEP),$(filter-out -Werror,$(ERLC_OPTS)),$(ERLC_OPTS)) -o ebin/ \ -pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\ $(COMPILE_FIRST_PATHS) $(1)) endef diff --git a/core/test.mk b/core/test.mk index acc792a..83bbecb 100644 --- a/core/test.mk +++ b/core/test.mk @@ -20,7 +20,7 @@ ifneq ($(SKIP_DEPS),) test-deps: else test-deps: $(ALL_TEST_DEPS_DIRS) - $(verbose) for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done + $(verbose) for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep IS_DEP=1; done endif ifneq ($(wildcard $(TEST_DIR)),) diff --git a/plugins/ci.mk b/plugins/ci.mk index 11be218..8ec5b67 100644 --- a/plugins/ci.mk +++ b/plugins/ci.mk @@ -16,7 +16,9 @@ CI_OTP ?= ifeq ($(strip $(CI_OTP)),) ci:: else -ci:: $(KERL) $(addprefix ci-,$(CI_OTP)) +ci:: $(addprefix ci-,$(CI_OTP)) + +ci-prepare: $(addprefix $(CI_INSTALL_DIR)/,$(CI_OTP)) ci-setup:: @@ -25,7 +27,7 @@ ci_verbose = $(ci_verbose_$(V)) define ci_target ci-$(1): $(CI_INSTALL_DIR)/$(1) - -$(ci_verbose) \ + $(ci_verbose) \ PATH="$(CI_INSTALL_DIR)/$(1)/bin:$(PATH)" \ CI_OTP_RELEASE="$(1)" \ CT_OPTS="-label $(1)" \ @@ -35,9 +37,11 @@ endef $(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp)))) define ci_otp_target -$(CI_INSTALL_DIR)/$(1): +ifeq ($(wildcard $(CI_INSTALL_DIR)/$(1)),) +$(CI_INSTALL_DIR)/$(1): $(KERL) $(KERL) build git $(OTP_GIT) $(1) $(1) $(KERL) install $(1) $(CI_INSTALL_DIR)/$(1) +endif endef $(foreach otp,$(CI_OTP),$(eval $(call ci_otp_target,$(otp)))) diff --git a/test/Makefile b/test/Makefile index f2beb86..59063e6 100644 --- a/test/Makefile +++ b/test/Makefile @@ -54,7 +54,7 @@ app: app1 $i "app: Testing the 'app' target." $t $(MAKE) -C app1 app $v $i "Checking the modules line in the generated .app file." - $t [ `grep -E "{modules, *\['m'\]}" app1/ebin/app1.app | wc -l` == 1 ] + $t [ `grep -E "{modules, *\['m'\]}" app1/ebin/app1.app | wc -l` -eq 1 ] $t [ -e app1/ebin/m.beam ] $i "Checking that '$(MAKE) clean-app' deletes ebin." $t $(MAKE) -C app1 clean-app $v @@ -187,7 +187,7 @@ docs: app1 $t printf "%s\n" \ "PROJECT = app1" \ "DOC_DEPS = edown" \ - "dep_edown = git https://github.com/uwiger/edown.git 0.5" \ + "dep_edown = git https://github.com/uwiger/edown.git 0.7" \ "EDOC_OPTS = {doclet, edown_doclet}" \ "include erlang.mk" \ "distclean:: distclean-doc-md" \ @@ -200,7 +200,7 @@ docs: app1 $t [ -e app1/doc/m.md ] $i "Checking that '$(MAKE) distclean' deletes all generated doc files." $t $(MAKE) -C app1 -f Makefile-doc distclean $v - $t [ "`ls app1/doc/`" == "" ] + $t [ "`ls app1/doc/`" = "" ] $i "Cleaning up test data." $t rm app1/Makefile-doc $i "Test 'docs' passed." |