Commit graph

1029 commits

Author SHA1 Message Date
Ulf Wiger
6996cd4fcc Use a more appropriate method to check reltool's vsn
If running e.g. rebar generate using an OTP development build,
rebar will complain that reltool has the version "", which is
less than the required "0.5.2". This is because rebar_reltool
simply checks the path returned by code:which(reltool), which
doesn't yield version information if used in a development build.

This patch substitutes a more robust method (load reltool and
fetch the info from application:loaded_applications()).

As it happens, this will not be enough to make things work,
but now Reltool will explain that it cannot generate a spec
from a system that is not installed, giving a better hint
as to what needs to be done.
2012-07-21 17:52:01 +02:00
Tuncer Ayaz
5a4ddd5524 Do not keep eunit config 2012-07-13 22:48:20 +02:00
Tuncer Ayaz
e1c9d69d1d Do not use rebar_config:set_global in rebar_templater 2012-07-13 21:43:30 +02:00
Tuncer Ayaz
d9e6cc3d90 Do not use process dict in rebar_templater 2012-07-13 21:43:14 +02:00
Tuncer Ayaz
4fe3306d99 Document rebar_config TODOs 2012-07-13 15:22:01 +02:00
Tuncer Ayaz
db78956295 Make sure cached setup_envs are reset 2012-07-13 15:22:01 +02:00
Tuncer Ayaz
e185e86bff Remove shared state 2012-07-13 15:21:56 +02:00
Tuncer Ayaz
1948eb4a47 Re-word comment 2012-07-12 00:39:30 +02:00
Tuncer Ayaz
94958d05d5 Add missing comment in rebar_erlc_compiler 2012-07-12 00:37:10 +02:00
Tuncer Ayaz
e4fb80799b Remove debug log 2012-07-11 23:40:28 +02:00
Tuncer Ayaz
015858b2d3 Simplify eunit 2012-07-11 20:36:41 +02:00
Tuncer Ayaz
990e60f120 Use filename:join 2012-07-11 18:44:48 +02:00
Dave Smith
ce39b1d8bd Merge pull request #157 from dch/dch-windows-msvc-support
add native Windows compiler support
2012-07-11 07:58:51 -07:00
Kresten Krab Thorup
4541f8f5db Fix crazy indentation :-) 2012-07-11 08:42:48 -06:00
Kresten Krab Thorup
b890421cae Allow crypto to already be loaded when starting rebar 2012-07-11 08:42:48 -06:00
Kresten Krab Thorup
c71bbf6a0d untabify and add some comments 2012-07-11 08:42:48 -06:00
Kresten Krab Thorup
5b765e028f Initial version of "rebar shell" command
For now, this is just a proof of concept; would make sense to add a lot
of things, such as quick access to invoking rebar itself (with approproate 
code reloading), as well as an eunit-aware version so that tests could be 
run interactively.
2012-07-11 08:42:47 -06:00
Fred Hebert
57fc7f6474 Change escriptize archive permissions to a+x
By default, executables in paths such as /bin and /usr/local/bin have
the mode saying they can be executed by all.

The current version of escriptize only sets u+x, which creates problems
when copied directly in repositories and requiring other programs to
interact with them.

This change makes rebar follow the standard of linuxes and unixes by
setting the permission flag to a+x, allowing users, the group and others
to execute it.
2012-07-10 10:42:41 +02:00
Eric B Merritt
ec3927f9b0 Fix eunit testing of apps that have no erl files
'Erlang' projects that do not contain any erlang files (Joxa, LFE,
Elixir, etc) break the eunit task. It attempts to copy an empty list
of source files to the .eunit directory. This change makes copying an
empty list a simple no-op.
2012-07-03 15:18:09 +02:00
Tuncer Ayaz
f5af9d6c21 Fix rebar_eunit whitespace issues 2012-07-02 19:23:25 +02:00
Tuncer Ayaz
9521d3fd86 Clean up rebar_utils exports 2012-07-02 19:13:11 +02:00
Tuncer Ayaz
df9b77633a Move erl_opts/1 and src_dirs/1 to proper place 2012-07-02 18:47:06 +02:00
Motiejus Jakštys
ad2f30ccb9 Fix cover crash if src_dirs is not default
Make sure files from erl_opts->src_dirs are copied to .eunit for cover
inspection.

Without this patch cover failed to find source files which were in
src_dirs, and threw the following exception:

ERROR: eunit failed while processing
/path/to/project:
{'EXIT',{{badmatch,{error,no_source_code_found}},
         [{rebar_eunit,'-cover_analyze/3-fun-0-',1,
                       [{file,"src/rebar_eunit.erl"},{line,280}]},
          {lists,foreach,2,[{file,"lists.erl"},{line,1262}]},
          {rebar_eunit,cover_analyze,3,
                       [{file,"src/rebar_eunit.erl"},{line,279}]},
          {rebar_eunit,eunit,2,[{file,"src/rebar_eunit.erl"},{line,140}]},
          {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,425}]},
          {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,359}]},
          {rebar_core,process_dir0,6,[{file,"src/rebar_core.erl"},{line,223}]},
          {rebar_core,process_dir,4,
                      [{file,"src/rebar_core.erl"},{line,130}]}]}}

Now all source files are copied to .eunit.
2012-07-02 18:46:00 +02:00
Motiejus Jakštys
394c0f43f8 Move erl_opts/1 and src_dirs/1 to rebar_utils.erl
These functions will be necessary in rebar_eunit.erl, too.
2012-07-02 18:46:00 +02:00
Tuncer Ayaz
fd0697239d Use lists:foreach because result is ignored 2012-06-30 23:17:22 +02:00
Tuncer Ayaz
385e3f09ba Decrease indentation in list-templates printout 2012-06-30 22:28:30 +02:00
Tuncer Ayaz
49f3cc4108 Fix crash introduced in 4414f65 via pull/245 2012-06-30 22:14:08 +02:00
Tuncer Ayaz
0c27fd4f7f rebar_templater: fix comment 2012-06-30 22:13:26 +02:00
Daniel Luna
d560ccda0d Use ~p for file:consult/1 {error, Reason} printout 2012-06-29 21:39:20 +02:00
Tuncer Ayaz
4e9e89bd0d Append os family to arch string 2012-06-23 22:05:43 +02:00
Tuncer Ayaz
c41fda6a2f rebar_utils: move internal fun to proper place 2012-06-23 22:00:38 +02:00
Evan Vigil-McClanahan
a78e6cd740 Add support for minimum OTP versions.
Since you can't really do math with regexps and it's a pain to
repeatedly update the config for each new version or erlang, I wanted
to add support for minium OTP versions.  This is a fix for
https://github.com/basho/riaknostic/issues/38
2012-06-21 14:44:51 -07:00
Tuncer Ayaz
4fc3e9bfb6 Add missing comment 2012-06-21 23:01:32 +02:00
Tuncer Ayaz
8bb62032a0 Update -c string 2012-06-21 21:28:34 +02:00
Tuncer Ayaz
e6165c7146 Fix #252 (Reported-by: Maxim-Vladimirsky) 2012-06-21 00:08:51 +02:00
Tuncer Ayaz
b9c6888883 rebar_ct: rename function for clarity 2012-06-21 00:06:40 +02:00
Yurin Slava
7bef458163 Add support for errors without line number 2012-06-18 12:09:58 +02:00
Tuncer Ayaz
3dce05314b Fix rebar_eunit comments 2012-06-18 00:55:51 +02:00
Tuncer Ayaz
c91250d2df Use [{File,Bin}, ...] in escriptize zip:create 2012-06-17 23:03:29 +02:00
Tuncer Ayaz
83879c22e1 Add missing escriptize comments 2012-06-17 22:57:33 +02:00
Tuncer Ayaz
0f961d86c6 Fix #247 (Reported-by: Uvarov Michael) 2012-06-17 16:11:59 +02:00
Tuncer Ayaz
d7037165fd Remove debug log 2012-06-15 19:42:11 +02:00
Tuncer Ayaz
e65455b6ef Simplify temp dir creation 2012-06-14 23:59:36 +02:00
Tuncer Ayaz
1e980859e2 Extend escriptize and reuse in bootstrap 2012-06-14 23:46:55 +02:00
Tuncer Ayaz
8fb552b73f Sync rebar_escripter with bootstrap escript 2012-06-14 23:46:55 +02:00
Tuncer Ayaz
c1a891ce33 Remove gratuitous lists:append/1 2012-06-12 23:40:42 +02:00
Tuncer Ayaz
8e66225e06 Fix error/warning newlines (Reported-by: Tim Watson) 2012-06-12 15:13:20 +02:00
Tuncer Ayaz
8a2274b8b4 Refactor shared error reporting code 2012-06-11 19:42:00 +02:00
Tuncer Ayaz
0716cf708c Add support for {Line,Column} in error reports 2012-06-11 19:42:00 +02:00
Tuncer Ayaz
c3fc279ff9 Manually format lfe errors/warnings 2012-06-11 19:42:00 +02:00
Tuncer Ayaz
658f4847a2 Report warnings as errors if -Werror is enabled 2012-06-11 19:41:51 +02:00
Tuncer Ayaz
dff60918cb Share format_errors/format_warnings functions 2012-06-11 19:40:59 +02:00
Tuncer Ayaz
4e64e0c675 Manually format port_compiler errors with absolute path 2012-06-11 19:40:59 +02:00
Tuncer Ayaz
4b9fcda7ab Manually format leex/yecc errors/warnings 2012-06-11 19:40:59 +02:00
Tuncer Ayaz
50fbabda68 Manually report errors/warnings with absolute path 2012-06-11 19:40:59 +02:00
Tuncer Ayaz
8d81b322ed Fix whitespace errors 2012-06-11 19:33:16 +02:00
hirschen
4414f6548a List substitution variable names in 'list-templates' command. 2012-06-11 15:01:12 +02:00
Tuncer Ayaz
b1d06a4d14 Fix unsafe use of var 2012-06-08 22:14:32 +02:00
Tuncer Ayaz
8a046d898a Fix whitespace errors 2012-06-08 21:56:18 +02:00
Dave Smith
9ec6f37444 Merge pull request #230 from hyperthunk/ct-name
Support ct_run using short name
2012-06-08 07:11:00 -07:00
Dave Cottlehuber
83509e9982 Windows: add native SDK support
- compatible with rebar 2.0.0
2012-06-08 15:47:39 +02:00
Dave Smith
a7d64deb43 Introduce -k flag 2012-06-08 07:06:15 -06:00
Dave Smith
ebdb25c5cc Use delayed_halt everywhere 2012-06-08 07:06:15 -06:00
Dave Smith
c86c99940d Remove ?FAIL in favor of ?ABORT 2012-06-08 07:06:15 -06:00
Tuncer Ayaz
c122eeec75 Fix whitespace errors 2012-06-07 15:34:36 +02:00
Dave Smith
2f0e545ce0 Prefer edoc-info as determining file; overview-summary.html may not
always be generated
2012-06-06 11:56:49 -06:00
Dave Smith
81112cbd07 Only regenerate edocs if a source file is newer than
overview-summary.html
2012-06-06 10:00:56 -06:00
Dave Smith
0f24d93256 Move to major.minor.patch release version; add OTP build version
version info
2012-06-04 08:46:17 -06:00
Tuncer Ayaz
f7d9a9bf8b Fix whitespace errors 2012-06-01 11:45:56 +02:00
Yurin Slava
e4bc95500c Fix #232 (rebar_reltool:mk_target_dir) 2012-06-01 11:38:23 +02:00
Tim Watson
bebd9d2ae6 Support ct_run using short name
Not every system under test can be run with long names, and this makes
rebar's common_test support useless in those environments, as it
currently uses long names (test@hostname.domain) by default, without
recourse to change them.

This patch adds support for a {ct_use_short_names, boolean()} config
variable, which allows the user to specify whether short or long names
are required.
2012-05-22 15:50:26 +01:00
Tuncer Ayaz
15d1c275f8 Simplify and fix check if enter/leaving should be printed 2012-05-18 20:14:33 +02:00
Tuncer Ayaz
4f6ea2fd11 Do not print entering/leaving message if skip_dir 2012-05-18 19:56:02 +02:00
Tuncer Ayaz
635d1a9456 Fix file extension bug (Reported-by: Tony Rogvall) 2012-05-14 22:26:42 +02:00
Nick Vatamaniuc
8d82330802 Add rsync as another option to fetch dependencies
Newly added syntax:

{deps, [ {<depname>, ".*", {rsync, "<rsync_url>"}}, ... ]}

Where rsync_url is any URL accepted by the rsync command.
2012-05-14 10:04:41 +02:00
Tuncer Ayaz
32ddef7158 Remove alt_url support in favor of new features 2012-05-13 19:30:38 +02:00
Tuncer Ayaz
e6d5a494b0 Clarify use of git describe 2012-05-11 23:57:38 +02:00
Tuncer Ayaz
dc472bd958 Do not use inherited port options 2012-04-23 23:14:03 +02:00
Tuncer Ayaz
b2fdce8879 Use dict() instead of proplist() for shared env 2012-04-23 23:13:55 +02:00
Ulf Wiger
afffb4895a Use correct value for file:script SCRIPT binding 2012-04-17 20:36:03 +02:00
Tuncer Ayaz
9c1a877bbe Remove gratuitous blank line 2012-04-17 19:15:47 +02:00
Ulf Wiger
c3c64c1d70 Fix file:script support 2012-04-17 00:14:33 +02:00
Tuncer Ayaz
7c418ed2b4 Add support for target-specific port options
{port_specs, [{".*", "priv/foo.so", ["c_src/foo.c"], [{env, []}]}]}.
2012-04-16 23:17:24 +02:00
Ulf Wiger
b3e9e76f57 Use file:script if a .config.script file present 2012-04-16 22:44:48 +02:00
Tuncer Ayaz
fc83f4b961 Apply Tidier suggestion 2012-04-16 22:09:20 +02:00
Tuncer Ayaz
aeb3081111 Update getopt.erl 2012-04-16 18:02:48 +02:00
Tuncer Ayaz
0e7defaf64 Fix typo in comment (thanks Michael Santos) 2012-04-16 17:42:48 +02:00
Tuncer Ayaz
7864b81e2d Update getopt.erl 2012-04-09 14:36:05 +02:00
Tuncer Ayaz
ae178b851b Fix #209 (Reported-by: Bjorn Bylander)
Use correct ERL_LIBS separator on Windows.
2012-04-04 17:44:36 +02:00
Tuncer Ayaz
4a9dae76a4 Fix #197 by printing 'Entering/Leaving directory' 2012-04-03 20:54:34 +02:00
Amit Kapoor
63f1b1d9d5 Use lists:member/2 to check xref results 2012-04-02 19:14:37 +02:00
Amit Kapoor
0191806f92 Add support for custom xref queries
The custom queries are configured in rebar.config via the tuple
{xref_queries, [{query(), query_result()},...]}.  The implementation
passes the query() string to xref:q and compares the return value with
query_result(). It will result in an error if they do not match.

The following configuration, for example, is the same as running the
xref check undefined_function_calls. It additionally filters
ejabberd_logger:*_msg/4 from the result as these functions are generated
on execution by ejabberd and not available at compile time.

{xref_queries, [{"(XC - UC) || (XU - X - B -
                 (\"ejabberd_logger\":\".*_msg\"/\"4\"))",[]}]}.

This patch also modifies the build process of this package by running a
custom query instead of doing a diff against a static xref_warning file.
2012-04-02 19:14:37 +02:00
Tuncer Ayaz
7bd8cbd8d9 Make error message more descriptive 2012-03-31 19:21:41 +02:00
Adam Schepis
03a026f38f Add support for alternate dependency urls
This change adds the ability to use alternate urls for downloading
dependencies. To make use of alternate urls run:
rebar get-deps alt_urls=true
2012-03-31 19:21:25 +02:00
Ali Yakout
e0d9ca0773 asn1_compiler: only move hrl file if it exists 2012-03-30 16:58:07 +02:00
Tuncer Ayaz
3f14c1c092 Skip erlang:halt/1 workaround if >=R15B01 2012-03-27 14:19:54 +02:00
Tuncer Ayaz
b6fadef5d3 Fix whitespace errors 2012-03-18 18:51:08 +01:00
Loïc Hoguin
2c37270f52 Fix badarg crashes on missing dependency errors 2012-03-18 18:46:04 +01:00
Tuncer Ayaz
9d5557b16f Deprecate port_envs in favor of port_env 2012-03-09 20:21:26 +01:00
Юрин Вячеслав
0424d75d78 Make rebar understand wildcard in subdir
If you have dir with many erlang app, then you can simple write
{sub_dirs, ["some_dir/*"]}. Rebar will make operation on subdirs of
dir "some_dir".
2012-03-09 19:38:34 +01:00
Tuncer Ayaz
4e0c9506f5 Fix src_dirs option to not hard-code "src" 2012-02-24 18:06:52 +01:00
Jesse Gumm
33546cc402 Fix copying dir to non-existing dir in Win32 2012-02-20 19:23:35 +01:00
Jesse Gumm
4f6f41cabb Fix typos in rebar_templater 2012-02-17 12:41:34 +01:00
Tuncer Ayaz
da122b3e57 Add rebar_utils:delayed_halt/1 2012-02-16 19:17:58 +01:00
Phil Toland
8b486055e4 Fix compiling DTL templates with latest erlydtl
The latest version of erlydtl requires that custom tag modules be in
the path when templates are compiled. Without this change rebar silently
exits when using the custom_tags_modules option.
2012-02-16 11:40:57 +01:00
Jeremy Raymond
7e84634b8f Fix for destruction of config app vars on reset 2012-02-15 21:11:57 +01:00
Tuncer Ayaz
1a613d6123 Remove debug log 2012-02-12 18:43:40 +01:00
Tuncer Ayaz
b48cc0c7eb Fix regression in port_compiler needs_link check 2012-02-10 23:02:53 +01:00
Shunichi Shinohara
ebb2345071 Treat callback attributes same as behaviour_info
Automatically include modules with callback attributes in
erl_first_files.
2012-02-10 10:26:16 +01:00
Tuncer Ayaz
1c1a32b8ba Use lists:flatmap/2 2012-02-07 20:11:50 +01:00
Yurin Slava
5a640a92fd Remove unused include_lib directive 2012-02-04 11:28:12 +01:00
Tuncer Ayaz
b7fb2aeec6 Fix loading of local plugins in sub directories 2012-02-03 17:37:41 +01:00
Tuncer Ayaz
6898eff2c7 Rework port compiler support
* consolidate options
 * add support for building executables
2012-02-03 16:26:14 +01:00
Tuncer Ayaz
ba538094ba Extend rebar_utils:deprecated 2012-02-03 10:17:58 +01:00
Tuncer Ayaz
a176db6937 Fix Dialyzer (race condition) warning 2012-02-02 22:54:40 +01:00
Yurii Rashkovskii
fe1652e137 Cache vsn info to avoid expensive vcs cmd calls 2012-02-02 21:54:15 +01:00
Tuncer Ayaz
b6f3a76694 Imported new mustache.erl 2012-01-31 21:12:59 +01:00
Tuncer Ayaz
440fa6bd31 Only print sh/2 options on debug log level 2012-01-29 17:55:30 +01:00
Tuncer Ayaz
194f3caa3f Fix -D and -v handling with new getopt.erl 2012-01-29 17:48:55 +01:00
Tuncer Ayaz
c4e40714ee Import fixed upstream getopt.erl 2012-01-29 17:45:03 +01:00
Tuncer Ayaz
2a5320fbd6 Document verbosity level 2012-01-17 17:04:07 +01:00
Tuncer Ayaz
2cae2950c4 Fix whitespace errors 2012-01-17 17:04:07 +01:00
Tuncer Ayaz
e6caab00d5 Use ?ERROR where appropriate 2012-01-17 17:04:07 +01:00
Tuncer Ayaz
015e58201c Support different log levels 2012-01-17 17:04:07 +01:00
Tuncer Ayaz
263b49f970 Import new upstream getopt.erl 2012-01-17 17:04:07 +01:00
Tuncer Ayaz
ee44d8554a Fix whitespace errors 2012-01-17 17:04:07 +01:00
Francis Joanis
b498e86ef7 Delete existing erl files in ?EUNIT_DIR
Before copying the .erl files to the .eunit directory ensure that they
are deleted if they already exist. This prevents EACCES errors to happen
when trying to re-copy .erl files that are read-only.
2012-01-17 16:54:27 +01:00
Tuncer Ayaz
41d6abc64d Fix whitespace errors 2012-01-13 19:56:10 +01:00
Tuncer Ayaz
5b15c851d8 Check for .app.src first 2012-01-13 19:39:28 +01:00
Tuncer Ayaz
eab5ae5298 Fix code clarity in dir type check 2012-01-13 19:00:44 +01:00
Tuncer Ayaz
0689928527 Warn if we ignore a skip_dir's sub_dirs 2012-01-13 18:25:02 +01:00
Tuncer Ayaz
cab1671ea0 Add missing newline for logging code path update 2012-01-13 18:18:51 +01:00
Tuncer Ayaz
45555eb6ae Ignore sub_dirs in skip_dirs 2012-01-10 11:24:09 +01:00
Tuncer Ayaz
87669b6b7f Clean up rebar_utils 2012-01-10 11:15:55 +01:00
Tuncer Ayaz
4d2d3c3af3 Remove port_first_files support 2012-01-09 13:05:23 +01:00
Tuncer Ayaz
2be2f2bfe7 Fix whitespace errors 2012-01-09 12:43:09 +01:00
Tuncer Ayaz
4e471e6986 Fix Dialyzer warning 2012-01-09 12:42:53 +01:00
Matt Campbell
c15d99d8bb On windows, avoid symlink during upgrade
a) make_symlink throws "not supported" on OS < Vista (e.g. 2003)
b) tarball creation stores windows symlinks as absolute paths
   instead of relative, causing service to fail to start after upgrade
   is made permanent.
2012-01-09 12:33:39 +01:00
Magnus Klaar
4db90bafef Deprecate ct suite= option for suites= option 2012-01-06 20:40:46 +01:00
Tuncer Ayaz
1daa15293a Reverse order in rebar_utils:get_deprecated_global/3 2012-01-06 19:50:20 +01:00
Tuncer Ayaz
27e5a0ae5b Cleanup and simplify deprecated option handling 2012-01-01 15:10:35 +01:00
Tomas Abrahamsson
c8f56c7cb2 Don't kill any inet_gethost_native after eunit
Avoid error reports like this one:

  prompt$ rebar eunit
  ==> dummy (eunit)
    Test passed.

  =ERROR REPORT==== 29-Dec-2011::23:22:11 ===
  ** Generic server inet_gethost_native_sup terminating
  ** Last message in was {'EXIT',<0.62.0>,killed}
  ** When Server state == {state,inet_gethost_native,undefined,<0.62.0>,
                                 {local,inet_gethost_native_sup}}
  ** Reason for termination ==
  ** killed

Previously, it could happen if an eunit test did something that
required a name lookup, like in this example:

  -module(dummy_tests).
  -include_lib("eunit/include/eunit.hrl").

  x_test() ->
      {ok, _Hostent} = inet:gethostbyname(localhost).

The inet_gethost_native is a process, started on demand, under a
supervisor_bridge under the kernel_sup, but it is not a gen_server
process or the like, so it has nothing in '$ancestors' in its process
dictionary to indicate it is part of kernel.
2011-12-29 23:38:03 +01:00
Ali Sabil
f47d61bc13 Add {vsn, _} support for reltool.config 2011-12-28 13:18:40 +01:00
Tuncer Ayaz
1de48e4902 Move vcs_vsn/2 to rebar_utils 2011-12-28 13:09:46 +01:00
Tim Watson
286a2a88a4 Add support for customising common test directory
This patch allows users to specify the directory in which common_test
source files can be found. Most common_test suites are integration,
rather than unit tests and keeping the sources apart from test sources
for other frameworks such as eunit and PropEr is a useful feature.
2011-12-28 12:41:36 +01:00
Tuncer Ayaz
e4c85d4548 Remove trailing whitespace in rebar_reltool 2011-12-19 19:17:42 +01:00
Tuncer Ayaz
7c327c1195 Fix rebar_core crash (reported-by: Jeremy Raymond) 2011-12-18 13:29:58 +01:00
Tuncer Ayaz
58101588a1 Fix help text formatting 2011-12-16 21:04:18 +01:00
Tuncer Ayaz
8c89a388bf Universally support apps=/skip_apps= 2011-12-12 21:20:34 +01:00
Tuncer Ayaz
a5e39c2c54 Move is_skipped_app/0 to rebar_app_utils 2011-12-12 17:53:56 +01:00
Tuncer Ayaz
b1d84514f0 Add rebar_utils:deprecated/4 and remove define 2011-12-12 17:52:04 +01:00
Tuncer Ayaz
e33d3a568f rebar_xref: move code to proper place 2011-12-12 17:09:03 +01:00
Torbjorn Tornkvist
b4f136d752 Make 'rebar xref' honour the skip_app directive
It is now possible to call rebar as:

  rebar xref skip_app=Mod1,Mod2,...

This makes it easy to skip running xref on (e.g)
imported dependencies in your application.

The function rebar_utils:is_skipped_app/0 is added so
that other rebar commands may use it.
2011-12-12 17:06:23 +01:00
Jesse Gumm
9f31ceae00 Fail if erl_interface not found
Previously if erl_interface could not be found {error, not_found} was
incorrectly used as a path. With this change we fail early with a
descriptive error message.
2011-12-08 20:12:16 +01:00
Tuncer Ayaz
8de2c84d89 Add support for arch-specific hooks
{pre_hooks,  [{"linux", compile, "c_src/build_linux.sh"}]}.
{post_hooks, [{"linux", compile, "c_src/build_linux.sh clean"}]}.
2011-12-05 14:17:18 +01:00
Tim Watson
0e3e94c253 Add support for first_files to port compiler
This patch adds support for first_files to the port_compiler, via the
new `port_first_files` rebar config element.
2011-11-30 19:39:23 +01:00
Tuncer Ayaz
a6fdac99a4 Fix and refactor reltool root_dir lookup 2011-11-26 12:01:13 +01:00
Tuncer Ayaz
ab79534507 Limit line length 2011-11-26 11:36:26 +01:00
smithwinston
1eaf88d1d0 Add root_dir option to reltool.config
When generating a node using rebar generate, rebar always used
code:root_dir() to find the Erlang installation to clone into the node
tree.  However, for anyone wishing to build a cross-compiled node, there
was no way to override this.  This patch adds a new option to
reltool.config file to allow an alternate root_dir to be specified, for
example:

{root_dir, "/tmp/otp_R14B03_armv7l"}

This assumes that the contents of /tmp/otp_R14B03_armv7l has been
generated using the instructions found in the xcomp directory in your
$ERL_TOP structure.  NOTE: you may have to add additional filters to
exclude files not present in the xcomp version, such as the .smp files
if you have disabled that.
2011-11-26 10:38:27 +01:00
Bob Ippolito
a54dd53673 Treat HEAD as a branch to fix regressions caused by 3ef7db5 2011-11-16 21:46:18 +01:00
Tuncer Ayaz
147d5e3b56 Remove gratuitous space in debug log 2011-11-09 22:56:54 +01:00
Tuncer Ayaz
e62ea1994c Remove gratuitous prefix in error log 2011-11-08 16:04:27 +01:00
Tuncer Ayaz
d2cf35ad02 Remove obsolete comments (thanks Tim Watson) 2011-11-04 18:53:36 +01:00
Klas Johansson
896e8505b2 Stop applications before killing extra processes
This means that applications get a chance to shut down themselves,
before rebar will start killing their processes.  This avoids ERROR
REPORTS from application supervisors.
2011-11-02 20:08:24 +01:00
Jan Kloetzke
b10224be62 Fix rebar_utils:expand_env_variable/3
The function may fail with a badarg exception because the first regex
returns an iolist() which is allowed to be a improper list. In this case
'++' cannot append to the iolist. The correct way to append something to
an iolist() is

  [iolist(), "tail"]

because iolist's are allowed to be arbitrarily deep lists.
2011-11-01 22:00:15 +01:00
Tuncer Ayaz
9197e70bd7 Fix formatting 2011-10-26 23:23:46 +02:00
Tuncer Ayaz
c373f29292 Fix comments and formatting 2011-10-26 23:16:36 +02:00
Dave Smith
17616d1078 Overhaul environment expansion for better performance
The introduction of setup_env as a global concept caused the rebar_port_compiler
implementation to start getting called a LOT. The expansion of environment variables
that happens in the port compiler was O(n^n), which means you could see upwards of
80k invocations of lists:foldl on a single app "./rebar clean". This commit reworks
the expansion to be O(n^2), and reduces the running time for the same operation by
60%+. On a large project like Riak, the end result is that a build went from 200
seconds to 73.
2011-10-26 23:16:36 +02:00
Dave Smith
1c1620a244 When profiling, save analysis results to disk 2011-10-25 23:58:53 -06:00
Dave Smith
45fc18f990 Add support for -p flag to profile rebar run 2011-10-25 13:33:40 -06:00
Tuncer Ayaz
28b9cebf0a Add -D support to rebar_port_compiler 2011-10-23 01:12:54 +02:00
Tuncer Ayaz
8eeca123e5 Cleanup and fix -D for erl_opts 2011-10-23 01:12:54 +02:00
Tuncer Ayaz
a0dcc624d9 Add -D option 2011-10-22 21:03:22 +02:00
Tuncer Ayaz
74ca540939 Use same variable names as file:make_link/2 2011-10-21 17:59:29 +02:00
Przemysław Dąbek
eb23571b8b Add possibility to make symbolic links
Simple feature, useful to make link to something without copying it.
2011-10-20 20:29:16 +02:00
Fabian Linzberger
176ec0e71e Work around functions not found in source
For parameterized modules, the beam code will have a compiler
generated new/1 and instance/1 function.

If while checking the beam, xref detects one of those is unused, the
rebars xref wrapper will try to find the location of the definition of
that function in the source code for the module (to give a more
specific warning to the user). Since the function was generated by the
compiler it does not actually exist in the source, and rebar crashes
at that stage. This patch works around that issue.
2011-10-20 16:37:41 +02:00
Steven Gravell
3c7a5804e9 Add overlay command to run overlays only
required for building on a different machine to what your live
config is kept on. This way you can build on one machine,
distribute to new machine, then run overlays against a live
config to prevent accidently running code against a live
config in a development or ci environment.
2011-10-20 16:33:19 +02:00
Joseph Wayne Norton
4a5114b79f Setup code path prior to calling edoc
Setup code path prior to calling edoc so that edown, asciiedoc,
and the like can work properly when generating their own
documentation.
2011-10-20 16:32:05 +02:00
Tim Watson
86325b616d Allow plugins to participate in pre and post processing
This patch modifies rebar_core to allow plugins to participate in the
pre and post processing steps, giving plugin authors more flexibility
and control.
2011-10-20 16:31:08 +02:00
Jan Klötzke
0ce5cbab06 rebar_file_utils: simplify commands on Windows 2011-10-20 16:27:35 +02:00
Jan Klötzke
3f9b346dec Fix the 'ct' target to work on Windows with MSYS 2011-10-20 16:27:35 +02:00
Jan Klötzke
85575fca65 rebar_app_utils: fix git hook for Windows 2011-10-20 16:27:35 +02:00
Jan Klötzke
b535b5eea8 rebar_utils:sh/2: remove bash invocation on Windows
Currently rebar_utils:sh/2 will invoke all commands through bash.exe if
found. Otherwise the command will be executed directly. Despite the fact
that the caller cannot know if the command is executed with Unix or
Windows semantics it leads to problems with MSYS's automatic path name
translation.

Therefore remove bash usage on Windows to get a consistent behavior and
to avoid the peculiarities of MSYS's automatic path conversion. Instead
use cmd.exe as its typically needed by most commands.
2011-10-20 16:27:35 +02:00
joewilliams
fb8732085e Better code path handling during upgrades
While building a upgrade package rebar will add new paths to the
internal erlang path, these paths and their order have effects on how
the package is built. This patch should fix some corner cases where a
user can receive a "undefined application" error.
2011-10-17 18:40:45 -07:00
joewilliams
644bb0a312 Copy sys.config into upgrade tarball
While building an upgrade the sys.config file should be copied into the
upgrade tarball so release_handler:install_releases/1 does not clobber
the existing configuration from the application environment.
2011-10-17 14:53:27 -07:00
joewilliams
f82028a544 More descriptive logging for upgrade systools cmds
In debugging upgrade issues it is sometimes difficult to know which
systools step a error ocurred at, a little extra logging to fix that.
2011-10-15 10:24:40 -07:00
Jon Meredith
5775746758 Remove modules that fail coverage from the list 2011-10-14 17:10:11 +02:00
Tim Watson
6dfcd8b9f2 Support for custom version commands
This patch adds support for customising the way in which rebar generates
version numbers for app.src files using the `{vsn,Spec}` approach.
Whilst the existing `{vsn,ScmName::atom()}` syntax will continue to
work, users can also pass `{vsn,{cmd,Cmd::string()}}` in which
case the provided *command* will be used. For example:

```erlang
{application, doodah,
 [
  {vsn, {cmd, "git rev-parse --short HEAD"}}]}.
```
2011-10-11 11:23:23 +02:00
Tuncer Ayaz
5a0aa04b20 Cleanup deprecations now that R14B04 is released 2011-10-06 17:06:08 +02:00
joewilliams
b7bcf5528b Handle vm.args properly while building upgrades
This patch corrects the vm.args behavior while building upgrade tarballs
by copying the file from the release into the upgrade. Additionally it
patches the dummy runner script in the upgrade test project to work
properly.
2011-10-05 20:23:07 -07:00
Tim Watson
30d1cdb31b Fix config handling in root_dir
Avoid overwriting custom config (passed with -C) when we are processing
the base_dir in rebar_core.
2011-10-05 13:49:27 +02:00
joewilliams
cb5056b2e3 Get rid of app.config
app.config has been a long standing erroneous file in rebar. Erlang/OTP
documentation suggests a sys.config file instead. This file is stored in
the releases/VSN directory. This does a few things but most importantly
it ensures your config (contained in the application environment)
survives a hot upgrade. It also has the advantage of allowing the
configuration of the application to be versioned along side the
application code. This patch flips rebar to use sys.config rather than
app.config.

Additionally it makes this flip to vm.args as well, making them
versioned just like sys.config.

This patch also includes runner script changes to support the old
etc/app.config config file location and support for Windows.

Thanks to mokele for the initial work and kick in the pants to make this
finially happen.
2011-09-20 09:44:41 -07:00
Tim Watson
36a40d3351 Fix missing plugin warnings
This patch fixes the warning logging when the number of missing plugins
is greater than one. The current code only works by accident, when a
single plugin is all that is missing.
2011-09-20 13:15:03 +02:00
Tuncer Ayaz
fa1bbc6702 Fix regressions in rebar_file_utils 2011-09-15 18:39:14 +02:00
Tuncer Ayaz
317eeb72e0 Fix Dialyzer warning 2011-09-08 22:54:44 +02:00
Tuncer Ayaz
1cb1ae238a Fix regression in rebar_file_utils:cp_r/2 2011-09-04 23:04:55 +02:00
Jan Vincent Liwanag
f16ebd13dc Move asn1 generated *.hrl to include 2011-09-04 14:11:50 +02:00
Tuncer Ayaz
6a2fb52277 Fix spec for rebar_file_utils:rm_rf/1 2011-09-02 19:51:48 +02:00
Jan Klötzke
3fa6f6ab7c Quote paths before passing them to the shell 2011-09-02 19:40:30 +02:00
Anton Lavrik
7b90cc4707 Export $REBAR_DEPS_DIR and $ERL_LIBS variables
Export two extra environment variables when executing shell commands.
These variables are useful for rebar hooks that rely on Erlang
applications installed as rebar dependencies.

$REBAR_DEPS_DIR contains a fully-qualified name of the directory where
rebar stores dependencies.

$ERL_LIBS is set to $REBAR_DEPS_DIR or to "$REBAR_DEPS_DIR:$ERL_LIBS",
if $ERL_LIBS was defined before.
2011-09-02 19:21:11 +02:00
Ignas Vyšniauskas
ed94237dde Ensure include dir exists in compile_mib/3 2011-09-02 17:53:55 +02:00
Tuncer Ayaz
c3a4ed292e Clean up and fix vcs functions and logging 2011-09-02 14:54:08 +02:00
Ben Ellis
3ef7db59cb Add support for checking out specific git commit 2011-09-01 22:29:55 +02:00
Tuncer Ayaz
3e946a7d5c Fix cover_init call to use correct module list 2011-09-01 20:17:43 +02:00
Joseph Wayne Norton
b6f575c7fe Keep *_tests not automatically included by eunit 2011-09-01 19:23:46 +02:00
Tuncer Ayaz
0741157a11 Fix misspelling of accommodate 2011-08-31 15:29:23 +02:00
Tuncer Ayaz
475daf2c4a Comment git vsn cmd changes 2011-08-29 20:02:03 +02:00
Tuncer Ayaz
93128f2f6b Search plugin sources in base_dir and plugin_dir 2011-08-29 17:27:45 +02:00
Tuncer Ayaz
00b3d9d3cc Only compile relevant plugin sources 2011-08-29 17:27:45 +02:00
Tuncer Ayaz
4fe651cb5b Simplify check for empty list 2011-08-29 17:27:45 +02:00
Tim Watson
3b58935b86 Load plugins dynamically from source
This patch updates rebar_core to look for missing plugins (i.e. those
that aren't found on the code path at runtime) in a configurable
plugin directory, and dynamically compile and load them at runtime.

By default, the directory "plugins" is searched, although this can be
overriden by setting the plugin_dir in your rebar.config.
2011-08-29 17:27:45 +02:00
Alfonso De Gregorio
6f76d14499 Fix R13 compatibility (auto imported monitor/2) 2011-08-28 14:00:04 +02:00
Tuncer Ayaz
a53fc2d8f5 Document git vsn cmd and fix formatting 2011-08-27 15:45:50 +02:00
Yurii Rashkovskii
15b7798e46 Add precise git versioning of multiple apps
Allows using tools like git-subtree and still maintaining proper
git-based vsns for those "imported" subtrees. Also helps understanding
what was the last change introduced to a specific application within a
multi-application repository (at this moment, all applications that
reside in the same repository, will share the same autogenerated git
vsn)
2011-08-27 15:38:54 +02:00
Tuncer Ayaz
8376693a3f Fix Dialyzer warnings 2011-08-25 11:41:22 +02:00
Scott Lystig Fritchie
9832a5c5c6 Merge slf-eunit-process-isolation2 branch 2011-08-24 23:19:01 -05:00
Scott Lystig Fritchie
9c8b5e6c82 Check $ancestors for kernel OTP app processes to not kill 2011-08-24 12:11:48 -05:00
Scott Lystig Fritchie
0627075dd6 Add comments on pids not to kill 2011-08-23 17:32:07 -05:00
Scott Lystig Fritchie
b674ea19a4 Portability via filename:join/1 2011-08-23 14:22:04 -05:00
Scott Lystig Fritchie
f79290dc9c Replace sleep with pause_until_net_kernel_stopped() 2011-08-23 14:17:18 -05:00
Tuncer Ayaz
1dcf0d15dc Log a more descriptive message 2011-08-23 18:54:05 +02:00
Tuncer Ayaz
e6d1e13966 Apply Tidier suggestions 2011-08-20 18:33:36 +02:00
Tuncer Ayaz
8fb385f312 Limit line length 2011-08-20 18:26:59 +02:00
Jan Klötzke
7ec9b48d50 Support command invocation on Windows without MSYS
If MSYS (with bash) is not installed on Windows then do the shell
variable substitution by ourselves. Otherwise just call bash to do the
job.
2011-08-20 18:20:26 +02:00
Tim Watson
5bb536f839 Respect the --config switch when given
Currently the --config switch does not work because when loading
a new rebar config the global setting is ignored for all paths.
This patch provides a check when loading new rebar config to see
whether or not the current config path matches the `base_dir` set in
global conf, which produces the expected behaviour.
2011-08-18 15:35:30 +02:00
Tuncer Ayaz
da31f90d1d Rename rebar_plugins to plugins for consistency 2011-08-16 17:34:09 +02:00
Scott Lystig Fritchie
34dd0ccdd9 EUnit: reset vm state after test run
Added new property to `eunit_opts` option list:

  reset_after_eunit::boolean() - default = true.
      If true, try to "reset" VM state to approximate state prior to
      running the EUnit tests:
          * Stop net_kernel if it was started
          * Stop OTP applications not running before EUnit tests were run
          * Kill processes not running before EUnit tests were run
          * Reset OTP application environment variables
2011-08-11 15:52:34 -05:00
David Reid
6736e3147e Fix handling of {already_started,Pid} from cover:start
Previous patch erroneously assumed that cover:start() returned
{already_started,Pid} in the cases where cover was already started. We
now turn {error,{already_started,Pid}} into {ok, Pid} and return
{error, Reason} if we encounter an error we do not know about, this
will cause a nice and violent badmatch to stop everything.
2011-08-10 18:32:58 +02:00
Dave Smith
773a3dc1f5 Merge pull request #102 from dreid/quiet-cover
Redirect cover module output to .eunit/cover.log
2011-08-05 10:15:15 -07:00
David Reid
0edf52b539 Redirect cover module output to .eunit/cover.log
The cover module calls io:format and io:fwrite directly for several types of
informational messages and warnings.  When using meck to mock covered modules
these warnings are triggered and can cause severe polution of the test output.

We can avoid this by starting cover explicitly then setting the group_leader
of that process to a file handle.
2011-08-05 10:04:14 -07:00
Anders Nygren
2632cbc2cf Generate .hrl file from .mib
Generate .hrl files into include from SNMP MIB files.
Change the order of so .mib files are built before .erl
This is necessary since .hrl files are generated from
the .mib files.
The generated .bin and .hrl files are deleted by clean.

This is a cleaned up version of a patch originally
sent to the rebar mailing list by David Nonnenmacher.
2011-08-05 17:07:23 +02:00
Tuncer Ayaz
f08f13d103 Extend app resource file existence checks 2011-08-05 10:45:21 +02:00
Tino Breddin
578ba06ad9 Add awareness of 'app' parameter to ct module 2011-08-04 18:38:49 +02:00
Tuncer Ayaz
1ef230262b Extend port compiler default env for Darwin 11 32-bit 2011-08-01 16:36:35 +02:00
Tuncer Ayaz
1846a5086c Remove unused function rebar_utils:deprecated/4 2011-07-28 22:29:02 +02:00
Tuncer Ayaz
edf4bbc370 Fix error handling bug in {copy,In,Out} template 2011-07-18 18:58:20 +02:00
Tuncer Ayaz
d9ef6fbd53 Optimize list ops and error reporting in sh/2 2011-07-18 18:58:20 +02:00
Tuncer Ayaz
a9a7d7c02b Apply Tidier suggestions 2011-07-18 18:58:20 +02:00
Tuncer Ayaz
a4ffe1ce62 Use filename:join/1 2011-07-18 18:58:15 +02:00
Tuncer Ayaz
4e0ab4065f Fix grep portability (Reported-by: Andrew Thompson) 2011-07-14 13:03:54 +02:00
joewilliams
d215cae496 get_reltool_release_info now expects consulted data 2011-07-12 09:08:34 -07:00
Andrew Gopienko
695ff290b3 skip appup generation for new app in release 2011-07-11 13:00:17 +07:00
cloudhead
dd9adac8c4 Add support for {copy, src, dst} to templater 2011-07-08 11:32:23 -06:00
Tuncer Ayaz
45f44c2166 Fix {git,Url} support (Reported-by: Garrett Smith) 2011-07-08 14:04:11 +02:00
Tuncer Ayaz
7118ec6612 Use auto-imported element/2 2011-07-08 14:01:25 +02:00
Tuncer Ayaz
1ec92ebac3 Do not warn if pre_/post_ cmd is not available 2011-07-08 13:40:47 +02:00
Tuncer Ayaz
cc2447f1b1 Correct sub_dirs loop log message 2011-07-07 15:31:43 +02:00
Tuncer Ayaz
e0a86868ca Log if sub_dirs loop is detected 2011-07-06 20:31:40 +02:00
Tuncer Ayaz
8263f12594 Add support for $HOME/.rebar/config 2011-07-06 20:14:15 +02:00
Tuncer Ayaz
b571e7b52f Fix logging (reported-by Sergey Yelin) 2011-07-04 13:07:24 +02:00
Joe Williams
18d4ddc8d0 Merge pull request #90 from smarkets/upgrade-fixes
look for new and old versions in the target parent
2011-07-01 11:16:14 -07:00
Steven Gravell
d00845b490 default module appup instruction -> load_module 2011-07-01 18:28:48 +01:00
Steven Gravell
0f5e393292 look for new and old versions in the target parent
The target_dir config in reltool allows you to put your release in
a directory other than in ./NAME, so we should look in the parent
directory of that to find the new and old versions instead of
simply looking in ./

Move untaring and retaring into a temporary path instead of in ./
to prevent name collisions with "releases" and "lib" that might
exist already. Having a subdirectory rel/releases/ can be useful.
2011-07-01 18:04:32 +01:00
Mathias Meyer
2e64e91c0c Add options for escript shebang, command, emu_args
Allows customizing the arguments handed over to the Erlang VM, e.g. to
set a name or a cookie, e.g. by setting escript_emu_args to:

%%! -name rebar -setcookie rebar
2011-06-14 12:13:09 +02:00
Tuncer Ayaz
013a49a941 Add list-deps to completion and abbrev-cmds 2011-06-10 17:20:49 +02:00
Jared Morrow
b67b7eaa6b Add command listing for list-deps 2011-06-10 09:11:45 -06:00
Tuncer Ayaz
fbd2778c04 Deprecate xrl_opts/yrl_opts fail_on_warning opt 2011-06-08 19:44:57 +02:00
Tuncer Ayaz
ca3368a6b4 Remove leftover references to rebar_dialyzer 2011-06-07 01:11:32 +02:00
Dave Smith
719c9a50c7 Merge pull request #81 from evanmiller/em-protobuffs
Recursively search "src" for .proto files
2011-06-06 08:33:50 -07:00
joewilliams
7ac00a73e8 Remove rebar_dialyzer 2011-06-06 17:12:08 +02:00
Dave Smith
ab116276b7 Merge pull request #80 from hyperthunk/plugin-hooks
Allow plugins to run before/after a rebar command.
2011-06-06 08:02:50 -07:00
Tuncer Ayaz
1e342faee8 Apply Tidier suggestions 2011-06-02 22:09:11 +02:00
Juhani Rankimies
8eb1fc8308 Make port compilation template configurable
- Port compiler no longer requires bash on windows.
- It's possible to use compilers whose command lines don't fit into
  the default template
2011-06-02 20:13:00 +02:00
Evan Miller
f389e79d39 Recursively search "src" for .proto files 2011-06-01 13:29:47 -05:00
Tuncer Ayaz
5c0b46d92d Minimize compile options 2011-06-01 18:56:01 +02:00
Tuncer Ayaz
5b3082f443 Fix erlc regression (reported-by Benoit Chesneau) 2011-06-01 14:29:54 +02:00
Tuncer Ayaz
3a8b4d5e8f Cleanup deprecations now that R14B03 is released 2011-05-31 11:15:18 +02:00
Tuncer Ayaz
70137292e1 Extract code to get wordsize into helper function 2011-05-31 10:52:23 +02:00
Steve Vinoski
0bbb2985f0 Use external wordsize to get emulator build arch
Calling erlang:system_info(wordsize) yields the internal word size of
the Erlang emulator. But due to the halfword emulator, need to pass
{wordsize, external} instead to get the word size, or pointer size, as
seen by external code such as NIFs. The halfword emulator has 4 byte
internal words but 8 byte external words due to 64-bit compilation,
which means NIFs for the halfword emulator also have to be compiled
64-bit. But just passing wordsize is equivalent to passing {wordsize,
internal}, which does not indicate the pointer size for the halfword
emulator.

Older versions of Erlang do not support {wordsize, external}, though,
so continue to pass just wordsize for those versions.
2011-05-31 10:47:45 +02:00
Andrew Tunnell-Jones
aef6c70f59 Change arch-specific port_sources to take a list
Change the second parameter of a regex tagged port_source from being a
filename or wildcard to being a list of filenames or wildcards.

Previously: {"R14", "c_src/*.c"}
Now: {"R14", ["c_src/*.c"]}

Motivation for change is to avoid repeating regexes.
2011-05-28 15:31:51 +02:00
Shunichi Shinohara
862ae1f192 Abort if xref emits warnings 2011-05-25 20:28:32 +02:00
Tuncer Ayaz
d7f5016920 Abort if dialyze emits warnings 2011-05-25 19:34:10 +02:00
joewilliams
b7e20f3234 Better org. of how upgraded apps are determined
get_apps/3 now returns which apps have been added, removed and ugpgraded
in a reasonable way. It should prove more usable should we want to
access any of those lists in future appup related changes.
2011-05-24 10:48:19 +02:00
Tuncer Ayaz
1628879b21 Fix leftover whitespace errors 2011-05-23 16:32:22 +02:00
Tim Watson
c07b0954eb Allow plugins to run before/after a rebar command.
This patch makes a small change in rebar_core that checks the list
of valid plugins to see if any of them export a pre/post processing
function for the current command. This logic is applied only to the
plugins and allows plugin authors to hook into rebar's execution by
using a naming convention that matches the one used for scripting hooks.

Example:

```erlang
-module(my_rebar_plugin).
-export([pre_compile/2]).
pre_compile(Config, AppFile) ->
    rebar_log:log(debug, "PRECOMPILE: ~p:~p~n",
                  [AppFile, Config]),
    ok.
```
2011-05-23 12:46:03 +01:00
Tuncer Ayaz
892dc48a86 Fix indentation errors 2011-05-23 12:24:55 +02:00
Tuncer Ayaz
39f8b344bc Fix indentation errors 2011-05-21 16:46:55 +02:00
Dave Smith
ea8aca4519 Merge pull request #69 from maxlapshin/master
I've added variable expansion in replace overlay
2011-05-20 08:23:19 -07:00
Anthony Molinaro
bc5aebcf5f Change logic to support more port env use cases
The logic changes from strict overrides to a hybrid for merging os_env
and defaults, whereby defaults are chosen if they are not set in the
os_env or if the defaults contains substitutions (at which point os
environment is substituted).

This still means that rebar.config works as it did before, where it
overrides or substitutes based on the use of $VAR, but that default
and os environment merging works such that the common cases of
providing CC or LDFLAGS in the users environment or command line work
as you might expect.  In that CC is overriden by the os environment
unless rebar.config overrides it, and LDFLAGS from the user environment
is appended or prepended based on defaults and rebar.config.

Addresses problems with https://github.com/basho/rebar/pull/71
Also keeps the fix for bug 255.
2011-05-13 10:23:08 -07:00
Tuncer Ayaz
096e56d61c Fix code readability in port_compiler 2011-05-12 00:14:25 +02:00
Max Lapshin
8666d57d78 Expand variables in replace overlay 2011-04-29 14:58:31 +04:00
Tuncer Ayaz
f51e3df3b9 Add missing newline in port_compiler debug msg 2011-04-28 18:39:46 +02:00
Tuncer Ayaz
61c564bf72 Update mustache.erl 2011-04-27 10:19:34 +02:00
Andrew Thompson
2e654513dd Fix eunit regression (reported-by Alexander Dorofeev) 2011-04-23 17:17:49 +02:00
Tuncer Ayaz
98312c881f Adjust deprecation message 2011-04-21 22:03:40 +02:00
Tuncer Ayaz
20dfd32c85 Add support for command-specific env for hooks 2011-04-21 21:38:16 +02:00
Dave Smith
85eb2957c3 Add list-deps command 2011-04-21 06:08:40 -06:00
Evax Software
447417098a Support settable plt dir for dialyzer
Allow rebar to use dialyzer plt files from an alternate directory
through the use of the REBAR_PLT_DIR environment variable.
2011-04-12 15:46:15 +02:00
Tuncer Ayaz
67af251d52 Remove lfe_opts (suggested by Tim Dysinger) 2011-04-11 14:08:39 +02:00
Dave Smith
bda6ee0e48 Centralize variable resolution; add target_dir variable 2011-04-10 16:12:50 -06:00
Dave Smith
4dc2414d89 Add support for priv/<vcs.vsn> as fallback for version info 2011-04-10 16:12:50 -06:00
Dave Smith
c4907b6297 Add support for loading template vars from external file 2011-04-10 16:12:50 -06:00
Dave Smith
3e2baf1a07 Add support for template_wildcarding; allows files from many directories to be templated. 2011-04-10 16:12:50 -06:00
Dave Smith
b7111dce85 Refactor overlay_vars to enable overrides from command-line 2011-04-10 16:12:50 -06:00
Dave Smith
4be3631687 Make sure to pass dir of app when invoking git; enhance shell logging output 2011-04-10 16:12:50 -06:00
Tuncer Ayaz
055ac99d6f Deprecate fail_on_warning and refactor code 2011-04-07 21:56:53 +02:00
Tim Watson
2d385970bf Pass extra params to ct (thanks Mickael Remond)
This patch adds a `ct_extra_params` option to rebar.config, the value
of which is appended to the shell command when executing common test.
2011-04-06 20:11:13 +02:00
Andrew Thompson
310a1bb7ea New eunit param skip_app, allow suite to be a list
This patch allows the 'suite' argument to eunit to be a comma separated
list of modules to test instead of being a single module. This allows
fine-grained testing when one test suite interferes with another and its
not clear which suite is causing the problem. It also lets you run the
test suite in a different order for a similar reason.

The other enhancement is to add a new eunit parameter; 'skip_app' which
like 'app' is a comma separated list of modules to skip testing on. This
parameter is only applied if the app parameter is not passed. Its
purpose is to avoid forcing you to specify all the apps to test if you
only want to skip a handful and there are many apps to test.
2011-04-06 18:56:35 +02:00
Tuncer Ayaz
153aabee9b Use infinite receive (thanks Hakan Mattsson) 2011-04-04 16:39:05 +02:00
David Reid
300a4ac22e Use abort in check-plt and update doc 2011-04-02 17:57:13 +02:00
Tuncer Ayaz
be209f24ff Make debug_info default
Add no_debug_info option.
Remove debug_info=1 option.
2011-03-30 11:19:37 +02:00
Tuncer Ayaz
6d75bfbeb0 Clean up specs 2011-03-28 18:39:38 +02:00
Jordi Chacon
e684af36f0 Fix bug: xref should be stopped after being run
Xref not being stopped caused a crash in subsequent xref runs.
2011-03-26 12:25:25 +01:00
Tuncer Ayaz
2ee4899d24 Fix code clarity and formatting 2011-03-22 11:12:57 +01:00
Shunichi Shinohara
cd3653616b Fix ct include option prefix 2011-03-22 11:08:45 +01:00
Tuncer Ayaz
fa38ed64cc Simplify find_dep_in_dir 2011-03-13 15:55:36 +01:00
Tuncer Ayaz
85e820096d Fix comments 2011-03-13 14:11:24 +01:00
Tuncer Ayaz
4ceb9e07a3 Deprecate old hooks 2011-03-12 16:48:16 +01:00
Tuncer Ayaz
bc98a4820e Simplify hook changes to rebar_core 2011-03-12 16:32:44 +01:00
Tim Watson
e76770511a Add pre and post script support for all commands
This change makes it possible to assign pre/post scripts to all
rebar commands. This allows users fine grained control over
when scripts and/or shell commands should be executed, where such
extensions are absolutely needed.

Several examples have been added to the rebar.config.sample file.
2011-03-12 16:31:41 +01:00
Tuncer Ayaz
81be474c30 Fix regression (thanks Anthony Molinaro) 2011-03-07 20:16:29 +01:00
joewilliams
0f99ba2280 Fix bug that causes appup generation to fail
This commit changes how rebar determines which apps have been
updated, added and removed from a release during appup generation.
Rather than use app files it now determines this from the rel file
in each version of the release. In addition it fixes a bug reported
on the mailing list when generating appups when an application has
been added or removed from either release.
2011-03-03 16:02:37 -08:00
Christopher Brown
0a603435f5 honor local deps before code path 2011-03-02 21:06:30 -08:00
Juan Jose Comellas
58661a92e2 Convert the entries in the code path to absolute paths
Rebar will exit with {error,bad_directory} when trying to restore the code
path after it has finished working on a subdirectory if there are invalid
relative paths in it. The problem was seen when executing the last line of
rebar_erlc_compiler:doterl_compile/3 (true = code:set_path(CurrPath)).
2011-02-26 15:57:17 +01:00
joewilliams
90d2ce5e07 Ignore app files not in ebin 2011-02-25 18:38:50 +01:00
Tuncer Ayaz
2cff499a34 Fix regression in rebar_lfe_compiler 2011-02-22 17:28:49 +01:00
Tuncer Ayaz
3356c2d9e8 Use erlang:function_exported/3 2011-02-21 17:42:10 +01:00
Tuncer Ayaz
c6f6e8a572 Fix Dialyzer warning and slightly reformat code 2011-02-21 15:43:07 +01:00
Tim Dysinger
6f97e6e55b Add up to date instructions in case LFE is missing 2011-02-21 15:29:50 +01:00
Tim Dysinger
5049da8ec4 Add fail_on_warning support for LFE 2011-02-21 15:29:25 +01:00
Tim Watson
3db8f585f1 Add -spec support to rebar_ct command line
This change adds support for executing ct test runs based on test
specificiations, which was missing previously. The rebar_ct module
now looks for any number of files with a name ending in `test.spec`
and if it finds one or more, passes these after the `-spec` argument
to ct_run instead of explicitly configuring the config, user config
and coverage config variables.

When no specifications are found, then the module behaves as it did
before this change, and both the ct1 and (new) ct2 integration tests
appear to show this is a backwards compatible patch.
2011-02-21 15:08:24 +01:00
Dave Smith
6056c63eed Clean up and simplify {vsn, VCS} support 2011-02-18 10:59:57 +01:00
Tuncer Ayaz
01a7473dac Add {vsn,Vcs} support for bzr, hg and svn 2011-02-17 19:23:43 +01:00
Adam Kocoloski
b0860da124 Expand {vsn,git} in app.src to git-describe output 2011-02-17 19:17:28 +01:00
joewilliams
1e9b2b844b Clean up trailing whitespace 2011-02-17 10:12:32 -08:00
joewilliams
4e8dcfbfad Clean up rebar_appups and rebar_upgrade 2011-02-17 17:13:19 +01:00
Tuncer Ayaz
377c9e86d5 Add PropEr support 2011-02-16 17:36:11 +01:00
joewilliams
c6da0b3ef6 Fix generate-appups regression (atom vs list) 2011-02-16 17:07:12 +01:00
joewilliams
11bf6b4aab Add 'generate-appups' command
To further support OTP releases I have added support for generating
application appup files. These include instructions that systools uses
to generate a relup file which contains the low level instructions
needed to perform a hot code upgrade. My goal with this module is to
produce "good enough" appup files or at least a skeleton to help one get
started with something more complex. If an appup file already exists for
an application this command will not attempt to create a new one.

Usage:
$ rebar generate-appups previous_release=/path/to/old/version

Generally this command will be run just before 'generate-upgrade'.
2011-02-15 18:33:18 +01:00
Anthony Ramine
9ee8ed9181 Give an absolute path to code:add_path/1
If an app uses -include_lib for its own included files, compilation
fails if the app directory isn't in $ERL_LIBS because code:lib_dir/1
will return an error. An absolute path needs to be added to code path
instead of just "ebin".
2011-02-15 18:32:42 +01:00
Tuncer Ayaz
b70f374f89 Remove export_all directive 2011-02-13 16:38:04 +01:00
Joseph Wayne Norton
e4cd50e2a3 Add eunit_first_files option 2011-02-13 16:26:48 +01:00
David Reid
3241165ced Support 2 forms of implicit HEAD for git
In git origin/HEAD is a pointer to the default branch.  This patch
allows two alternatives to explicitly specifying "HEAD" in git VC specs.

The first is a 2 arity form {git, Url} and the second is {git, Url, ""}
which worked in pre-update-deps rebars.
2011-02-13 16:05:42 +01:00
Tuncer Ayaz
63de05d914 Clean up code 2011-02-06 17:41:04 +01:00
Tuncer Ayaz
c466076ffb Clean up emacs file local variables 2011-01-31 17:55:36 +01:00
Tuncer Ayaz
0e729bf90e Fix Dialyzer warnings in rebar_upgrade 2011-01-29 16:18:14 +01:00
Tim Watson
7ac3a5aa9b Move BUILD_TIME and VCS_INFO macros
I have moved these macros from rebar_core.erl to rebar.erl
in order to prevent eunit tests from failing (which they
currently are).
2011-01-29 16:16:37 +01:00
Tuncer Ayaz
926baa1c31 Use filename:join instead of ?FMT 2011-01-28 20:15:22 +01:00
Tuncer Ayaz
8f5bfea9c4 Fix help: previous_release is mandatory 2011-01-28 19:05:20 +01:00
joewilliams
5298e93a18 Add 'generate-upgrade' command
To support OTP release upgrades I have added support for building
upgrade packages. Support for this is included in the
rebar_upgrade module, specifically generate_upgrade/2. It requires
one variable to be set on the command line 'previous_release' which
is the absolute path or relative path from 'rel/' to the previous
release one is upgrading from. Running an upgrade will create the
needed files, including a relup and result in a tarball containing
the upgrade being written to 'rel/'. When done it cleans up the
temporary files systools created.

Usage:
$ rebar generate-upgrade previous_release=/path/to/old/version

This also includes a dummy application that can be used to test
upgrades as well as an example.

Special thanks to Daniel Reverri, Jesper Louis Andersen and
Richard Jones for comments and patches.
2011-01-27 18:37:39 +01:00
Tuncer Ayaz
3fd3bfc89a Fix circular dependency 2011-01-27 15:57:55 +01:00
Dave Smith
a8066b35a9 Use an order independent method for exact matches when looking for command candidates 2011-01-25 21:29:08 -07:00
Klas Johansson
6978504d43 Add support for abbreviated command names
This change makes it possible to type the beginning (the prefix) of a
command name and rebar will guess the full name of the command,
thereby saving the user precious keystrokes.  As long as the prefix
matches only one command, rebar runs that command, otherwise rebar
prints a list of candidate command names. The "-" character is
considered to be a word separator and the prefix matching is done per
word.

Example prefix matches:

    co       ==> compile
    cl       ==> clean
    create   ==> create
    create-a ==> create-app
    c-a      ==> create-app
    c-app    ==> create-app
2011-01-24 17:18:33 +01:00
Tuncer Ayaz
d1ff83a898 Move command line handling funs into rebar.erl 2011-01-24 17:17:23 +01:00
Tuncer Ayaz
a3615a4b82 Update getopt 2011-01-23 16:05:25 +01:00
Andrew Tunnell-Jones
b52b82cc29 Add support for arch specific port_sources
On one project I have a need to specify port_sources on R14 only
and on another different project port_sources for Darwin and Linux.
To this end add support to handle tuples of the form
{ArchRegex, PortSource} in the port_sources list, eg:

    {port_sources, [{"R14", ["c_src/*.c"]}]}.
2011-01-17 16:57:46 +01:00
Tuncer Ayaz
8940f07801 Fix underspec (thanks Kostis Sagonas) 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
932eb2e343 Simplify rebar_core 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
ebcae06928 Fix grep invocations 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
bb6731208e Fix indentation in rebar_ct 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
3b0568ebb7 Simplify and cleanup rebar_templater 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
150c9d0b47 Simplify and cleanup rebar_xref 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
e4036cbe56 Apply Tidier suggestions 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
d922985b36 Fix typos 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
58fd80917a Fix file existence checks 2011-01-13 17:39:14 +01:00
Tuncer Ayaz
a8870807fc Fix code clarity 2011-01-13 17:39:14 +01:00
Joseph Wayne Norton
5b05e54cda Add otp_release to platform string 2011-01-09 16:06:51 +01:00
Tuncer Ayaz
5a37149642 Fix Dialyzer warning 2011-01-09 09:46:08 +01:00
Tuncer Ayaz
220eec71f6 Remove unused fun rebar_utils:get_os/0 2011-01-09 09:45:43 +01:00
Tuncer Ayaz
46b2c0612e Fix bug 770 2011-01-08 19:20:40 +01:00
Tuncer Ayaz
422beee324 Return more descriptive dependency errors 2011-01-06 15:50:16 +01:00
Juhani Rankimies
9441251f9f Use file:change_mode/2 instead of invoking chmod 2011-01-06 15:02:23 +01:00
Juhani Rankimies
52ca7795fe Unify executable invocation
Add flags to rebar_utils:sh to control output and error handling.
Replace calls to os:cmd with calls to rebar_utils:sh.
2011-01-06 15:02:19 +01:00
Charles McKnight
f83f18eb3b Fix error where ebin was created as a file
This patch remedies an issue where the ebin directory would be
erroneously created as a file by the first "mv" command in
rebar_protobuffs_compile.erl [line 106] if the ebin file did not
exist at the root application level.

In essence, the patch ensures that the ebin directory exists at
the application directory level before any "mv" commands are
executed. The following code was inserted at line 106:

    ok = filelib:ensure_dir(filename:join("ebin","dummy")),
2011-01-06 12:30:32 +01:00
Tuncer Ayaz
9c0d51bc0b Fix order of erl_opts to be more accurate 2011-01-04 11:27:17 +01:00
Joseph Wayne Norton
a529577b74 Remove erlc target after fail_on_warning failure
Prevent overlooking a compilation warning by removing the target beam
file after fail_on_warning failure.
2010-12-27 13:29:53 +01:00
Anthony Ramine
008dcb8542 Add abnfc support
abnfc is an ABNF parser generator.
Options are:
	- doc_root (defaults to "src")
	- out_dir (defaults to "src")
	- source_ext (defaults to ".abnf")
	- module_ext (defaults to "")
2010-12-22 17:57:21 +01:00
David Reid
63d5ceb61d Support single level of nested template variables
Add support for defining template variables of the following form:

{variables, [{appid, "mochiwebapp"},
         {author, "Mochi Media <dev@mochimedia.com>"},
         {year, "2010"},
         {version, "0.1"},
         {port, 8080},
         {dest, "{{appid}}"}]}.

Where dest may be overridden on the commandline but will default to
being the appid. Mochiweb uses this so that we can create new
projects from the template in a configurable directory.

So

$ rebar create template=mochiwebapp dest=foo appid=bar

I thought about special casing dest but figured it might be generally
useful to be able to nest template vars.

However this patch only does one level of resolution. So if

{variables, [{foo, "{{bar}}"},
                {bar, "{{foo}}"}]}.

then bar will end up being the literal string {{bar}} and foo the
literal string {{foo}}.
2010-12-22 17:56:52 +01:00
Dave Smith
9b0d35d986 Adding support for app_vars in external file 2010-12-20 08:55:31 -07:00
Tuncer Ayaz
d8e50e8c2d Implement update-deps and disable auto update 2010-12-17 12:39:50 +01:00
Anthony Ramine
9ecc3455bf Fix typo in rebar_erlydtl_compiler 2010-12-16 15:40:15 +01:00
klaar
48ee15c7e7 Fix conversion of boolean atom to string
mustache:render("{{banan}}", dict:from_list([{banan, true}])).

** exception error: no function clause matching mustache:escape(true,[])
     in function  erl_eval:do_apply/5
     in call from erl_eval:expr/5
     in call from erl_eval:expr/5
     in call from mustache:render/3
2010-12-09 23:28:05 +01:00
Benjamin Nortier
ab4e0a32ab Add rebar code path to common test code path 2010-12-09 00:20:54 +01:00
Tuncer Ayaz
07269ebdb9 Add VCS dir check for bzr and svn 2010-12-07 19:32:58 +01:00
Dave Smith
3e12630f23 Check for VCS directory before attempting source update. 2010-12-07 10:38:00 -07:00
Tuncer Ayaz
0bb429c197 Fix code clarity 2010-12-07 01:03:17 +01:00
Mihai Balea
837192e34e Fix compilation of *_first_files
- Check the existence of first_files and fail if they are not present
 - Get first_files lists from local instead of inherited config
   definitions, since they only make sense in the local context
2010-12-01 17:30:23 +01:00
Adam Kocoloski
8118083122 Return descriptive errors from is_app_available() 2010-11-30 01:18:48 +01:00
Joseph Wayne Norton
d24021f4e3 Add new global flag 'debug_info' to erlc_compiler
Using rebar's commandline, enable/disable 'debug_info' for
compilation. This feature if added to all rebar compilers could help
simplify and standardize this common use case for all rebar build
targets.
2010-11-30 00:24:20 +01:00
Joseph Wayne Norton
e36783112d Support dialyzer plt paths having "~/" as a prefix
e.g. {dialyzer_opts, [{plt, "~/.dialyzer_plt.R14B"}]}.
2010-11-23 19:03:56 +01:00
Juhani Rankimies
fe664e8c50 Fix bug 805
Use rebar_utils:find_executable/1 that wraps the
path in quotes to make it work even if it contains
whitespace.
2010-11-22 23:48:28 +01:00
Misha Gorodnitzky
064195dc5a Fix git tag and branch dependency handling
Change git downloads and updates to not create branches and fix git
tag handling.
2010-11-20 23:32:49 +01:00
Daniel Néri
72cdcd9573 Remove mention of "clean" command from rebar_edoc 2010-11-14 13:35:14 +01:00
Daniel Néri
6785c16f02 Fix EDoc syntax errors 2010-11-14 13:32:30 +01:00
Anders
513ae33c5c Add possibility to specify rebar config for the "main" application 2010-11-09 20:19:38 -07:00
Anders
c604d85ed5 Create ebin directory if it is missing for deps 2010-11-09 20:19:38 -07:00
Andrew Thompson
5158f9531d Stop clean from erroring if there's no .app file
If rebar tries to clean the .app file (because there's a .app.src file)
and it doesn't exist (possibly because of a bad compile), don't fail.
2010-10-29 11:52:20 -04:00
Andrew Thompson
ff5a7982eb Improve error logging when running a command fails
Make the error message newline terminated and, if possible, log the name
of the module in which the failure occured.
2010-10-29 11:52:13 -04:00
Juhani Rankimies
fd5ebe69a4 Port rebar_file_utils to Windows
Modify rm_rf and cp_r to work when {win32,_} = os:type().
Simplify rm_rf to only accept one filename, directoryname or wildcard.
Add unit tests to ensure a similar behaviour on windows and unix.

Thanks to tuncer for guidance and feedback.
2010-10-27 11:39:12 -06:00
Juhani Rankimies
75fc2378bf Remove unused functions from rebar_file_utils
mkdir_p/1 and ln_sf/2.
2010-10-27 11:39:12 -06:00
Kostis Sagonas
7dc76d578e Tidier improvements 2010-10-26 00:38:51 +02:00
Tuncer Ayaz
1a577fcd43 Clarify rebar_utils:ensure_dir/1 comment 2010-10-25 23:09:37 +02:00
Tuncer Ayaz
2d2aed627f Refactor Dialyzer support to make it more usable 2010-10-25 22:37:18 +02:00
Dave Smith
7ddd4bdaad Fixed 819; removed the edoc clean function entirely in favor of requiring user to explicitly specify what files should be deleted.
If there is no convention or way to programatically figure out what files to process, don't guess.
2010-10-25 06:31:07 -06:00
Tuncer Ayaz
1690139be9 Match ok result of filelib:ensure_dir/1 2010-10-22 22:12:25 +02:00
Dave Smith
67d4fbf337 Add support for overriding the default name/location of the escript; add support for cleaning generated script file
--HG--
extra : rebase_source : 466f440dcb699e031c5c520d28ee7731b60c535a
2010-10-19 14:21:41 -06:00
David Reid
968ef1cc77 First pass at updating dependencies (svn, hg, bzr untested) 2010-10-03 08:22:47 -07:00
Oscar Hellström
8ea62597ff Use eunit_dir() instead of ?EUNIT_DIR since the function exists.
The eunit_dir() does use the ?EUNIT_DIR macro internally, but it also builds, what I guess is, an absolute path, which might be better :) At least it's more consistent.
2010-08-24 21:59:59 +02:00
Oscar Hellström
8c03d5959b Make sure *both* .eunit and ebin directory exists before setting up the code path.
Normally the ebin directory doesn't contain any source files. Therefore it won't be kept in the repository by, at least, mercurial and also maybe git unless you put some .keep file in it or do some other hack. The ebin directory is created by rebar compile, but if rebar eunit is called before rebar compile, you end up with a {'EXIT', {{badmatch,{error,bad_directory}},...}. Another approach would be not to match cod:add_pathz(ebin_dir()) with ok, but I think this is an ok solution as well.
2010-08-24 21:54:54 +02:00
Tuncer Ayaz
79546e66ff Add spec: rebar_utils:abort/2 does not return
Thanks to Kostis for no_return() result type.
2010-10-15 18:10:20 +02:00