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().

效果

 

参考资料

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

posted on   荣锋亮  阅读(22)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-12-27 databend minio 模式试用
2022-12-27 dremio fragment 执行简单说明
2022-12-27 dremio ExecutionPlanCreator 简单说明
2021-12-27 使用juicefs 让s3 更好兼容posix协议
2020-12-27 vlang 0.2 试用&&火焰图简单查看
2020-12-27 micro 试用
2020-12-27 micro cloud native 开发平台

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示