在rebar使用 構建系統時,可以手動建立一個rebar.config的檔案,通過這個檔案可以對rebar進行配置。
這個檔案中有兩個參數比較重要
%% Where to put any downloaded depandencies. Default is `deps’
在哪裡存放從網路上下載的依賴applications
?
實際上這個參數還有另外一層意思,就是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.
?
| 12345 |
{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的Regex的。這樣我們可以對依賴應用的版本進行控制
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/