anchor.diff:  name_version({Name, #{vsn := Vsn}}) ->
       {Name, Vsn}.
   
  -remove_exclude_apps(AllApps, State) ->
  -    ExcludeApps = rlx_state:exclude_apps(State),
  -    lists:foldl(fun(AppName, Acc) ->
  -                        find_and_remove(AppName, Acc)
  -                end, AllApps, ExcludeApps).
  -
  -find_and_remove(_, []) ->
  -    [];
  -find_and_remove(ExcludeName, [#{name := Name} | Rest]) when ExcludeName =:= Name ->
  -    Rest;
  -find_and_remove(ExcludeName, [H | Rest]) ->
  -    [H | find_and_remove(ExcludeName, Rest)].
  -
   %% Applications are first searched for in the `Apps' variable which is a map
   %% of application name to `rlx_app_info' map. This variable is passed to `relx'
   %% function calls to build the release or tarball
  
positive.code:                                       World,
                                        sets:add_element(Name, Seen),
                                        LibDirs,
                                        CheckCodeLibDirs),
              %% place the deps of the App ahead of it
              {Apps ++ [AppInfo], Seen2}
      end.
  
  fold_apps(Apps, World, Seen, LibDirs, CheckCodeLibDirs) ->
      lists:foldl(fun(App, {AppAcc, SeenAcc}) ->
                          {NewApps, SeenAcc1} = subset(App, World, SeenAcc, LibDirs, CheckCodeLibDirs),
                          %% put new apps after the existing list to keep the user defined order
                          {AppAcc ++ NewApps, SeenAcc1}
                  end, {[], Seen}, Apps).
  
negative.code:                         {false, [SystemLibs | LibDirs]}
                  end,
  
              ExcludeApps = rlx_state:exclude_apps(State1),
              Pkgs = subset(Goals, AllApps, LibDirs1, CheckCodeLibDirs, ExcludeApps),
              set_resolved(Release, Pkgs, State1)
      end.
  
  %% find the app_info records for each application and its deps needed for the release
  subset(Goals, World, LibDirs, CheckCodeLibDirs, ExcludeApps) ->
      {Apps, _} = fold_apps(Goals, World, sets:new(), LibDirs, CheckCodeLibDirs, ExcludeApps),
      Apps.
  
  subset(Goal, World, Seen, LibDirs, CheckCodeLibDirs, ExcludeApps) ->
      {Name, Vsn} = name_version(Goal),
      case sets:is_element(Name, Seen) of
          true ->
  