%%% @doc Plugin handling test %%% %%% This test checks if plugins are loaded correctly. %%% %%% It has three applications: %%%
    %%%
  1. fish. top-level module, has one dependency: `dependsonplugin'.
  2. %%%
  3. dependsonplugin. This depends on some pre-compile actions by the %%% plugin. In the test the plugin creates a file `pre.compile' in the %%% top-level folder of this application.
  4. %%%
  5. testplugin. This is a plugin application which creates the file.
  6. %%%
-module(depplugins_rt). -compile(export_all). -include_lib("eunit/include/eunit.hrl"). files() -> [ {copy, "../../rebar", "rebar"}, {copy, "rebar.config", "rebar.config"}, {copy, "base_dir_cwd_plugin.erl", "base_dir_cwd_plugin.erl"}, {create, "ebin/fish.app", app(fish, [])}, {copy, "rebar_dependsonplugin.config", "deps/dependsonplugin/rebar.config"}, {create, "deps/dependsonplugin/ebin/dependsonplugin.app", app(dependsonplugin, [])}, {copy, "rebar_testplugin.config", "deps/testplugin/rebar.config"}, {copy, "testplugin_mod.erl", "deps/testplugin/plugins/testplugin_mod.erl"}, {copy, "dep_cwd_plugin.erl", "deps/testplugin/dep_cwd_plugin.erl"}, {create, "deps/testplugin/ebin/testplugin.app", app(testplugin, [])} ]. run(_Dir) -> ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])), ?assertEqual(true, filelib:is_regular("base_dir_cwd_pre.compile")), ?assertEqual(true, filelib:is_regular( "deps/dependsonplugin/base_dir_cwd_pre.compile")), ?assertEqual(true, filelib:is_regular( "deps/dependsonplugin/plugin_pre.compile")), ?assertEqual(true, filelib:is_regular( "deps/testplugin/base_dir_cwd_pre.compile")), ?assertEqual(true, filelib:is_regular( "deps/testplugin/dep_cwd_pre.compile")), ?assertEqual(true, filelib:is_regular( "deps/testplugin/plugin_pre.compile")), ok. %% %% Generate the contents of a simple .app file %% app(Name, Modules) -> App = {application, Name, [{description, atom_to_list(Name)}, {vsn, "1"}, {modules, Modules}, {registered, []}, {applications, [kernel, stdlib]}]}, io_lib:format("~p.\n", [App]).