aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJordan Wilberding <[email protected]>2013-10-16 20:25:46 -0700
committerJordan Wilberding <[email protected]>2013-10-16 20:25:46 -0700
commite149dfd360e313a9c0b0d2301b49d6137e0b40e6 (patch)
tree7d28d16c878852133e4312e553744d577624e452 /src
parentac1435aeab0e16f3a22428e95b8d895f32917629 (diff)
parent2e6c1d0f1e8e8e6dd913b8a500cf3388c96acd10 (diff)
downloadrelx-e149dfd360e313a9c0b0d2301b49d6137e0b40e6.tar.gz
relx-e149dfd360e313a9c0b0d2301b49d6137e0b40e6.tar.bz2
relx-e149dfd360e313a9c0b0d2301b49d6137e0b40e6.zip
Merge pull request #77 from tsloughter/master
add include_src option to config file, default true. This closes #15
Diffstat (limited to 'src')
-rw-r--r--src/rlx_prv_assembler.erl24
-rw-r--r--src/rlx_prv_config.erl2
-rw-r--r--src/rlx_state.erl10
3 files changed, 27 insertions, 9 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 8a60f52..25fe4ad 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -167,6 +167,7 @@ create_output_dir(OutputDir) ->
copy_app_directories_to_output(State, Release, OutputDir) ->
LibDir = filename:join([OutputDir, "lib"]),
ok = ec_file:mkdir_p(LibDir),
+ IncludeSrc = rlx_state:include_src(State),
Apps = prepare_applications(State, rlx_release:application_details(Release)),
Result = lists:filter(fun({error, _}) ->
true;
@@ -174,7 +175,7 @@ copy_app_directories_to_output(State, Release, OutputDir) ->
false
end,
lists:flatten(ec_plists:map(fun(App) ->
- copy_app(LibDir, App)
+ copy_app(LibDir, App, IncludeSrc)
end, Apps))),
case Result of
[E | _] ->
@@ -191,7 +192,7 @@ prepare_applications(State, Apps) ->
Apps
end.
-copy_app(LibDir, App) ->
+copy_app(LibDir, App, IncludeSrc) ->
AppName = erlang:atom_to_list(rlx_app_info:name(App)),
AppVsn = rlx_app_info:vsn_as_string(App),
AppDir = rlx_app_info:dir(App),
@@ -202,16 +203,16 @@ copy_app(LibDir, App) ->
%% a release dir
ok;
true ->
- copy_app(App, AppDir, TargetDir)
+ copy_app(App, AppDir, TargetDir, IncludeSrc)
end.
-copy_app(App, AppDir, TargetDir) ->
+copy_app(App, AppDir, TargetDir, IncludeSrc) ->
remove_symlink_or_directory(TargetDir),
case rlx_app_info:link(App) of
true ->
link_directory(AppDir, TargetDir);
false ->
- copy_directory(AppDir, TargetDir)
+ copy_directory(AppDir, TargetDir, IncludeSrc)
end.
remove_symlink_or_directory(TargetDir) ->
@@ -235,16 +236,21 @@ link_directory(AppDir, TargetDir) ->
ok
end.
-copy_directory(AppDir, TargetDir) ->
+copy_directory(AppDir, TargetDir, IncludeSrc) ->
ec_plists:map(fun(SubDir) ->
copy_dir(AppDir, TargetDir, SubDir)
end, ["ebin",
"include",
"priv",
- "src",
- "c_src",
"README",
- "LICENSE"]).
+ "LICENSE" |
+ case IncludeSrc of
+ true ->
+ ["src",
+ "c_src"];
+ false ->
+ []
+ end]).
copy_dir(AppDir, TargetDir, SubDir) ->
SubSource = filename:join(AppDir, SubDir),
diff --git a/src/rlx_prv_config.erl b/src/rlx_prv_config.erl
index 5f6dcad..126b497 100644
--- a/src/rlx_prv_config.erl
+++ b/src/rlx_prv_config.erl
@@ -154,6 +154,8 @@ load_terms({overrides, Overrides0}, {ok, State0}) ->
{ok, rlx_state:overrides(State0, Overrides0)};
load_terms({dev_mode, DevMode}, {ok, State0}) ->
{ok, rlx_state:dev_mode(State0, DevMode)};
+load_terms({include_src, IncludeSrc}, {ok, State0}) ->
+ {ok, rlx_state:include_src(State0, IncludeSrc)};
load_terms({release, {RelName, Vsn}, Applications}, {ok, State0}) ->
Release0 = rlx_release:new(RelName, Vsn),
case rlx_release:goals(Release0, Applications) of
diff --git a/src/rlx_state.erl b/src/rlx_state.erl
index 81f9fca..4e76a3f 100644
--- a/src/rlx_state.erl
+++ b/src/rlx_state.erl
@@ -63,6 +63,8 @@
caller/2,
dev_mode/1,
dev_mode/2,
+ include_src/1,
+ include_src/2,
upfrom/1,
format/1,
format/2]).
@@ -91,6 +93,7 @@
configured_releases :: releases(),
realized_releases :: releases(),
dev_mode=false :: boolean(),
+ include_src=true :: boolean(),
upfrom :: string() | binary() | undefined,
config_values :: ec_dictionary:dictionary(Key::atom(),
Value::term())}).
@@ -328,6 +331,13 @@ dev_mode(#state_t{dev_mode=DevMode}) ->
dev_mode(S, DevMode) ->
S#state_t{dev_mode=DevMode}.
+-spec include_src(t()) -> boolean().
+include_src(#state_t{include_src=IncludeSrc}) ->
+ IncludeSrc.
+
+-spec include_src(t(), boolean()) -> t().
+include_src(S, IncludeSrc) ->
+ S#state_t{include_src=IncludeSrc}.
-spec upfrom(t()) -> string() | binary() | undefined.
upfrom(#state_t{upfrom=UpFrom}) ->