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

150 行
5.1 KiB

  1. rebar
  2. =====
  3. rebar is an Erlang build tool that makes it easy to compile and test Erlang
  4. applications, port drivers and releases.
  5. [![Build Status](https://travis-ci.org/rebar/rebar3.svg?branch=rebar3)](https://travis-ci.org/rebar/rebar3)
  6. rebar is a self-contained Erlang script, so it's easy to distribute or even
  7. embed directly in a project. Where possible, rebar uses standard Erlang/OTP
  8. conventions for project structures, thus minimizing the amount of build
  9. configuration work. rebar also provides dependency management, enabling
  10. application writers to easily re-use common libraries from a variety of
  11. locations (git, hg, etc).
  12. 3.0
  13. ====
  14. This is an experimental branch.
  15. ### Commands
  16. | Command | Description |
  17. |----------- |------------ |
  18. | compile | Build project |
  19. | clean | Remove project apps beam files |
  20. | ct | Run Common Test suites |
  21. | do | Higher-order provider to run multiple tasks in sequence |
  22. | dialyzer | Run the Dialyzer analyzer on the project |
  23. | eunit | Run eunit tests |
  24. | help | Print help for rebar or task |
  25. | new | Create new rebar project from templates |
  26. | pkgs | List available packages |
  27. | release | Build release of project |
  28. | shell | Run shell with project apps in path |
  29. | tar | Package release into tarball |
  30. | update | Update package index |
  31. | upgrade | Fetch latest version of dep |
  32. | version | Print current version of Erlang/OTP and rebar |
  33. ### Changes
  34. * Fetches and builds deps if missing when running any command that relies on them
  35. * Automatically recognizes `apps` and `lib` directory structure
  36. * `escriptize` requires `escript_top_level_app` set in `rebar.config`
  37. * Relx for releases
  38. ### Gone
  39. * Reltool integeration
  40. ### Providers
  41. Providers are the modules that do the work to fulfill a user's command.
  42. Example:
  43. ```erlang
  44. -module(rebar_prv_something).
  45. -behaviour(rebar_provider).
  46. -export([init/1,
  47. do/1]).
  48. -define(PROVIDER, something).
  49. -define(DEPS, []).
  50. %% ===================================================================
  51. %% Public API
  52. %% ===================================================================
  53. -spec init(rebar_state:state()) -> {ok, rebar_state:state()}.
  54. init(State) ->
  55. State1 = rebar_state:add_provider(State, rebar_provider:create([{name, ?PROVIDER},
  56. {module, ?MODULE},
  57. {bare, false},
  58. {deps, ?DEPS},
  59. {example, "rebar dummy"},
  60. {short_desc, "dummy plugin."},
  61. {desc, ""},
  62. {opts, []}])),
  63. {ok, State1}.
  64. -spec do(rebar_state:state()) -> {ok, rebar_state:state()}.
  65. do(State) ->
  66. %% Do something
  67. {ok, State}.
  68. ```
  69. Building
  70. --------
  71. Recommended installation of [Erlang/OTP](http://www.erlang.org) is binary packages from [Erlang Solutions](https://www.erlang-solutions.com/downloads/download-erlang-otp). For source it is recommended you use [erln8](http://metadave.github.io/erln8/) or [kerl](https://github.com/yrashk/kerl).
  72. ### Dependencies
  73. To build rebar you will need a working installation of Erlang R15 (or later).
  74. Should you want to clone the rebar repository, you will also require git.
  75. #### Downloading
  76. You can download a pre-built binary version of rebar3 based on the last commit from:
  77. https://s3.amazonaws.com/rebar3/rebar3
  78. #### Building rebar
  79. ```sh
  80. $ git clone git://github.com/tsloughter/rebar.git
  81. $ cd rebar
  82. $ ./bootstrap/bootstrap
  83. ==> rebar (compile)
  84. Congratulations! You now have a self-contained script called "rebar" in
  85. your current working directory. Place this script anywhere in your path
  86. and you can use rebar to build OTP-compliant apps.
  87. ```
  88. Contributing to rebar
  89. =====================
  90. Please refer to [CONTRIBUTING](CONTRIBUTING.md).
  91. Community and Resources
  92. -----------------------
  93. In case of problems that cannot be solved through documentation or examples, you
  94. may want to try to contact members of the community for help. The community is
  95. also where you want to go for questions about how to extend rebar, fill in bug
  96. reports, and so on.
  97. The main place to go for questions is the [rebar mailing
  98. list](http://lists.basho.com/pipermail/rebar_lists.basho.com/). If you need
  99. quick feedback, you can try the #rebar channel on
  100. [irc.freenode.net](http://freenode.net). Be sure to check the
  101. [wiki](https://github.com/rebar/rebar/wiki) first, just to be sure you're not
  102. asking about things with well known answers.
  103. For bug reports, roadmaps, and issues, visit the [github issues
  104. page](https://github.com/rebar/rebar/issues).
  105. General rebar community resources and links:
  106. - [Rebar Mailing List](http://lists.basho.com/pipermail/rebar_lists.basho.com/)
  107. - #rebar on [irc.freenode.net](http://freenode.net/)
  108. - [wiki](https://github.com/rebar/rebar/wiki)
  109. - [issues](https://github.com/rebar/rebar/issues)