1%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
2%% ex: ts=4 sw=4 ft=erlang et
3%% This is a sample rebar.conf file that shows examples of some of rebar's
4%% options.
5
6%% == Artifacts ==
7
8%% Artifacts are files generated by other tools (or plugins) and whose
9%% presence is necessary for a build to be considered successful
10{artifacts, ["priv/mycode.so"]}.
11
12
13%% == Erlang Compiler ==
14
15%% Erlang files to compile before the rest. Rebar automatically compiles
16%% parse_transforms and custom behaviours before anything other than the files
17%% in this list.
18{erl_first_files, ["src/mymib1.erl", "src/mymib2.erl"]}.
19
20%% Erlang compiler options
21{erl_opts, [no_debug_info,
22            {i, "myinclude"},
23            {platform_define,
24             "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'},
25            {platform_define, "(linux|freebsd)", 'BACKLOG', 128},
26            {platform_define, "R13", 'old_inets'}]}.
27
28{minimum_otp_vsn, "21.0"}.
29
30%% MIB Options?
31{mib_opts, []}.
32%% SNMP mibs to compile first?
33{mib_first_files, []}.
34
35%% leex options
36{xrl_opts, []}.
37%% leex files to compile first
38{xrl_first_files, []}.
39
40%% yecc options
41{yrl_opts, []}.
42%% yecc files to compile first
43{yrl_first_files, []}.
44
45%% == Application Discovery ==
46
47%% Extensions for discovering application resource files. Rebar3 discovers
48%% applications by searching for these files. When building the application
49%% information, rebar will use the first discovered files in the list.
50%% This configuration is intended to let profiles compose with special app
51%% files by prefixing extensions.
52{application_resource_extensions, [
53    ".app.src.script", ".app.src"
54]}
55
56%% == Common Test ==
57
58%% {erl_opts, [...]}, but for CT runs
59{ct_compile_opts, []}.
60%% {erl_first_files, ...} but for CT runs
61{ct_first_files, []}.
62%% Same options as for ct:run_test(Opts)
63{ct_opts, []}.
64
65
66%% == Cover ==
67
68%% Whether to enable coverage reporting where commands support cover. Default
69%% is `false'
70{cover_enabled, false}.
71
72%% Modules to exclude from cover
73{cover_excl_mods, []}.
74
75%% Options to pass to cover provider
76{cover_opts, [verbose]}.
77
78
79%% == Dependencies ==
80
81%% What dependencies we have, dependencies can be of 3 forms, an application
82%% name as an atom, eg. mochiweb, a name and a version (from the .app file), or
83%% an application name, a version and the SCM details on how to fetch it (SCM
84%% type, location and revision).
85%% Rebar3 currently supports git and hg
86{deps, [
87    app_name,         % latest version of package
88    {rebar, "1.0.0"}, % version 1.0.0 of a package
89    {rebar,           % git, master branch of app, explicit
90     {git, "git://github.com/rebar/rebar.git", {branch, "master"}}},
91    {rebar,           % git, over HTTPS
92     {git, "https://github.com/rebar/rebar.git", {branch, "master"}}},
93    {rebar,           % git, tag
94     {git, "https://github.com/rebar/rebar.git", {tag, "1.0.0"}}},
95    {rebar,           % git, specific reference/hash
96     {git, "https://github.com/rebar/rebar.git", {ref, "7f73b8d6"}}},
97    {rebar,           % mercurial is also supported
98     {hg, "https://github.com/rebar/rebar.git", {tag, "1.0.0"}}},
99    %% Alternative formats, backwards compatible declarations
100    {rebar,           % implicit master, will warn recommending explicit branch
101     {git, "git://github.com/rebar/rebar.git"}},
102    {rebar, "1.0.*",  % regex version check, ignored
103     {git, "git://github.com/rebar/rebar.git"}},
104    {rebar, "1.0.*",  % literal branch/ref/tag, will warn for explicit reference
105     {git, "git://github.com/rebar/rebar.git", "Rev"}},
106    {rebar, ".*",     % 'raw' dependency, argument ignored
107     {git, "git://github.com/rebar/rebar.git", {branch, "master"}},
108     [raw]}
109]}.
110
111
112%% == Dialyzer ==
113
114{dialyzer, [
115    {warnings, [underspecs, no_return]},
116    {get_warnings, true},
117    {plt_apps, top_level_deps}, % top_level_deps | all_deps
118    {plt_extra_apps, []},
119    {plt_location, local}, % local | "/my/file/name"
120    {plt_prefix, "rebar3"},
121    {base_plt_apps, [stdlib, kernel, crypto]},
122    {base_plt_location, global}, % global | "/my/file/name"
123    {base_plt_prefix, "rebar3"}
124]}.
125
126
127%% == Directories ==
128
129%% directory for artifacts produced by rebar3
130{base_dir, "_build"}.
131%% directory in '<base_dir>/<profile>/' where deps go
132{deps_dir, "lib"}.
133%% where rebar3 operates from; defaults to the current working directory
134{root_dir, "."}.
135%% where checkout dependencies are to be located
136{checkouts_dir, "_checkouts"}.
137%% where, under <base_dir>/<profile> checkout dependencies are to be built
138{checkouts_out_dir, "checkouts"}.
139%% directory in '<base_dir>/<profile>/' where plugins go
140{plugins_dir, "plugins"}.
141%% directories where OTP applications for the project can be located
142{project_app_dirs, ["apps/*", "lib/*", "."]}.
143%% Directories where source files for an OTP application can be found
144{src_dirs, ["src"]}.
145%% Paths to miscellaneous Erlang files to compile for an app
146%% without including them in its modules list
147{extra_src_dirs, []}.
148%% Path where custom rebar3 templates could be found
149{template_dir, []}.
150
151%% == EDoc ==
152
153%% EDoc options, same as those passed to the edoc compiler
154%% when called by hand.
155{edoc_opts, []}.
156
157
158%% == Escript ==
159
160%% name of the main OTP application to boot
161{escript_main_app, application}.
162%% Name of the resulting escript executable
163{escript_name, "application"}.
164%% Wrapper type(s) for escript executable on windows
165{escript_wrappers_windows, ["cmd","powershell"]}.
166%% apps (other than main and deps) to be included
167{escript_incl_apps, []}.
168%% Executable escript lines
169{escript_shebang, "#!/usr/bin/env escript\n"}.
170{escript_comment, "%%\n"}.
171{escript_emu_args, "%%! -escript main ~s -pa ~s/~s/ebin\n"}.
172
173
174%% == EUnit ==
175
176%% eunit:test(Tests)
177{eunit_tests, [{application, rebar3}]}.
178%% Options for eunit:test(Tests, Opts)
179{eunit_opts, [verbose]}.
180%% Additional compile options for eunit. erl_opts is also used
181{eunit_compile_opts, [{d, some_define}]}.
182%% {erl_first_files, ...} but for Eunit
183{eunit_first_files, ["test/test_behaviour.erl"]}.
184
185
186%% == Overrides ==
187
188{overrides, [
189    %% Add options to mydep's configurations for each element
190    {add, mydep, [{erl_opts, []}]},
191    %% replace mydep's configuration option
192    {override, mydep, [{erl_opts, []}]},
193    %% replace all dependencies' configuration options
194    {override, [{erl_opts, []}]}
195]}.
196
197%% == Pre/Post Shell Hooks ==
198
199%% Running shell commands before or after a given rebar3 command
200
201{pre_hooks, [{clean, "./prepare_package_files.sh"},
202             {"linux", compile, "c_src/build_linux.sh"},
203             {compile, "escript generate_headers"},
204             {compile, "escript check_headers"}]}.
205
206{post_hooks, [{clean, "touch file1.out"},
207              {"freebsd", compile, "c_src/freebsd_tweaks.sh"},
208              {eunit, "touch file2.out"},
209              {compile, "touch postcompile.out"}]}.
210
211%% == Provider Hooks ==
212
213%% Run a rebar3 command before or after another one.
214%% Only clean, ct, compile, eunit, release, and tar can be hooked around
215
216%% runs 'clean' before 'compile'
217{provider_hooks, [{pre, [{compile, clean}]}]}.
218
219
220%% == Releases ==
221
222{relx, [{release, {my_release, "0.0.1"},
223         [myapp]},
224
225        {dev_mode, true},
226        {include_erts, false},
227
228        {extended_start_script, true}]}.
229
230%% == Shell ==
231
232%% apps to auto-boot with `rebar3 shell'; defaults to apps
233%% specified in a `relx' tuple, if any.
234{shell, [{apps, [app1, app2]}, {script_file, "shell.escript"}]}.
235
236%% == xref ==
237
238{xref_warnings, false}.
239
240%% optional extra paths to include in xref:set_library_path/2.
241%% specified relative location of rebar.config.
242%% e.g. {xref_extra_paths,["../gtknode/src"]}
243{xref_extra_paths,[]}.
244
245%% xref checks to run
246{xref_checks, [undefined_function_calls, undefined_functions,
247               locals_not_used, exports_not_used,
248               deprecated_function_calls, deprecated_functions]}.
249
250%% Optional custom xref queries (xref manual has details) specified as
251%%     {xref_queries, [{query_string(), expected_query_result()},...]}
252%% The following for example removes all references to mod:*foo/4
253%% functions from undefined external function calls as those are in a
254%% generated module
255{xref_queries,
256 [{"(XC - UC) || (XU - X - B"
257   " - (\"mod\":\".*foo\"/\"4\"))",[]}]}.
258
259%% You might want to exclude certains functions or modules from your
260%% rebar3 xref analysis.
261%% You can do so with the following option, that takes as list items
262%% one or more of a combination of:
263%% * module(),
264%% * {module(), function()},
265%% * {module(), function(), arity()}
266{xref_ignores, []}.
267
268%% == alias ==
269
270%% When you want a certain combination of operations to be done
271%% as if you were using a rebar3 command. In the example below:
272%% > rebar3 check
273%%   (equivalent to rebar3 do xref, dialyzer)
274%% or
275%% > rebar3 test
276%%   (equivalent to rebar3 do eunit, ct --suite=rebar_alias_SUITE, cover)
277
278{alias, [{check, [xref, dialyzer]},
279         {test, [eunit, {ct, "--suite=rebar_alias_SUITE"}, cover]}]}.
280