From 252b31f2a4b95670ef75a6a712788af977e869e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 15 May 2013 23:56:45 +0100 Subject: Fix searching for plugins If a plugin is in a dependency, rebar didn't search for it carefully enough. --- inttest/depplugins/depplugins_rt.erl | 50 +++++++++++++++++++++++++ inttest/depplugins/rebar.config | 1 + inttest/depplugins/rebar_dependsonplugin.config | 2 + inttest/depplugins/testplugin_mod.erl | 6 +++ 4 files changed, 59 insertions(+) create mode 100644 inttest/depplugins/depplugins_rt.erl create mode 100644 inttest/depplugins/rebar.config create mode 100644 inttest/depplugins/rebar_dependsonplugin.config create mode 100644 inttest/depplugins/testplugin_mod.erl (limited to 'inttest') diff --git a/inttest/depplugins/depplugins_rt.erl b/inttest/depplugins/depplugins_rt.erl new file mode 100644 index 0000000..7b106eb --- /dev/null +++ b/inttest/depplugins/depplugins_rt.erl @@ -0,0 +1,50 @@ +%%% @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"}, + {create, "ebin/fish.app", app(fish, [])}, + + {create, "deps/dependsonplugin/ebin/dependsonplugin.app", + app(dependsonplugin, [])}, + {copy, "rebar_dependsonplugin.config", + "deps/dependsonplugin/rebar.config"}, + {copy, "testplugin_mod.erl", + "deps/testplugin/plugins/testplugin_mod.erl"}, + {create, "deps/testplugin/ebin/testplugin.app", + app(testplugin, [])} + ]. + +run(_Dir) -> + ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])), + ?assertEqual(true, filelib:is_regular("deps/dependsonplugin/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]). diff --git a/inttest/depplugins/rebar.config b/inttest/depplugins/rebar.config new file mode 100644 index 0000000..3a2e34e --- /dev/null +++ b/inttest/depplugins/rebar.config @@ -0,0 +1 @@ +{deps, [dependsonplugin]}. diff --git a/inttest/depplugins/rebar_dependsonplugin.config b/inttest/depplugins/rebar_dependsonplugin.config new file mode 100644 index 0000000..df36213 --- /dev/null +++ b/inttest/depplugins/rebar_dependsonplugin.config @@ -0,0 +1,2 @@ +{deps, [testplugin]}. +{plugins, [testplugin_mod]}. diff --git a/inttest/depplugins/testplugin_mod.erl b/inttest/depplugins/testplugin_mod.erl new file mode 100644 index 0000000..055bbc7 --- /dev/null +++ b/inttest/depplugins/testplugin_mod.erl @@ -0,0 +1,6 @@ +-module(testplugin_mod). +-compile(export_all). + +pre_compile(Config, _) -> + ok = file:write_file("pre.compile", <<"Yadda!">>), + rebar_log:log(info, "Wrote ~p/pre.compile~n", [rebar_utils:get_cwd()]). -- cgit v1.1