Skip to content

Commit

Permalink
Make use of profiles to minimize downstream dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Dushin <[email protected]>
  • Loading branch information
fadushin committed Nov 18, 2023
1 parent d94b4cd commit 367fd10
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## All rights reserved.
##

all: compile escript doc etest rel
all: compile escript etest doc rel

compile:
rebar3 compile
Expand All @@ -12,19 +12,23 @@ escript:
rebar3 escriptize

doc:
rebar3 ex_doc
rebar3 as doc ex_doc

etest:
rebar3 eunit --cover
rebar3 proper --cover
rebar3 cover --verbose
rebar3 as test eunit --cover
rebar3 as test proper --cover
rebar3 as test cover --verbose

rel:
rebar3 release
rebar3 tar
rebar3 as prod release
rebar3 as prod tar
rm -rf x
mkdir x
./install.sh x 0.7.1
x/bin/packbeam version

clean:
rm -rf _build

publish:
rebar3 hex publish
publish: doc
rebar3 as publish hex publish --doc-dir docs
14 changes: 7 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@ echo_run() {
${cmd}
}

readonly src_tar="${root_dir}/_build/default/rel/atomvm_packbeam/atomvm_packbeam-${version}.tar.gz"
readonly src_tar="${root_dir}/_build/prod/rel/atomvm_packbeam/atomvm_packbeam-${version}.tar.gz"
if [ ! -e "${src_tar}" ]; then
echo "ERROR! It looks like atomvm_packbeam version ${version} has not been built!"
exit 1
fi

## unzip the archive (so that BSD tar can deal with it)
readonly tmp_dir="$(mktemp -d /tmp/atomvm_packbeam.XXXXXX)"
echo_run cp "${src_tar}" "${tmp_dir}/."
echo_run gunzip "${tmp_dir}/atomvm_packbeam-${version}.tar.gz"

readonly dest_dir="${prefix}/atomvm_packbeam"
if [ $(${dest_dir}/bin/packbeam version) = ${version} ]; then
if [ -e "${dest_dir}/bin/packbeam" ] && [ "$(${dest_dir}/bin/packbeam version)" == "${version}" ]; then
echo "ERROR! It looks like ${version} is already installed!"
exit 1
fi

## unzip the archive (so that BSD tar can deal with it)
readonly tmp_dir="$(mktemp -d /tmp/atomvm_packbeam.XXXXXX)"
echo_run cp "${src_tar}" "${tmp_dir}/."
echo_run gunzip "${tmp_dir}/atomvm_packbeam-${version}.tar.gz"

echo_run mkdir -p "${dest_dir}"
echo_run tar -C "${dest_dir}" -x -f "${tmp_dir}/atomvm_packbeam-${version}.tar"

Expand Down
12 changes: 9 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
{api_reference, true},
{skip_undefined_reference_warnings_on, ["README.md"]}
]}.
{hex, [{doc, #{provider => ex_doc}}]}.
{plugins, [rebar3_hex, rebar3_proper, rebar3_ex_doc]}.

%% Profiles
{profiles, [
Expand All @@ -35,7 +33,15 @@
{cover_enabled, true},
{deps, [
{proper, "1.4.0"}
]}
]},
{plugins, [rebar3_proper]}
]},
{doc, [
{plugins, [rebar3_ex_doc]}
]},
{publish, [
{plugins, [rebar3_hex, rebar3_ex_doc]},
{hex, [{doc, #{provider => ex_doc}}]}
]}
]}.

Expand Down
2 changes: 1 addition & 1 deletion src/atomvm_packbeam.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{applications, [kernel, stdlib]},
{env, []},
{modules, [packbeam_api]},
{licenses, ["Apache 2.0"]},
{licenses, ["Apache-2.0"]},
{pkg_name, "atomvm_packbeam"},
{links, [{"github", "https://github.com/atomvm/atomvm_packbeam"}]}
]
Expand Down

0 comments on commit 367fd10

Please sign in to comment.