您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

267 行
8.3 KiB

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