Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

57 строки
1.7 KiB

  1. -module(tdeps2_rt).
  2. -compile(export_all).
  3. %% Exercise transitive dependencies where there are multiple files
  4. %% depending on the same set of deps
  5. %% [A1, A2] -> B -> C ; A1 and A2 includes B.hrl which includes C.hrl
  6. files() ->
  7. [
  8. %% A1 application
  9. {create, "apps/a1/ebin/a1.app", app(a1, [a1])},
  10. {copy, "a.rebar.config", "apps/a1/rebar.config"},
  11. {template, "a.erl", "apps/a1/src/a1.erl", dict:from_list([{module, a1}])},
  12. %% A2 application
  13. {create, "apps/a2/ebin/a2.app", app(a2, [a2])},
  14. {copy, "a.rebar.config", "apps/a2/rebar.config"},
  15. {template, "a.erl", "apps/a2/src/a2.erl", dict:from_list([{module, a2}])},
  16. {copy, "root.rebar.config", "rebar.config"},
  17. {copy, "../../rebar", "rebar"},
  18. %% B application
  19. {create, "repo/b/ebin/b.app", app(b, [])},
  20. {copy, "b.rebar.config", "repo/b/rebar.config"},
  21. {copy, "b.hrl", "repo/b/include/b.hrl"},
  22. %% C application
  23. {create, "repo/c/ebin/c.app", app(c, [])},
  24. {copy, "c.hrl", "repo/c/include/c.hrl"}
  25. ].
  26. run(_Dir) ->
  27. %% Initialize the b/c apps as mercurial repos so that dependencies pull
  28. %% properly
  29. HgCmd = "/bin/sh -c \"hg init && hg add && hg commit -m 'Initial commit'\"",
  30. {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/b"}]),
  31. {ok, _} = retest_sh:run(HgCmd, [{dir, "repo/c"}]),
  32. {ok, _} = retest_sh:run("./rebar -v get-deps compile", []),
  33. ok.
  34. %%
  35. %% Generate the contents of a simple .app file
  36. %%
  37. app(Name, Modules) ->
  38. App = {application, Name,
  39. [{description, atom_to_list(Name)},
  40. {vsn, "1"},
  41. {modules, Modules},
  42. {registered, []},
  43. {applications, [kernel, stdlib]}]},
  44. io_lib:format("~p.\n", [App]).