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"). -include_lib("eunit/include/eunit.hrl").
-define(MODULES, -define(MODULES,
[first_xrl, [after_first_erl,
first_xrl,
first_yrl, first_yrl,
first_erl, first_erl,
foo, foo,
@ -42,7 +43,8 @@
'SIMPLE-ASN']). 'SIMPLE-ASN']).
-define(BEAM_FILES, -define(BEAM_FILES,
["first_xrl.beam", ["after_first_erl.beam",
"first_xrl.beam",
"first_yrl.beam", "first_yrl.beam",
"first_erl.beam", "first_erl.beam",
"foo.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 -*- %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et %% ex: ts=4 sw=4 ft=erlang et
{erl_first_files, {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]}. {deps, [foobar]}.
{erl_opts, {erl_opts,
[ [
{i, "extra-include"}, {i, "extra-include"},
{src_dirs, ["src", "extra-src"]}, {src_dirs, ["extra-src", "src"]},
{platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'} {platform_define, "R13|R14", 'NO_CALLBACK_ATTRIBUTE'}
]}. ]}.

View file

@ -4,7 +4,10 @@
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-export([test/0]). -export([test/0, parse_transform/2]).
test() -> test() ->
?debugHere. ?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 %% (rebar_config:get_local instead of rebar_config:get_list), consider
%% logging a warning message for any file listed in erl_first_files which %% logging a warning message for any file listed in erl_first_files which
%% wasn't found via gather_src. %% wasn't found via gather_src.
{ErlFirstFiles, RestErls} = RestErls = [File || File <- AllErlFiles,
lists:partition( not lists:member(File, ErlFirstFilesConf)],
fun(Source) -> %% NOTE: order of files in ErlFirstFiles is important!
lists:member(Source, ErlFirstFilesConf) ErlFirstFiles = [File || File <- ErlFirstFilesConf,
end, AllErlFiles), lists:member(File, AllErlFiles)],
%% Make sure that ebin/ exists and is on the path %% Make sure that ebin/ exists and is on the path
ok = filelib:ensure_dir(filename:join("ebin", "dummy.beam")), ok = filelib:ensure_dir(filename:join("ebin", "dummy.beam")),
CurrPath = code:get_path(), CurrPath = code:get_path(),