From fb67eb0ee95b2f03dc6c51535ab4b18ea70d315f Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Mon, 4 Dec 2017 09:34:52 -0500 Subject: Fix Plugin path handling (again!) The path reloading of plugins had been fixed properly, but the problem is that the paths it was using to re-load only considered the current compile step, rather than the overall state of plugins. As such, the reloaded paths after plugin compilation only reloaded the *latest* plugin and not the other ones. This fix forces the addition of all built plugin paths to the code paths after a plugin compile job is run. This ensures that the path is clean for initial plugin deps (only add those that are required), and is re-made total after the fact (add all the plugins possible). This commit also includes a system tests suite that can be run optionally; the problem with this plugin mechanism was impossible to find through mocked dependencies, and a working counterexample was provided to us. The systest suite can be run against real projects without conflict to make sure no regressions are hit. --- .../all_SUITE_data/resource_plugins/rebar.config | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 systest/all_SUITE_data/resource_plugins/rebar.config (limited to 'systest/all_SUITE_data') diff --git a/systest/all_SUITE_data/resource_plugins/rebar.config b/systest/all_SUITE_data/resource_plugins/rebar.config new file mode 100644 index 0000000..7baec1f --- /dev/null +++ b/systest/all_SUITE_data/resource_plugins/rebar.config @@ -0,0 +1,23 @@ +%% Sample provided by @tothlac +{plugins, [ + {rebar_tidy_deps, ".*", {git, "https://github.com/ferd/rebar3-tidy-deps-plugin.git"}}, + {rebar_alias, {git, "https://github.com/tsloughter/rebar_alias.git"}}, + rebar3_appup_plugin +]}. + +{deps, [ + {hackney, {git, "https://github.com/benoitc/hackney.git", {tag, "1.10.1"}}} + ]}. + + +%% Make work despite compat issues with strings and warnings +{overrides, [ + {override, rebar3_appup_plugin, [ + {erl_opts, [ + {platform_define, "^19", brutal_purge_fixed}, + {platform_define, "^2", brutal_purge_fixed}, + %% warnings_as_errors, + debug_info + ]} + ]} +]}. -- cgit v1.1 From 553a579b36fe0fb4a8bf464cd282d43c07d4e192 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 5 Dec 2017 07:47:07 -0500 Subject: Alias plugin promoted to built-in command - Uses the code at https://github.com/tsloughter/rebar_alias and brings it within rebar3 - adds safety checks to prevent redefining built-in commands or obvious circular dependencies between commands (indirect circular deps are still possible) - adds tests - adds a systest to ensure no clash with the existing plugin --- systest/all_SUITE_data/alias_clash/rebar.config | 4 ++++ .../all_SUITE_data/alias_clash/src/alias_clash.app.src | 15 +++++++++++++++ systest/all_SUITE_data/alias_clash/src/alias_clash.erl | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 systest/all_SUITE_data/alias_clash/rebar.config create mode 100644 systest/all_SUITE_data/alias_clash/src/alias_clash.app.src create mode 100644 systest/all_SUITE_data/alias_clash/src/alias_clash.erl (limited to 'systest/all_SUITE_data') diff --git a/systest/all_SUITE_data/alias_clash/rebar.config b/systest/all_SUITE_data/alias_clash/rebar.config new file mode 100644 index 0000000..baf20a9 --- /dev/null +++ b/systest/all_SUITE_data/alias_clash/rebar.config @@ -0,0 +1,4 @@ +{alias, [{help, [version]}, % should be skipped, but be overriden by plugin + {test, [compile, {eunit, "-c"}, cover]}]}. + +{plugins, [rebar_alias]}. % should be overridden diff --git a/systest/all_SUITE_data/alias_clash/src/alias_clash.app.src b/systest/all_SUITE_data/alias_clash/src/alias_clash.app.src new file mode 100644 index 0000000..b4cdda2 --- /dev/null +++ b/systest/all_SUITE_data/alias_clash/src/alias_clash.app.src @@ -0,0 +1,15 @@ +{application, alias_clash, + [{description, "An OTP library"}, + {vsn, "0.1.0"}, + {registered, []}, + {applications, + [kernel, + stdlib + ]}, + {env,[]}, + {modules, []}, + + {maintainers, []}, + {licenses, ["Apache 2.0"]}, + {links, []} + ]}. diff --git a/systest/all_SUITE_data/alias_clash/src/alias_clash.erl b/systest/all_SUITE_data/alias_clash/src/alias_clash.erl new file mode 100644 index 0000000..9249cdb --- /dev/null +++ b/systest/all_SUITE_data/alias_clash/src/alias_clash.erl @@ -0,0 +1,13 @@ +-module(alias_clash). + +%% API exports +-export([]). + +%%==================================================================== +%% API functions +%%==================================================================== + + +%%==================================================================== +%% Internal functions +%%==================================================================== -- cgit v1.1 From d45bacb73bd1a255a5042929a49c81ab298df946 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 5 Dec 2017 13:05:14 -0500 Subject: Run a soft purge while within the compiler step Prevents the killing of a plugin with itself --- systest/all_SUITE_data/grisp_explode/rebar.config | 16 ++++++++++++++++ systest/all_SUITE_data/grisp_explode/rebar.lock | 8 ++++++++ .../grisp_explode/src/mygrispproject.app.src | 17 +++++++++++++++++ .../grisp_explode/src/mygrispproject.erl | 15 +++++++++++++++ .../grisp_explode/src/mygrispproject_sup.erl | 19 +++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 systest/all_SUITE_data/grisp_explode/rebar.config create mode 100644 systest/all_SUITE_data/grisp_explode/rebar.lock create mode 100644 systest/all_SUITE_data/grisp_explode/src/mygrispproject.app.src create mode 100644 systest/all_SUITE_data/grisp_explode/src/mygrispproject.erl create mode 100644 systest/all_SUITE_data/grisp_explode/src/mygrispproject_sup.erl (limited to 'systest/all_SUITE_data') diff --git a/systest/all_SUITE_data/grisp_explode/rebar.config b/systest/all_SUITE_data/grisp_explode/rebar.config new file mode 100644 index 0000000..43c9f63 --- /dev/null +++ b/systest/all_SUITE_data/grisp_explode/rebar.config @@ -0,0 +1,16 @@ +{deps, [grisp]}. + +{plugins, [{rebar3_grisp, "0.1.0"}]}. + +{erl_opts, [debug_info]}. + +{grisp, [ + {otp_release, "19"}, + {deploy, [ + {destination, "/path/to/SD-card"} + ]} +]}. + +{relx, [ + {release, {mygrispproject, "0.1.0"}, [mygrispproject]} +]}. diff --git a/systest/all_SUITE_data/grisp_explode/rebar.lock b/systest/all_SUITE_data/grisp_explode/rebar.lock new file mode 100644 index 0000000..2523b13 --- /dev/null +++ b/systest/all_SUITE_data/grisp_explode/rebar.lock @@ -0,0 +1,8 @@ +{"1.1.0", +[{<<"grisp">>,{pkg,<<"grisp">>,<<"0.1.1">>},0}, + {<<"mapz">>,{pkg,<<"mapz">>,<<"0.3.0">>},1}]}. +[ +{pkg_hash,[ + {<<"grisp">>, <<"5A1318E7B1582D7C5B1E446D149A6F93428A380BCFE7D740E57E4F6B6CDB19DD">>}, + {<<"mapz">>, <<"438D24746CE5A252101E00B2032EFDF7FC69EB32689D3B805DE5E6DD7F52614F">>}]} +]. diff --git a/systest/all_SUITE_data/grisp_explode/src/mygrispproject.app.src b/systest/all_SUITE_data/grisp_explode/src/mygrispproject.app.src new file mode 100644 index 0000000..0f0a396 --- /dev/null +++ b/systest/all_SUITE_data/grisp_explode/src/mygrispproject.app.src @@ -0,0 +1,17 @@ +{application, mygrispproject, [ + {description, "A GRiSP application"}, + {vsn, "0.1.0"}, + {registered, []}, + {mod, {mygrispproject, []}}, + {applications, [ + kernel, + stdlib, + grisp + ]}, + {env,[]}, + {modules, []}, + + {maintainers, []}, + {licenses, ["Apache 2.0"]}, + {links, []} +]}. diff --git a/systest/all_SUITE_data/grisp_explode/src/mygrispproject.erl b/systest/all_SUITE_data/grisp_explode/src/mygrispproject.erl new file mode 100644 index 0000000..a9152fe --- /dev/null +++ b/systest/all_SUITE_data/grisp_explode/src/mygrispproject.erl @@ -0,0 +1,15 @@ +% @doc mygrispproject public API. +% @end +-module(mygrispproject). + +-behavior(application). + +% Callbacks +-export([start/2]). +-export([stop/1]). + +%--- Callbacks ----------------------------------------------------------------- + +start(_Type, _Args) -> mygrispproject_sup:start_link(). + +stop(_State) -> ok. diff --git a/systest/all_SUITE_data/grisp_explode/src/mygrispproject_sup.erl b/systest/all_SUITE_data/grisp_explode/src/mygrispproject_sup.erl new file mode 100644 index 0000000..aef0d4f --- /dev/null +++ b/systest/all_SUITE_data/grisp_explode/src/mygrispproject_sup.erl @@ -0,0 +1,19 @@ +% @doc mygrispproject top level supervisor. +% @end +-module(mygrispproject_sup). + +-behavior(supervisor). + +% API +-export([start_link/0]). + +% Callbacks +-export([init/1]). + +%--- API ----------------------------------------------------------------------- + +start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%--- Callbacks ----------------------------------------------------------------- + +init([]) -> {ok, { {one_for_all, 0, 1}, []} }. -- cgit v1.1 From 8a6059861c78d6e5b74f48cf2cba717becbebc3b Mon Sep 17 00:00:00 2001 From: hommeabeil Date: Sat, 24 Mar 2018 09:47:52 -0400 Subject: add test in systest --- systest/all_SUITE_data/compile_deps/rebar.config | 8 ++++++++ systest/all_SUITE_data/compile_deps/rebar.config.script | 2 ++ .../compile_deps/vendored/fake_dep/rebar.config | 2 ++ .../compile_deps/vendored/fake_dep/src/fake_dep.app.src | 15 +++++++++++++++ .../compile_deps/vendored/fake_dep/src/fake_dep.erl | 13 +++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 systest/all_SUITE_data/compile_deps/rebar.config create mode 100644 systest/all_SUITE_data/compile_deps/rebar.config.script create mode 100644 systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config create mode 100644 systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src create mode 100644 systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl (limited to 'systest/all_SUITE_data') diff --git a/systest/all_SUITE_data/compile_deps/rebar.config b/systest/all_SUITE_data/compile_deps/rebar.config new file mode 100644 index 0000000..08e2f62 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/rebar.config @@ -0,0 +1,8 @@ +{deps, [ + {fake_dep, {localdep, "fake_dep"}} + ]}. + +{plugins, [{rebar_localdep, + {git, "https://github.com/alinpopa/rebar3-localdep-plugin.git", + {branch, "master"}}}]}. + diff --git a/systest/all_SUITE_data/compile_deps/rebar.config.script b/systest/all_SUITE_data/compile_deps/rebar.config.script new file mode 100644 index 0000000..c0ebab1 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/rebar.config.script @@ -0,0 +1,2 @@ +os:putenv("LOCALDEP_DIR", "./vendored/"). +CONFIG. diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config new file mode 100644 index 0000000..f618f3e --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config @@ -0,0 +1,2 @@ +{erl_opts, [debug_info]}. +{deps, []}. \ No newline at end of file diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src new file mode 100644 index 0000000..8547c35 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src @@ -0,0 +1,15 @@ +{application, fake_dep, + [{description, "An OTP library"}, + {vsn, "0.1.0"}, + {registered, []}, + {applications, + [kernel, + stdlib + ]}, + {env,[]}, + {modules, []}, + + {maintainers, []}, + {licenses, ["Apache 2.0"]}, + {links, []} + ]}. diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl new file mode 100644 index 0000000..db8d9f0 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl @@ -0,0 +1,13 @@ +-module(fake_dep). + +%% API exports +-export([]). + +%%==================================================================== +%% API functions +%%==================================================================== + + +%%==================================================================== +%% Internal functions +%%==================================================================== -- cgit v1.1 From 14efe7055cd3995ae4f367f0f05b2da7a9da2231 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sat, 8 Dec 2018 19:30:22 -0500 Subject: Fixing systest to use up to date plugin prevents some failures when running --- systest/all_SUITE_data/resource_plugins/rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'systest/all_SUITE_data') diff --git a/systest/all_SUITE_data/resource_plugins/rebar.config b/systest/all_SUITE_data/resource_plugins/rebar.config index 7baec1f..7df4a4a 100644 --- a/systest/all_SUITE_data/resource_plugins/rebar.config +++ b/systest/all_SUITE_data/resource_plugins/rebar.config @@ -1,6 +1,6 @@ %% Sample provided by @tothlac {plugins, [ - {rebar_tidy_deps, ".*", {git, "https://github.com/ferd/rebar3-tidy-deps-plugin.git"}}, + {rebar_tidy_deps, ".*", {git, "https://github.com/tothlac/rebar3-tidy-deps-plugin.git"}}, {rebar_alias, {git, "https://github.com/tsloughter/rebar_alias.git"}}, rebar3_appup_plugin ]}. -- cgit v1.1