0
点赞
收藏
分享

微信扫一扫

rebar3 集成elixir 模块

社区包含了一个rebar3 的elixir mix 插件,可以方便rebar 使用elixir 模块

参考使用

  • rebar.config 配置

{erl_opts, [debug_info]}.
{deps, [
 % 添加引用
  {decimal, "2.0.0"}
]}.
 
{shell, [
    {apps, [basic]}
]}.
 
% 添加插件
 
{plugins, [rebar_mix]}.
 
{provider_hooks, [{post, [{compile, {mix, consolidate_protocols}}]}]}.
代码使用elixir 模块
basic_demo.erl
 
-module(basic_demo).
 
-export([demo/0]).
 
demo() ->
    % 注意是Elixir.  开头的
    Result = 'Elixir.Decimal':new(1, 42, -20),
    io:format("Result: ~w - ~n", [Result]).
调用
rebar3 shell 
basic_demo:demo().

{deps, [

效果

rebar3 集成elixir 模块_github

 

参考资料

https://rebar3.org/docs/configuration/plugins/#elixir-dependencies
https://github.com/tsloughter/rebar_mix
https://github.com/barrel-db/rebar3_elixir_compile
https://rebar3.org/docs/configuration/configuration/#hooks

举报

相关推荐

0 条评论