Skip to content

Commit 845803a

Browse files
authored
Merge pull request #241 from mochi/rebar3
Start on rebar3 support
2 parents 53114ba + 8936dcd commit 845803a

26 files changed

+162
-164
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,24 @@ on:
55
pull_request:
66
jobs:
77
test:
8-
name: test
8+
name: test ${{matrix.otp}} on ${{matrix.os}}
99
runs-on: ${{matrix.os}}
10+
container:
11+
image: erlang:${{matrix.otp}}
1012
strategy:
1113
fail-fast: false
1214
matrix:
1315
os:
1416
- ubuntu-latest
1517
otp:
16-
- "24.3.3"
17-
- "23.3.4.5"
18-
- "22.3.4.9"
19-
- "21.3.8.17"
18+
- "24.3.4.0"
19+
- "23.3.4.14"
20+
- "22.3.4.26"
21+
- "21.3.8.24"
2022
- "20.3.8.26"
21-
include:
22-
- os: ubuntu-18.04
23-
otp: "19.3.6.13"
24-
- os: ubuntu-18.04
25-
otp: "18.3.4.11"
23+
- "19.3.6.13"
24+
- "18.3.4.11"
2625
steps:
2726
- uses: actions/[email protected]
28-
- run: |
29-
VERSION=${{matrix.otp}}
30-
RELEASE=$(lsb_release -cs)
31-
DIR=$(mktemp -d)
32-
pushd $DIR
33-
FILE=esl-erlang_$VERSION-1~ubuntu~$RELEASE\_amd64.deb
34-
wget https://packages.erlang-solutions.com/erlang/debian/pool/$FILE
35-
sudo dpkg -i $FILE
36-
popd
37-
rm -r $DIR
3827
- run: make test
28+
- run: REBAR=rebar make test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
*.beam
1212
*.dump
1313
rebar.lock
14+
/_build
15+
/rebar3.crashdump

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
Version 3.0.0 released 2022-XX-XX
1+
Version 3.0.0 released 2022-05-09
22

3+
* rebar3 is now the preferred build tool (finally)
4+
https://github.com/mochi/mochiweb/pull/241
5+
https://github.com/mochi/mochiweb/pull/243
36
* Minimum OTP version is now 18, which
47
allows us to remove a number of backwards
58
compatibility hacks while still supporting
@@ -14,6 +17,7 @@ Version 3.0.0 released 2022-XX-XX
1417
that expression might have to be updated to
1518
handle the `{shutdown, Error}` error reason.
1619
https://github.com/mochi/mochiweb/pull/238
20+
https://github.com/mochi/mochiweb/pull/242
1721

1822
Version 2.22.0 released 2021-08-23
1923

Makefile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
PREFIX:=../
2-
DEST:=$(PREFIX)$(PROJECT)
1+
REBAR?=rebar3
32

4-
REBAR=./rebar
3+
.PHONY: all edoc test clean build
54

6-
.PHONY: all edoc test clean build_plt dialyzer app
5+
all: build
76

8-
all:
9-
@$(REBAR) prepare-deps
7+
build:
8+
@$(REBAR) get-deps # rebar2 compatibility, it's no-op on rebar3
9+
@$(REBAR) compile
1010

11-
edoc: all
12-
@$(REBAR) doc
13-
14-
test:
15-
@rm -rf .eunit
16-
@mkdir -p .eunit
11+
test: build
1712
@$(REBAR) eunit
1813

14+
edoc: build
15+
@$(REBAR) edoc
16+
1917
clean:
2018
@$(REBAR) clean
21-
22-
app:
23-
@[ -z "$(PROJECT)" ] && echo "ERROR: required variable PROJECT missing" 1>&2 && exit 1 || true
24-
@$(REBAR) -r create template=mochiwebapp dest=$(DEST) appid=$(PROJECT)

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ The mailing list for MochiWeb is at https://groups.google.com/group/mochiweb/
66

77
Erlang OTP is required for setting up the MochiWeb environment and is available at https://www.erlang.org/
88

9-
To create a new mochiweb using project:
10-
make app PROJECT=project_name
9+
To create a new mochiweb using project see the `example_project` in the `examples/` folder.
1110

12-
To create a new mochiweb using project in a specific directory:
13-
make app PROJECT=project_name PREFIX=$HOME/projects/
14-
15-
Information about Rebar (Erlang build tool) is available at https://github.com/rebar/rebar
11+
Information about Rebar (Erlang build tool) is available at https://github.com/erlang/rebar3
1612

1713
MochiWeb is currently tested with Erlang/OTP 18.3 through 24.0,
1814
versions older than 3.0.0 may still be compatible back to R15B-03.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/ebin
2+
/doc
3+
/_test
4+
/.eunit
5+
/docs
6+
.DS_Store
7+
/TEST-*.xml
8+
/deps
9+
/.rebar
10+
*.swp
11+
*.beam
12+
*.dump
13+
_build/
14+
rebar.lock

examples/example_project/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
REBAR?=rebar3
2+
3+
.PHONY: all edoc test clean app
4+
5+
build:
6+
@$(REBAR) get-deps # rebar2 compatibility, it's no-op on rebar3
7+
@$(REBAR) compile
8+
9+
test:
10+
@$(REBAR) eunit
11+
12+
edoc:
13+
@$(REBAR) edoc
14+
15+
clean:
16+
@$(REBAR) clean

support/templates/mochiwebapp_skel/bench.sh renamed to examples/example_project/bench.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# workaround for rebar mustache template bug
4-
DEFAULT_PORT={{port}}
4+
DEFAULT_PORT=8080
55
HOST=${HOST:-127.0.0.1}
66
PORT=${PORT:-${DEFAULT_PORT}}
77

support/templates/mochiwebapp_skel/priv/www/index.html renamed to examples/example_project/priv/www/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<title>It Worked</title>
44
</head>
55
<body>
6-
{{appid}} running.
6+
example_project running.
77
</body>
88
</html>

support/templates/mochiwebapp_skel/rebar.config renamed to examples/example_project/rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
{erl_opts, [debug_info]}.
33
{deps, [
44
{mochiweb, ".*",
5-
{git, "git://github.com/mochi/mochiweb.git", {branch, "main"}}}]}.
5+
{git, "https://github.com/mochi/mochiweb.git", {branch, "main"}}}]}.
66
{cover_enabled, true}.
77
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.

0 commit comments

Comments
 (0)