diff options
author | Tristan Sloughter <[email protected]> | 2013-09-16 20:17:21 -0500 |
---|---|---|
committer | Tristan Sloughter <[email protected]> | 2013-09-16 22:23:59 -0500 |
commit | ccc364318f5b62f82729b674a63f0daf281cec5d (patch) | |
tree | 87900f6d41d7baf33736b38eadf9cff1392ce349 | |
parent | f181be47501f33c7d24d7dd1e03efeee28f1477e (diff) | |
download | relx-ccc364318f5b62f82729b674a63f0daf281cec5d.tar.gz relx-ccc364318f5b62f82729b674a63f0daf281cec5d.tar.bz2 relx-ccc364318f5b62f82729b674a63f0daf281cec5d.zip |
keep application type of none for rel file
-rw-r--r-- | src/rlx_release.erl | 20 | ||||
-rw-r--r-- | test/rlx_release_SUITE.erl | 40 |
2 files changed, 49 insertions, 11 deletions
diff --git a/src/rlx_release.erl b/src/rlx_release.erl index 471a6f7..b86e5ff 100644 --- a/src/rlx_release.erl +++ b/src/rlx_release.erl @@ -81,10 +81,10 @@ -type application_constraint() :: rlx_depsolver:raw_constraint() | string() | binary(). -type application_goal() :: application_constraint() | {application_constraint(), app_type() | incl_apps()} - | {application_constraint(), app_type(), incl_apps() | none}. + | {application_constraint(), app_type(), incl_apps() | void}. -type annotations() :: ec_dictionary:dictionary(app_name(), - {app_type(), incl_apps() | none}). + {app_type(), incl_apps() | void}). -opaque t() :: record(release_t). @@ -267,27 +267,27 @@ create_app_spec(Annots, App, ActiveApps, LibraryApps) -> true -> load; false -> - none + void end, BaseAnnots = try case ec_dictionary:get(AppName, Annots) of - {none, Incld} -> + {void, Incld} -> {TypeAnnot, Incld}; Else -> Else end catch throw:not_found -> - {TypeAnnot, none} + {TypeAnnot, void} end, Vsn = rlx_app_info:vsn_as_string(App), case BaseAnnots of - {none, none} -> + {void, void} -> {AppName, Vsn}; - {Type, none} -> + {Type, void} -> {AppName, Vsn, Type}; - {none, Incld0} -> + {void, Incld0} -> {AppName, Vsn, Incld0}; {Type, Incld1} -> {AppName, Vsn, Type, Incld1} @@ -314,7 +314,7 @@ parse_goal0({Constraint0, Annots}, {ok, Release}) Annots =:= none -> case parse_constraint(Constraint0) of {ok, Constraint1} -> - parse_goal1(Release, Constraint1, {Annots, none}); + parse_goal1(Release, Constraint1, {Annots, void}); Error -> Error end; @@ -334,7 +334,7 @@ parse_goal0({Constraint0, Annots, Incls}, {ok, Release}) parse_goal0(Constraint0, {ok, Release}) -> case parse_constraint(Constraint0) of {ok, Constraint1} -> - parse_goal1(Release, Constraint1, {none, none}); + parse_goal1(Release, Constraint1, {void, void}); Error -> Error end; diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index b862bfa..0684917 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -29,6 +29,7 @@ make_overridden_release/1, make_skip_app_release/1, make_auto_skip_empty_app_release/1, + make_app_type_none_release/1, make_rerun_overridden_release/1, make_implicit_config_release/1, overlay_release/1, @@ -63,8 +64,8 @@ init_per_testcase(_, Config) -> all() -> [make_release, make_scriptless_release, make_overridden_release, - make_skip_app_release, make_auto_skip_empty_app_release, + make_skip_app_release, make_app_type_none_release, make_implicit_config_release, make_rerun_overridden_release, overlay_release, make_goalless_release, make_depfree_release, make_invalid_config_release, make_relup_release, make_relup_release2, @@ -305,6 +306,43 @@ make_auto_skip_empty_app_release(Config) -> ?assertNot(lists:member({EmptyAppAppName, EmptyAppVsn}, AppSpecs)), ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)). +make_app_type_none_release(Config) -> + LibDir1 = proplists:get_value(lib1, Config), + [(fun({Name, Vsn}) -> + create_app(LibDir1, Name, Vsn, [kernel, stdlib], []) + end)(App) + || + App <- + [{create_random_name("lib_app1_"), create_random_vsn()} + || _ <- lists:seq(1, 100)]], + + create_app(LibDir1, "goal_app_1", "0.0.1", [stdlib,kernel,non_goal_1], []), + create_app(LibDir1, "lib_dep_1", "0.0.1", [stdlib,kernel], []), + create_app(LibDir1, "goal_app_2", "0.0.1", [stdlib,kernel,goal_app_1,non_goal_2], []), + create_app(LibDir1, "non_goal_1", "0.0.1", [stdlib,kernel], [lib_dep_1]), + create_app(LibDir1, "non_goal_2", "0.0.1", [stdlib,kernel], []), + + ConfigFile = filename:join([LibDir1, "relx.config"]), + write_config(ConfigFile, + [{release, {foo, "0.0.1"}, + [goal_app_1, + {goal_app_2, none}]}]), + OutputDir = filename:join([proplists:get_value(data_dir, Config), + create_random_name("relx-output")]), + {ok, Cwd} = file:get_cwd(), + {ok, State} = relx:do(Cwd, undefined, undefined, [], [LibDir1], 2, + OutputDir, [], + ConfigFile), + [{{foo, "0.0.1"}, Release}] = ec_dictionary:to_list(rlx_state:realized_releases(State)), + AppSpecs = rlx_release:applications(Release), + ?assert(lists:keymember(stdlib, 1, AppSpecs)), + ?assert(lists:keymember(kernel, 1, AppSpecs)), + ?assert(lists:member({non_goal_1, "0.0.1"}, AppSpecs)), + ?assert(lists:member({non_goal_2, "0.0.1"}, AppSpecs)), + ?assert(lists:member({goal_app_1, "0.0.1"}, AppSpecs)), + ?assert(lists:member({goal_app_2, "0.0.1", none}, AppSpecs)), + ?assert(lists:member({lib_dep_1, "0.0.1", load}, AppSpecs)). + make_implicit_config_release(Config) -> LibDir1 = proplists:get_value(lib1, Config), FooRoot = filename:join([LibDir1, "foodir1", "foodir2"]), |