现在的位置: 首页 > 综合 > 正文

rebar rebar.config

2013年09月08日 ⁄ 综合 ⁄ 共 1123字 ⁄ 字号 评论关闭

在rebar使用 构建系统时,可以手动创建一个rebar.config的文件,通过这个文件可以对rebar进行配置。

这个文件中有两个参数比较重要

%% Where to put any downloaded depandencies. Default is `deps’

在哪里存放从网络上下载的依赖applications

1
{deps_dir, ["deps"]}.

实际上这个参数还有另外一层意思,就是deps_dir,中所指定的目录,可以用做当前的项目依赖项目的存储目录。

在使用rebar进行构建时,rebar会在deps_dir指定的目录中去查找相关的依赖。

%% What dependancies we have, depandencies can be of 3 forms, an application

%% name as an atom, eg. mochiweb, a name and a version (from the .app file), or

%% an application name, a version and the SCM details on how to fetch it (SCM

%% type, location and revision). Rebar currently support git, hg, bzr and svn.

1
2
3
4
5
{deps, [application_name,
  
        {application_name, "1.0.*"},
  
        {application_name, "1.0.*", {hg, "http://bitbucket.org/basho/rebar/", "f3626d5858a6"}}]}.

deps参数的说明很清楚,rebar是支持从scm系统中获取依赖项目的。

从scm中获取的依赖将存储到deps_dir所指定的目录中。当前支持hg,svn,hg,bzr四种scm。

同时deps参数是支持erlang的正则表达式的。这样我们可以对依赖应用的版本进行控制

rebar还能够支持对driver代码的编译,虽说支持的不是很完整。

我们可以通过port_pre_script所指定的脚本对c/c++的编译进行扩展

%% Tuple which specifies a pre-compilation script to run, and a filename that

%% exists as a result of the script running.

1
{port_pre_script, {"script.sh", "skipfile"}}.

这样一个erlang项目的搭建就不算是太大的问题了

 

转载:http://www.erlangsir.com/2011/05/27/rebar-rebar-config/

抱歉!评论已关闭.