Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

51 linhas
1.4 KiB

há 14 anos
  1. -module(tdeps1_rt).
  2. -compile(export_all).
  3. %% Exercise transitive dependencies
  4. %% A -> B -> C, where A includes a .hrl from B which includes .hrl from C
  5. files() ->
  6. [
  7. %% A application
  8. {create, "ebin/a.app", app(a, [a])},
  9. {copy, "a.rebar.config", "rebar.config"},
  10. {copy, "a.erl", "src/a.erl"},
  11. {copy, "../../rebar", "rebar"},
  12. %% B application
  13. {create, "repo/b/ebin/b.app", app(b, [])},
  14. {copy, "b.rebar.config", "repo/b/rebar.config"},
  15. {copy, "b.hrl", "repo/b/include/b.hrl"},
  16. %% C application
  17. {create, "repo/c/ebin/c.app", app(c, [])},
  18. {copy, "c.hrl", "repo/c/include/c.hrl"}
  19. ].
  20. run(_Dir) ->
  21. %% Initialize the b/c apps as mercurial repos so that dependencies pull
  22. %% properly
  23. HgCmd = "/bin/sh -c \"hg init && hg add && hg commit -m 'Initial commit'\"",
  24. {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/b"}]),
  25. {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/c"}]),
  26. {ok, _} = retest_sh:run("./rebar get-deps compile", []),
  27. true = filelib:is_regular("ebin/a.beam"),
  28. ok.
  29. %%
  30. %% Generate the contents of a simple .app file
  31. %%
  32. app(Name, Modules) ->
  33. App = {application, Name,
  34. [{description, atom_to_list(Name)},
  35. {vsn, "1"},
  36. {modules, Modules},
  37. {registered, []},
  38. {applications, [kernel, stdlib]}]},
  39. io_lib:format("~p.\n", [App]).