From 45c5956f213ee28a275d139dac4cce480e6111ef Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 9 Jun 2010 10:25:28 -0600 Subject: [PATCH] Adding another transitive dep test --HG-- extra : rebase_source : 1998dc102f89c3c809d5146c800218b5c5b6cba9 --- inttest/tdeps2/a.erl | 4 +++ inttest/tdeps2/a.rebar.config | 2 ++ inttest/tdeps2/b.hrl | 3 ++ inttest/tdeps2/b.rebar.config | 2 ++ inttest/tdeps2/c.hrl | 2 ++ inttest/tdeps2/root.rebar.config | 2 ++ inttest/tdeps2/tdeps2_rt.erl | 57 ++++++++++++++++++++++++++++++++ 7 files changed, 72 insertions(+) create mode 100644 inttest/tdeps2/a.erl create mode 100644 inttest/tdeps2/a.rebar.config create mode 100644 inttest/tdeps2/b.hrl create mode 100644 inttest/tdeps2/b.rebar.config create mode 100644 inttest/tdeps2/c.hrl create mode 100644 inttest/tdeps2/root.rebar.config create mode 100644 inttest/tdeps2/tdeps2_rt.erl diff --git a/inttest/tdeps2/a.erl b/inttest/tdeps2/a.erl new file mode 100644 index 0000000..29538e0 --- /dev/null +++ b/inttest/tdeps2/a.erl @@ -0,0 +1,4 @@ +-module({{module}}). + +-include_lib("b/include/b.hrl"). + diff --git a/inttest/tdeps2/a.rebar.config b/inttest/tdeps2/a.rebar.config new file mode 100644 index 0000000..afeef7a --- /dev/null +++ b/inttest/tdeps2/a.rebar.config @@ -0,0 +1,2 @@ +{deps, [{b, "1", {hg, "../repo/b", "tip"}}]}. + diff --git a/inttest/tdeps2/b.hrl b/inttest/tdeps2/b.hrl new file mode 100644 index 0000000..897f348 --- /dev/null +++ b/inttest/tdeps2/b.hrl @@ -0,0 +1,3 @@ + +-include_lib("c/include/c.hrl"). + diff --git a/inttest/tdeps2/b.rebar.config b/inttest/tdeps2/b.rebar.config new file mode 100644 index 0000000..ced29cc --- /dev/null +++ b/inttest/tdeps2/b.rebar.config @@ -0,0 +1,2 @@ +{deps, [{c, "1", {hg, "../repo/c", "tip"}}]}. + diff --git a/inttest/tdeps2/c.hrl b/inttest/tdeps2/c.hrl new file mode 100644 index 0000000..84cf2d4 --- /dev/null +++ b/inttest/tdeps2/c.hrl @@ -0,0 +1,2 @@ +-define(HELLO, hello). + diff --git a/inttest/tdeps2/root.rebar.config b/inttest/tdeps2/root.rebar.config new file mode 100644 index 0000000..005adfe --- /dev/null +++ b/inttest/tdeps2/root.rebar.config @@ -0,0 +1,2 @@ +{sub_dirs, ["apps/a1", + "apps/a2"]}. diff --git a/inttest/tdeps2/tdeps2_rt.erl b/inttest/tdeps2/tdeps2_rt.erl new file mode 100644 index 0000000..11f9a32 --- /dev/null +++ b/inttest/tdeps2/tdeps2_rt.erl @@ -0,0 +1,57 @@ +-module(tdeps2_rt). + +-compile(export_all). + +%% Exercise transitive dependencies where there are multiple files +%% depending on the same set of deps +%% [A1, A2] -> B -> C ; A1 and A2 includes B.hrl which includes C.hrl + +files() -> + [ + %% A1 application + {create, "apps/a1/ebin/a1.app", app(a1)}, + {copy, "a.rebar.config", "apps/a1/rebar.config"}, + {template, "a.erl", "apps/a1/src/a1.erl", dict:from_list([{module, a1}])}, + + %% A2 application + {create, "apps/a2/ebin/a2.app", app(a2)}, + {copy, "a.rebar.config", "apps/a2/rebar.config"}, + {template, "a.erl", "apps/a2/src/a2.erl", dict:from_list([{module, a2}])}, + + {copy, "root.rebar.config", "rebar.config"}, + {copy, "../../rebar", "rebar"}, + + %% B application + {create, "repo/b/ebin/b.app", app(b)}, + {copy, "b.rebar.config", "repo/b/rebar.config"}, + {copy, "b.hrl", "repo/b/include/b.hrl"}, + + %% C application + {create, "repo/c/ebin/c.app", app(c)}, + {copy, "c.hrl", "repo/c/include/c.hrl"} + ]. + +run(_Dir) -> + %% Initialize the b/c apps as mercurial repos so that dependencies pull + %% properly + HgCmd = "/bin/sh -c \"hg init && hg add && hg commit -m 'Initial commit'\"", + {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/b"}]), + {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/c"}]), + + + {ok, _} = retest_sh:run("./rebar -v get-deps compile", []), + ok. + + + +%% +%% Generate the contents of a simple .app file +%% +app(Name) -> + App = {application, Name, + [{description, atom_to_list(Name)}, + {vsn, "1"}, + {modules, []}, + {registered, []}, + {applications, [kernel, stdlib]}]}, + io_lib:format("~p.\n", [App]).