Skip to content

Commit

Permalink
Get rid of mix and rebar2 and permanently move to rebar3
Browse files Browse the repository at this point in the history
Also, it removes Elixir bindings for Hello and Hello.Clien. Now Elixir
code which uses them should have aliases for both modules:

    alias :hello, as: Hello
    alias :hello_client, as: Hello.Client
  • Loading branch information
surik authored and umatomba committed Oct 10, 2017
1 parent 3466ae4 commit 5fbe72d
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 163 deletions.
22 changes: 7 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ before_install:
- sudo apt-get install avahi-daemon libavahi-compat-libdnssd-dev
- wget https://s3.amazonaws.com/rebar3/rebar3
- chmod u+x ./rebar3
language: elixir
elixir:
- 1.2.6
- 1.3.2
language: erlang
otp_release:
- 18.3
- 19.0
- 18.0
- 18.3
- 19.0
- 20.0
install: "true"
script:
- mix compile
- rm -Rf deps _build
- ./rebar3 update
- ./rebar3 compile
- rm -Rf _build
- rebar get-deps
- rebar compile
- rebar ct skip_deps=true
after_failure: "cat logs/raw.log"
- ./rebar3 do compile && ./rebar3 do ct && ./rebar3 coveralls send
36 changes: 0 additions & 36 deletions lib/hello.ex

This file was deleted.

39 changes: 0 additions & 39 deletions mix.exs

This file was deleted.

25 changes: 0 additions & 25 deletions mix.lock

This file was deleted.

54 changes: 40 additions & 14 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
{erl_opts, [{parse_transform, lager_transform},
{d, debug}]}.
{erl_opts, [{parse_transform, lager_transform}, {d, debug}]}.

{plugin_dir, "deps/yang/rebar_plugins"}.
{plugins, [rebar_yang_compiler]}.
{plugins, [
coveralls,
{rebar3_yang_plugin, {git, "git://github.com/surik/rebar3_yang_plugin.git", {tag, "0.2.2"}}}
]}.

{provider_hooks, [
{post, [{compile, {yang, compile}}]}
]}.

{yang_opts, [
{yang_dir, "test"},
{yang_build_dir, "test/hrl"}
]}.

{deps, [
{lager, ".*", {git, "git://github.com/basho/lager.git", {branch, master}}},
{cowboy, ".*", {git, "git://github.com/extend/cowboy.git", {branch, "1.0.x"}}},
lager,
{cowboy, "1.1.2"},
hackney,
jsx,
hackney,
exometer_core,
{msgpack, "0.6.0"},
{yang, ".*", {git, "git://github.com/travelping/yang.git", {branch, "master"}}},
{hackney, ".*", {git, "git://github.com/benoitc/hackney.git", {branch, master}}},
{ex_uri, ".*", {git, "git://github.com/heroku/ex_uri.git", {branch, master}}},
{ezmq, ".*", {git, "git://github.com/RoadRunnr/ezmq.git", {branch, "fix-socket-crash"}}},
{jsx, ".*", {git, "git://github.com/talentdeficit/jsx.git", {branch, develop}}},
{msgpack, ".*", {git, "git://github.com/msgpack/msgpack-erlang.git", {tag, "0.6.0"}}},
{dnssd, ".*", {git, "git://github.com/benoitc/dnssd_erlang.git", {branch, master}}},
{meck, ".*", {git, "git://github.com/eproxus/meck.git", {branch, master}}},
{exometer_core, ".*", {git, "git://github.com/Feuerlabs/exometer_core", "5fdd9426713a3c26cae32f644a3120711b1cdb64"}},
{coveralls, ".*", {git, "git://github.com/markusn/coveralls-erl.git", {branch, "master"}}}
% {tetrapak_yang, ".*", {git, "git://github.com/travelping/tetrapak_yang.git", {branch, master}}}
{dnssd, ".*", {git, "git://github.com/benoitc/dnssd_erlang.git", {branch, master}}}
]}.


{profiles, [
{test, [
{deps, [meck]}
]}
]}.

{overrides, [
{override, abnfc, [{erl_opts, [nowarn_export_all]}]},
{override, yang, [{plugins, [pc]},
{provider_hooks, [{post, [{compile, {pc, compile}},
{clean, {pc, clean}}]}]}]},
{override, dnssd, [{plugins, [pc]},
{provider_hooks, [{post, [{compile, {pc, compile}},
{clean, {pc, clean}}]}]}]},
{override, ex_uri, [{plugins, [rebar3_abnfc_plugin]},
{provider_hooks, [{pre, [{compile, {abnfc, compile}}]}]}]}
]}.

{cover_enabled, true}.
{cover_export_enabled, true}.
{coveralls_service_name, "travis-ci"}.
{do_coveralls_after_ct, false}.
{do_coveralls_after_eunit, false}.
{coveralls_coverdata, "_build/test/cover/ct.coverdata"}.
42 changes: 8 additions & 34 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
%% -*- erlang -*-
YangPlugin = {plugins, [{rebar3_yang_plugin, {git, "git://github.com/surik/rebar3_yang_plugin.git", {branch, "master"}}}]},
PCPlugin = [{plugins, [pc]}, {provider_hooks, [ {post, [ {compile, {pc, compile}}, {clean, {pc, clean}} ] }] }],
AbnfcPlugin = [{plugins, [ {rebar3_abnfc_plugin, {git, "git://github.com/surik/rebar3_abnfc_plugin.git", {branch, "master"}}} ]},
{provider_hooks, [ {pre, [ {compile, {abnfc, compile}} ] }] }],

HexDeps = [lager, cowboy, hackney, jsx, meck],

OverrideYang = {override, yang, PCPlugin},
OverrideDnssd = {override, dnssd, PCPlugin},
OverrideExUri = {override, ex_uri, AbnfcPlugin},
Overrides = {overrides, [OverrideYang, OverrideDnssd, OverrideExUri]},

code:is_loaded(rebar3) =:= false andalso code:load_file(rebar3),
case erlang:function_exported(rebar3, version, 0) of
true ->
CONFIG1 = lists:keyreplace(plugins, 1, CONFIG, YangPlugin),
NewDeps = lists:foldl(fun(Dep, Deps) ->
Key = case Dep of {K, _} -> K; K -> K end,
[Dep | lists:keydelete(K, 1, Deps)]
end, proplists:get_value(deps, CONFIG1), HexDeps),
CONFIG2 = lists:keyreplace(deps, 1, CONFIG1, {deps, NewDeps}),
CONFIG2 ++ [ {provider_hooks, [{pre, [ {ct, {yang, compile}} ]} ]}] ++ [Overrides];
false ->
case os:getenv("TRAVIS") of
"true" ->
JobId = os:getenv("TRAVIS_JOB_ID"),
CONFIG1 = lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId}),
{value, {plugins, Plugins}} = lists:keysearch(plugins, 1, CONFIG1),
lists:keystore(plugins, 1, CONFIG1, {plugins, Plugins ++ [rebar_coveralls]})
++ [{coveralls_coverdata, "logs/all.coverdata"},
{coveralls_service_name, "travis-ci"},
{plugin_dir, "deps/coveralls/src"}];
_ -> CONFIG
end
CONFIG.
case os:getenv("TRAVIS") of
"true" ->
JobId = os:getenv("TRAVIS_JOB_ID"),
CONFIG1 = lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId}),
JobId = os:getenv("TRAVIS_JOB_ID"),
lists:keystore(coveralls_service_job_id, 1, CONFIG, {coveralls_service_job_id, JobId});
_ -> CONFIG
end.

0 comments on commit 5fbe72d

Please sign in to comment.