4.5.3. rebar3配置¶
实例化配置:
{erl_opts, [debug_info]}.
{rebar_packages_cdn, "https://hexpm.upyun.com"}. % package中国镜像
{deps, []}.
{relx, [{release, { bbb, "0.1.0" },
[bbb,
sasl]},
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{dev_mode, true},
{include_erts, false},
{extended_start_script, true}]
}.
{profiles, [{prod, [{relx, [{dev_mode, false},
{include_erts, true}]}]
}]
}.
配置文件:
{include_erts, false}, // erts
{system_libs, false}, // 系统库
// 指定库地址
{include_erts, "/path/to/erlang"},
{system_libs, "/path/to/erlang"},
// 包含相关
{include_src, false}, // 源码
{exclude_apps, [app1, app2]}, // 发布时排除
{exclude_modules, [ // 模块排除
{app1, [app1_mod1, app1_mod2]},
{app2, [app2_mod1, app2_mod2]}
]}.
实例:
1{erl_opts, [
2 {src_dirs, ["src", "test"]},
3 ,warn_unused_vars
4 ,warn_export_all
5 ,warn_shadow_vars
6 ,warn_unused_import
7 ,warn_unused_function
8 ,warn_bif_clash
9 ,warn_unused_record
10 ,warn_deprecated_function
11 ,warn_obsolete_guard
12 ,strict_validation
13 ,warn_export_vars
14 ,warn_exported_vars
15 ,warn_missing_spec
16 ,warn_untyped_record
17 ,debug_info
18 ,{parse_transform, lager_transform}
19]}.
20
21{rebar_packages_cdn, "https://hexpm.upyun.com"}.
22
23
24{deps_dir, "deps"}.
25{deps, [
26 lager
27 ,{mongodb, {git, "https://github.com/comtihon/mongodb-erlang.git", {tag, "v3.2.0"}}}
28 ,{eredis_pool, {git, "https://github.com/hiroeorz/eredis_pool.git", {branch, "master"}}}
29 ,{brod, {git, "https://github.com/klarna/brod.git", {tag, "3.5.2"}}}
30 ,{worker_pool, {git, "https://github.com/inaka/worker_pool.git", {tag, "3.1.1"}}}
31 ,{cowboy, {git, "https://github.com/ninenines/cowboy.git", {tag, "2.4.0"}}}
32
33]}.
34
35
36
37{escript_main_app, observer_cli}.
38{escript_emu_args, "%%! -escript main observer_cli_escriptize -hidden +sbtu +A0 -elixir ansi_enabled true\n"}.
39{escript_incl_apps, [recon]}.
40
41
42
43{dialyzer_opts, [{warnings,
44 [unmatched_returns, error_handling, race_conditions, behaviours]}
45]}.
46
47
48{edoc_opts, [
49 {report_missing_types, true},
50 {source_path, ["src"]},
51 {report_missing_types, true},
52 {todo, true},
53 {packages, false},
54 {subpackages, false}
55]}.
56
57
58{xref_checks, [undefined_function_calls]}.
59{cover_enabled, true}.
60
61
62{post_hooks, [
63 {"(linux|darwin|solaris)", edoc, "escript doc/docsite.erl"}
64]}.
65
66
67
68
69{relx, [
70 {release,
71 { demo_erlang, "0.1.0" },
72 [
73 cowboy,
74 lager,
75 demo_erlang,
76 sasl
77 ]
78 },
79 {release,
80 { demo_lager, "0.1.0" },
81 [
82 observer_cli,
83 lager,
84 demo_lager,
85 sasl
86 ]
87 },
88
89 {sys_config, "./config/sys.config"},
90 {vm_args, "./config/vm.args"},
91
92 {dev_mode, true},
93 {include_erts, false},
94
95 {extended_start_script, true}
96]}.
97
98{profiles, [
99 {prod, [{relx, [
100 {dev_mode, false},
101 {include_erts, true}
102 ]}]},
103 {cowboy, [{relx, [
104 {release,
105 { demo_erlang, "0.1.0" },
106 [
107 cowboy,
108 demo_erlang,
109 sasl
110 ]
111 },
112 {dev_mode, false}
113 ]}]},
114 {lager, [{relx, [
115 {dev_mode, false}
116 ]}]}
117 ]
118}.