From d7657ba73228d26bd70553367bb22d5efe1f9ec6 Mon Sep 17 00:00:00 2001 From: Slava Yurin Date: Thu, 15 Jan 2015 11:07:45 +0600 Subject: [PATCH 1/2] Keep order for erl_first_files --- src/rebar_erlc_compiler.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index c4cd7b1..198592d 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -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(), From 27cd98ef1daf53936c0132f81b8c19577c1074b5 Mon Sep 17 00:00:00 2001 From: Joseph Wayne Norton Date: Sun, 25 Jan 2015 23:32:36 -0600 Subject: [PATCH 2/2] Test order for erl_first_files --- inttest/erlc/erlc_rt.erl | 6 ++++-- inttest/erlc/extra-src/after_first_erl.erl | 11 +++++++++++ inttest/erlc/rebar.config | 4 ++-- inttest/erlc/src/first_erl.erl | 5 ++++- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 inttest/erlc/extra-src/after_first_erl.erl diff --git a/inttest/erlc/erlc_rt.erl b/inttest/erlc/erlc_rt.erl index f9fac1e..7e0c5dc 100644 --- a/inttest/erlc/erlc_rt.erl +++ b/inttest/erlc/erlc_rt.erl @@ -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", diff --git a/inttest/erlc/extra-src/after_first_erl.erl b/inttest/erlc/extra-src/after_first_erl.erl new file mode 100644 index 0000000..c8db345 --- /dev/null +++ b/inttest/erlc/extra-src/after_first_erl.erl @@ -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. diff --git a/inttest/erlc/rebar.config b/inttest/erlc/rebar.config index 71d6660..9f2e080 100644 --- a/inttest/erlc/rebar.config +++ b/inttest/erlc/rebar.config @@ -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'} ]}. diff --git a/inttest/erlc/src/first_erl.erl b/inttest/erlc/src/first_erl.erl index 4e9ff20..e5a47e2 100644 --- a/inttest/erlc/src/first_erl.erl +++ b/inttest/erlc/src/first_erl.erl @@ -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.