summaryrefslogtreecommitdiff
path: root/src/rebar_otp_app.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_otp_app.erl')
-rw-r--r--src/rebar_otp_app.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index 49579ae..f55ac6e 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -40,12 +40,11 @@ compile(State, App) ->
%% If we get an .app.src file, it needs to be pre-processed and
%% written out as a ebin/*.app file. That resulting file will then
%% be validated as usual.
- Dir = ec_cnv:to_list(rebar_app_info:dir(App)),
App1 = case rebar_app_info:app_file_src(App) of
undefined ->
App;
AppFileSrc ->
- File = preprocess(State, Dir, AppFileSrc),
+ File = preprocess(State, App, AppFileSrc),
rebar_app_info:app_file(App, File)
end,
@@ -92,13 +91,14 @@ validate_app_modules(State, App, AppData) ->
{ok, rebar_app_info:original_vsn(App, AppVsn)}
end.
-preprocess(State, Dir, AppSrcFile) ->
+preprocess(State, AppInfo, AppSrcFile) ->
case consult_app_file(AppSrcFile) of
{ok, [{application, AppName, AppData}]} ->
%% Look for a configuration file with vars we want to
%% substitute. Note that we include the list of modules available in
%% ebin/ and update the app data accordingly.
- AppVars = load_app_vars(State) ++ [{modules, ebin_modules(Dir)}],
+ OutDir = rebar_app_info:out_dir(AppInfo),
+ AppVars = load_app_vars(State) ++ [{modules, ebin_modules(OutDir)}],
A1 = apply_app_vars(AppVars, AppData),
%% AppSrcFile may contain instructions for generating a vsn number
@@ -113,7 +113,9 @@ preprocess(State, Dir, AppSrcFile) ->
Spec = io_lib:format("~p.\n", [{application, AppName, A3}]),
%% Setup file .app filename and write new contents
- AppFile = rebar_app_utils:app_src_to_app(AppSrcFile),
+ EbinDir = rebar_app_info:ebin_dir(AppInfo),
+ filelib:ensure_dir(filename:join(EbinDir, "dummy.beam")),
+ AppFile = rebar_app_utils:app_src_to_app(OutDir, AppSrcFile),
ok = rebar_file_utils:write_file_if_contents_differ(AppFile, Spec),
%% Make certain that the ebin/ directory is available