Skip to content

Commit de6f30d

Browse files
committed
Merge branch 'develop'
2 parents 6af7606 + 58463ad commit de6f30d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2749
-624
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ log/
2727
stale_outputs_checked
2828

2929
data/
30+
31+
achlys-0\.2\.0/
32+
33+
achlys-0\.2\.0\.tar\.gz

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM erlang:alpine
2+
3+
RUN apk add make git
4+
5+
RUN mkdir -p /buildroot/achlys
6+
WORKDIR /buildroot/achlys
7+
8+
COPY src .
9+
COPY include .
10+
COPY config .
11+
COPY tools .
12+
COPY Makefile .
13+
COPY rebar.config* .
14+
COPY VERSION .
15+
16+
RUN make release v=1
17+
18+
FROM alpine
19+
20+
RUN apk add openssl ncurses-libs
21+
22+
RUN VERSION=$(cat VERSION) && export achlys_VERSION=$VERSION
23+
COPY --from=0 achlys-$achlys_VERSION /achlys
24+
25+
WORKDIR /
26+
RUN rm -rf /buildroot
27+
28+
CMD ["/achlys/bin/achlys", "foreground"]

Makefile

Lines changed: 147 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,176 @@
1-
REBAR ?= $(shell which rebar3)
2-
BASE_DIR ?= $(shell pwd)
3-
GRISPAPP ?= $(shell basename `find src -name "*.app.src"` .app.src)
4-
GRISP_TEST_SRC_DIR ?= $(BASE_DIR)/_build/default/lib/grisp/test/
5-
REBAR_CONFIG ?= $(BASE_DIR)/rebar.config
6-
GRISPFILES_DIR ?= $(BASE_DIR)/grisp/grisp_base/files
7-
CACHE_DIR ?= $(HOME)/.cache/rebar3
8-
COOKIE ?= MyCookie
9-
VERSION ?= 0.2.0
10-
PDFDIR ?= $(BASE_DIR)/doc/internal
1+
# Auto-generated by https://github.com/Pouriya-Jahanbakhsh/estuff
112

12-
REBAR_APPEND ?= {extra_src_dirs, [\"$(GRISP_TEST_SRC_DIR)\"]}.
3+
CFG_DIR = $(CURDIR)/config
4+
GRISP_FILES_DIR = $(CURDIR)/grisp/grisp_base/files
5+
TOOLS_DIR = $(CURDIR)/tools
6+
REBAR = $(TOOLS_DIR)/rebar3
7+
LOCAL_REBAR = $(HOME)/.cache/rebar3/bin/rebar3
8+
ERL := $(shell command -v erl 2> /dev/null)
9+
RELEASE_DIR = $(CURDIR)/_build/default/rel/achlys
10+
VERSION := $(shell cat VERSION | tr -ds \n \r)
11+
RELEASE_NAME = achlys-$(VERSION)
12+
NAME_UPPER := $(shell echo achlys | awk '{print toupper($$1)}')
13+
GRISPAPP ?= $(shell basename `find src -name "*.app.src"` .app.src)
14+
GRISP_TEST_SRC_DIR ?= $(CURDIR)/_build/default/lib/grisp/test/
15+
REBAR_CONFIG = $(CURDIR)/rebar.config
16+
REBAR_APPEND ?= {extra_src_dirs, [\"$(GRISP_TEST_SRC_DIR)\"]}.
17+
COOKIE ?= MyCookie
1318

14-
.PHONY: compile shell testshell deploy \
15-
clean buildclean grispclean cacheclean ⁠fullclean testsrc rel addemu rmvemu
16-
# cleaning targets :
17-
# command-line utils
19+
PRE = @
20+
POST =
21+
REBAR_DEBUG =
1822

23+
v = 1
24+
ifeq ($(v),0)
25+
POST = > /dev/null
26+
endif
1927

20-
all: compile
28+
ifeq ($(v),2)
29+
PRE =
30+
REBAR_DEBUG = 1
31+
endif
2132

22-
##
23-
## Compilation targets
24-
##
33+
coverage = 0
34+
ifeq ($(coverage),0)
35+
coverage = /dev/null
36+
endif
2537

26-
compile:
27-
$(REBAR) compile
28-
29-
##
30-
## Cleaning targets
31-
##
38+
ifndef ERL
39+
$(error Could not found Erlang/OTP ('erl' command) installed on this system.)
40+
endif
3241

33-
clean: buildclean relclean
34-
$(REBAR) clean
3542

36-
⁠fullclean: buildclean grispclean cacheclean relclean
37-
$(REBAR) clean
43+
.PHONY: all compile shell erlshell docs test dialyzer cover release package tar clean distclean docker push upbar setaddr addemu deploy
3844

39-
buildclean:
40-
rm -rdf $(BASE_DIR)/_build/*/lib/*/ebin/*
4145

42-
grispclean:
43-
rm -rdf $(BASE_DIR)/_grisp
4446

45-
hexclean:
46-
rm -rdf $(CACHE_DIR)/hex/hexpm/packages/*
47+
all: test docs package
4748

48-
cacheclean:
49-
rm -rdf $(CACHE_DIR)/lib/*/ebin/*
5049

51-
relclean:
52-
rm -rdf $(BASE_DIR)/_build/*/rel
53-
#
54-
# Test targets
55-
#
50+
compile:
51+
@ echo Compiling code
52+
$(PRE) \
53+
export $(NAME_UPPER)_BUILD=COMPILE && \
54+
export DEBUG=$(REBAR_DEBUG) && \
55+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
56+
$(REBAR) compile \
57+
$(POST)
58+
$(PRE) cp -r $(CURDIR)/_build/default/lib/achlys/ebin $(CURDIR)
5659

5760
shell: addemu
5861
$(REBAR) as test shell --sname $(GRISPAPP)$(n) --setcookie $(COOKIE) --apps $(GRISPAPP)
5962

60-
testshell: addemu
61-
$(REBAR) as test shell --sname $(GRISPAPP)$(n) --setcookie $(COOKIE) --apps $(GRISPAPP) ;
63+
deploy:
64+
$(REBAR) grisp deploy -n $(GRISPAPP) -v $(VERSION)
65+
66+
erlshell:
67+
@ echo Compiling user_default module
68+
$(PRE) erlc -o $(TOOLS_DIR) $(TOOLS_DIR)/user_default.erl $(POST)
69+
$(PRE) \
70+
export $(NAME_UPPER)_BUILD=SHELL && \
71+
export DEBUG=$(REBAR_DEBUG) && \
72+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
73+
$(REBAR) compile \
74+
$(POST) && \
75+
erl -pa `ls -d _build/default/lib/*/ebin` \
76+
-pz $(TOOLS_DIR) \
77+
-config $(CFG_DIR)/sys.config \
78+
-args_file $(CFG_DIR)/vm.args \
79+
-eval "begin application:load('achlys'), catch code:load_file('achlys') end" \
6280

6381
addemu:
64-
@if [ -f $(REBAR_CONFIG) ]; then \
82+
@ if [ -f $(REBAR_CONFIG) ]; then \
6583
if [ $$(grep -c 'extra_src_dirs' rebar.config) -eq 0 ]; then \
6684
echo $(REBAR_APPEND) >> $(REBAR_CONFIG); \
6785
fi; \
6886
else \
6987
echo "ERROR: no rebar"; \
70-
fi
88+
fi \
7189

72-
## Infinite loop failure with rmvemu target
73-
## rmvemu:
74-
## echo sed '/extra_src_dirs/d' $(REBAR_CONFIG) >> $(REBAR_CONFIG)
90+
setaddr:
91+
networksetup -setmanual "Wi-Fi" 169.254.187.90 255.255.0.0 169.254.187.90
7592

76-
## Release targets
77-
##
93+
docs:
94+
@ echo Building documentation
95+
$(PRE) \
96+
export $(NAME_UPPER)_BUILD=DOC && \
97+
export DEBUG=$(REBAR_DEBUG) && \
98+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
99+
$(REBAR) edoc \
100+
$(POST)
78101

79-
rel:
80-
$(REBAR) release -d false
81102

82-
deploy:
83-
$(REBAR) grisp deploy -n $(GRISPAPP) -v $(VERSION)
103+
test: cover
104+
105+
106+
dialyzer: compile
107+
@ echo Running dialyzer
108+
$(PRE) \
109+
export $(NAME_UPPER)_BUILD=DIALYZER && \
110+
export DEBUG=$(REBAR_DEBUG) && \
111+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
112+
$(REBAR) dialyzer \
113+
$(POST)
114+
115+
116+
cover: compile
117+
@ echo Running tests
118+
$(PRE) \
119+
export $(NAME_UPPER)_BUILD=TEST && \
120+
export DEBUG=$(REBAR_DEBUG) && \
121+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
122+
$(REBAR) do ct, cover \
123+
$(POST)
124+
@ echo Coverage summary:
125+
$(PRE) \
126+
awk -f $(TOOLS_DIR)/coverage_summary.awk \
127+
-v indent="\t" \
128+
-v colorize=1 \
129+
$(CURDIR)/_build/test/cover/index.html \
130+
|| true
131+
$(PRE) \
132+
awk -f $(TOOLS_DIR)/coverage_summary.awk \
133+
$(CURDIR)/_build/test/cover/index.html \
134+
> $(coverage) || true
135+
136+
137+
release: compile
138+
@ echo Building release $(RELEASE_NAME)
139+
$(PRE) \
140+
export $(NAME_UPPER)_BUILD=RELEASE && \
141+
export DEBUG=$(REBAR_DEBUG) && \
142+
export $(NAME_UPPER)_VERSION=$(VERSION) && \
143+
$(REBAR) release \
144+
$(POST)
145+
$(PRE) mkdir -p $(CURDIR)/$(RELEASE_NAME) $(POST)
146+
$(PRE) cp -r $(RELEASE_DIR)/* $(CURDIR)/$(RELEASE_NAME) $(POST)
147+
148+
149+
package: release
150+
$(PRE) tar -zcvf $(RELEASE_NAME).tar.gz $(CURDIR)/$(RELEASE_NAME) $(POST)
151+
152+
upbar:
153+
@ echo Overwriting rebar3 with locally cached version
154+
cp $(LOCAL_REBAR) $(TOOLS_DIR)
155+
156+
tar:
157+
$(PRE) (rm -rf ./achlys.tar.gz) && (find ./ -type f > ../.achlys_archive) && (tar -zcvf achlys.tar.gz -T - < ../.achlys_archive) && rm -rf ../.achlys_archive $(POST)
158+
159+
160+
clean:
161+
@ echo Cleaning out
162+
$(PRE) $(REBAR) clean $(POST)
163+
$(PRE) rm -rf $(CURDIR)/ebin $(POST)
164+
165+
166+
distclean: clean
167+
$(PRE) rm -rf _build rebar.lock $(RELEASE_NAME) $(RELEASE_NAME).tar.gz achlys.tar.gz ebin tools/user_default.beam $(POST)
168+
169+
170+
docker:
171+
$(PRE) docker build -t achlys ./ $(POST)
172+
84173

85-
htmldoc:
86-
xsltproc --noout --stringparam outdir /tmp/myhtmldoc \
87-
--stringparam docgen $(ERL_TOP)/lib/erl_docgen \
88-
--stringparam topdocdir . \
89-
--stringparam pdfdir "$(PDFDIR)" \
90-
--xinclude \
91-
--stringparam gendate "October 31 2018" \
92-
--stringparam appname Achlys \
93-
--stringparam appver 0.1.0 \
94-
-path $(ERL_TOP)/lib/erl_docgen/priv/dtd \
95-
-path $(ERL_TOP)/lib/erl_docgen/priv/dtd_html_entities \
96-
$(ERL_TOP)/lib/erl_docgen/priv/xsl/db_html.xsl mybook.xml
97-
98-
include tools.mk
174+
push: cover
175+
@ echo Pushing to master branch
176+
$(PRE) git push origin master

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.0

0 commit comments

Comments
 (0)