Merge pull request #445 from norton/norton-erlc-order

rebar doesn't respect the order of erl_first_files given in the rebar.conf file
This commit is contained in:
Fred Hebert 2015-02-02 11:06:12 -05:00
commit c051530b3c
5 changed files with 26 additions and 10 deletions

View file

@ -31,7 +31,8 @@
-include_lib("eunit/include/eunit.hrl").
-define(MODULES,
[first_xrl,
[after_first_erl,
first_xrl,
first_yrl,
first_erl,
foo,
@ -42,7 +43,8 @@
'SIMPLE-ASN']).
-define(BEAM_FILES,
["first_xrl.beam",
["after_first_erl.beam",
"first_xrl.beam",
"first_yrl.beam",
"first_erl.beam",
"foo.beam",

View file

@ -0,0 +1,11 @@
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
-module(after_first_erl).
-compile({parse_transform, first_erl}).
-include_lib("eunit/include/eunit.hrl").
-export([test/0]).
test() ->
?debugHere.

View file

@ -1,13 +1,13 @@
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
{erl_first_files,
["src/first_xrl.erl", "src/first_yrl.erl", "src/first_erl.erl"]}.
["src/first_xrl.erl", "src/first_yrl.erl", "src/first_erl.erl", "extra-src/after_first_erl.erl"]}.
{deps, [foobar]}.
{erl_opts,
[
{i, "extra-include"},
{src_dirs, ["src", "extra-src"]},
{src_dirs, ["extra-src", "src"]},
{platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'}
]}.

View file

@ -4,7 +4,10 @@
-include_lib("eunit/include/eunit.hrl").
-export([test/0]).
-export([test/0, parse_transform/2]).
test() ->
?debugHere.
parse_transform(Forms, _Options) ->
Forms.

View file

@ -303,11 +303,11 @@ doterl_compile(Config, OutDir, MoreSources, ErlOpts) ->
%% (rebar_config:get_local instead of rebar_config:get_list), consider
%% logging a warning message for any file listed in erl_first_files which
%% wasn't found via gather_src.
{ErlFirstFiles, RestErls} =
lists:partition(
fun(Source) ->
lists:member(Source, ErlFirstFilesConf)
end, AllErlFiles),
RestErls = [File || File <- AllErlFiles,
not lists:member(File, ErlFirstFilesConf)],
%% NOTE: order of files in ErlFirstFiles is important!
ErlFirstFiles = [File || File <- ErlFirstFilesConf,
lists:member(File, AllErlFiles)],
%% Make sure that ebin/ exists and is on the path
ok = filelib:ensure_dir(filename:join("ebin", "dummy.beam")),
CurrPath = code:get_path(),