Erlang Build Tools--系列2

转载:https://bitbucket.org/basho/rebar/wiki/Commands

Commands

Rebar provides support for the most commonly encountered development activities, include:

  • compilation
  • unit testing and coverage analysis
  • static analysis (through Dialyzer and Xref ).
  • documentation generation
  • dependency management

In addition, it allows for OTP embedded system generation, taking advantage of the template processing afforded by rebar and the reltool application.

The most common commands are:

Command Description
compile Compile all the available source in the project.
eunit Perform unit testing using the Eunit application
doc Generate documention using the Edoc application
clean Remove any generated artifacts from compilation, unit testing, etc.

Less commonly used commands (in alphabetical order):

Command Description
analyze Perform static analysis on the project using Dialyzer
build_plt Build the Dialyzer PLT; see the Dialyzer documentation for more details
check_plt Check whether the Dialyzer PLT is up-to-date, rebuilding it if necessary
create Create a prototypical project (described by the supplied template)
create-app Create a prototypical OTP application (described by the priv/templates/simpleapp.template template)
create-node Create a prototypical OTP embedded system (described by the priv/templates/simplenode.reltool.config template)
delete-deps Delete the downloaded source for dependencies specified in rebar.config
generate Use the Reltool application to construct an embedded system
get-deps Retrieve the source for dependencies specified in the rebar.config
xref Use the Xref application to analyze dependencies

Supported Source Formats

Rebar is capable of compiling a number of different source files via the "compile" command.

Source Target Description
src/*.erl ebin/*.beam Erlang source files
src/*.app.src ebin/*.app Erlang application specification
c_src/*.c priv/<app>.so C code for a port driver or NIF shared library
mibs/*.mib priv/mibs/*.bin SNMP mib files
src/*.xrl src/*.erl Leex analyzer generator files
src/*.yrl src/*.erl Yecc parser generator files
asn1/*.asn1 src/*.erl ASN-1 files
templates/*.dtl ebin/*_dtl.beam ErlyDTL template files (requires ErlyDTL to be installed)
src/*.lfe ebin/*.beam LFE source files (requires LFE to be installed)
src/*.peg ebin/*.beam Neotoma PEG grammars (requires Neotoma to be installed)
src/*.proto ebin/*_pb.beam, include/*_pb.hrl Protocol Buffers specifications (requires protobuffs to be installed)

Options

Options for the various commands are given in the rebar.config configuration file. They are listed, below.

Command Options Description
compile erl_first_files The list of erlang source files that should be compiled ahead of any other (for example, behavior modules)
compile erl_opts The options supported by the compile module, as described, here
compile mib_first_files The list of mib files that should be compiled ahead of any other (for example, RFC mibs which are referenced in a mib file's IMPORTS section)
compile src_dirs List of additional directories (beyond the src directory) containing Erlang source files
compile erlydtl_opts See ErlyDTL Templates for details on the supported options
clean clean_files List of files to delete; this is in addition to the files deleted by the clean command for a specific module
doc edoc_opts The options supported but the edoc module, as described, here
eunit eunit_opts The options supported but the eunit module, as described, here
eunit cover_enabled Enable coverage analysis of Erlang programs
eunit eunit_compile_opts Same options as erl_opts to be used for eunit specific compile settings in addition to erl_opts
analyze dialyzer_opts Specify alternative Dialyzer PLT file
build_plt dialyzer_opts Specify alternative Dialyzer PLT file
check_plt dialyzer_opts Specify alternative Dialyzer PLT file
get-deps, delete-deps base_dir Specify alternative base directory for deps_dir
get-deps, delete-deps deps_dir Specify alternative directory for storing deps
get-deps, delete-deps deps List of dependencies
generate target_dir Target directory
generate overlay_vars Overlay variables file
xref xref_warnings Enable xref warnings
xref xref_checks

The options supported by the xref module analyze/3 functions, as described, here

 

 

 

 

你可能感兴趣的:(Erlang Build Tools--系列2)