From d4c2332aabb4337b49bb3ef03793408c58afd5d4 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 25 Feb 2015 09:49:45 -0600 Subject: make base_dir for a run include the profiles in path, link to shared deps --- src/rebar_dir.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/rebar_dir.erl') diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl index 3962bf8..388b4c6 100644 --- a/src/rebar_dir.erl +++ b/src/rebar_dir.erl @@ -23,7 +23,10 @@ -spec base_dir(rebar_state:t()) -> file:filename_all(). base_dir(State) -> - rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR). + Profiles = rebar_state:current_profiles(State), + ProfilesStrings = [ec_cnv:to_list(P) || P <- Profiles], + ProfilesDir = string:join(ProfilesStrings, "+"), + filename:join(rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), ProfilesDir). -spec deps_dir(rebar_state:t()) -> file:filename_all(). deps_dir(State) -> -- cgit v1.1 From ae9c83fb4bafd3f2faf849c931ba440053f5cb97 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Thu, 26 Feb 2015 09:11:59 -0600 Subject: copy project apps to deps output dir for compilation --- src/rebar_dir.erl | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/rebar_dir.erl') diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl index 388b4c6..acf79cd 100644 --- a/src/rebar_dir.erl +++ b/src/rebar_dir.erl @@ -14,8 +14,6 @@ get_cwd/0, template_globals/1, template_dir/1, - src_dirs/1, - ebin_dir/0, processing_base_dir/1, processing_base_dir/2]). @@ -81,15 +79,6 @@ template_globals(State) -> template_dir(State) -> filename:join([global_config_dir(State), "templates"]). --spec src_dirs([string()]) -> [file:filename(), ...]. -src_dirs([]) -> - ["src"]; -src_dirs(SrcDirs) -> - SrcDirs. - -ebin_dir() -> - filename:join(get_cwd(), "ebin"). - processing_base_dir(State) -> Cwd = get_cwd(), processing_base_dir(State, Cwd). -- cgit v1.1 From 675044bc83cedd330d4edee90f9912dff221eb2a Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 28 Feb 2015 14:44:32 -0600 Subject: use relative path on non-windows and copy if link fails --- src/rebar_dir.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/rebar_dir.erl') diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl index acf79cd..fd80fa7 100644 --- a/src/rebar_dir.erl +++ b/src/rebar_dir.erl @@ -15,7 +15,8 @@ template_globals/1, template_dir/1, processing_base_dir/1, - processing_base_dir/2]). + processing_base_dir/2, + make_relative_path/2]). -include("rebar.hrl"). @@ -86,3 +87,12 @@ processing_base_dir(State) -> processing_base_dir(State, Dir) -> AbsDir = filename:absname(Dir), AbsDir =:= rebar_state:get(State, base_dir). + +make_relative_path(Source, Target) -> + do_make_relative_path(filename:split(Source), filename:split(Target)). + +do_make_relative_path([H|T1], [H|T2]) -> + do_make_relative_path(T1, T2); +do_make_relative_path(Source, Target) -> + Base = lists:duplicate(max(length(Target) - 1, 0), ".."), + filename:join(Base ++ Source). -- cgit v1.1