Fix out of order dep builds
This commit is contained in:
parent
e397d57ef2
commit
6bce1ba536
@ -1 +1 @@
|
||||
0.12.8
|
||||
0.13.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{application,zx,
|
||||
[{description,"An Erlang development tool and Zomp user client"},
|
||||
{vsn,"0.12.8"},
|
||||
{vsn,"0.13.0"},
|
||||
{applications,[stdlib,kernel]},
|
||||
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
|
||||
zx_lib,zx_local,zx_net,zx_peer,zx_peer_man,
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -24,7 +24,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -1049,66 +1049,86 @@ dep_split([C | Rest], Dep, Dir, Deps) ->
|
||||
dep_split([], Dep, Dir, Deps) ->
|
||||
{[], [{Dep, lists:reverse(Dir)} | Deps]}.
|
||||
|
||||
pre_prep2(Meta, LocalDeps, RunArgs) ->
|
||||
pre_prep2(Meta, Local, RunArgs) ->
|
||||
Type = maps:get(type, Meta),
|
||||
Deps = maps:get(deps, Meta),
|
||||
case pre_prep3(Deps, LocalDeps) of
|
||||
{ok, NewDeps} -> {Type, NewDeps, RunArgs};
|
||||
Error -> Error
|
||||
MarkedDeps = lists:map(mark(Local), Deps),
|
||||
{Type, MarkedDeps, RunArgs}.
|
||||
|
||||
mark(LocalDeps) ->
|
||||
fun(Dep) ->
|
||||
case is_local(Dep, LocalDeps) of
|
||||
{true, Dir} -> {local, Dep, Dir};
|
||||
false -> {fetch, Dep}
|
||||
end
|
||||
end.
|
||||
|
||||
pre_prep3(Deps, [{Dep, Dir} | Rest]) ->
|
||||
case zx_lib:package_id(Dep) of
|
||||
{ok, PackageID} -> pre_prep4(Deps, PackageID, Dir, Rest);
|
||||
Error -> Error
|
||||
end;
|
||||
pre_prep3(Deps, []) ->
|
||||
{ok, Deps}.
|
||||
|
||||
pre_prep4(Deps, {Realm, Name, _}, Dir, Rest) ->
|
||||
case file:set_cwd(Dir) of
|
||||
ok ->
|
||||
Scrub = fun({R, N, _}) -> not ((R == Realm) andalso (N == Name)) end,
|
||||
NewDeps = lists:filter(Scrub, Deps),
|
||||
true = os:putenv(Name ++ "_include", filename:join(Dir, "include")),
|
||||
ok = zx_lib:build(),
|
||||
pre_prep3(NewDeps, Rest);
|
||||
Error = {error, enoent} ->
|
||||
ok = tell(error, "Dir ~p does not exist!", [Dir]),
|
||||
Error
|
||||
end.
|
||||
is_local({_, N, _}, [{N, Dir} | _]) -> {true, Dir};
|
||||
is_local(D, [_ | T]) -> is_local(D, T);
|
||||
is_local(_, []) -> false.
|
||||
|
||||
|
||||
-spec prepare([zx:package_id()]) -> ok.
|
||||
-spec prepare(Deps) -> ok
|
||||
when Deps :: [Dep],
|
||||
Dep :: {local, zx:package_id(), file:filename()}
|
||||
| {fetch, zx:package_id()}.
|
||||
%% @private
|
||||
%% Execution prep common to all packages.
|
||||
|
||||
prepare(Deps) ->
|
||||
ok = lists:foreach(fun include_env/1, Deps),
|
||||
NotInstalled = fun(P) -> not filelib:is_dir(zx_lib:ppath(lib, P)) end,
|
||||
Needed = lists:filter(NotInstalled, Deps),
|
||||
acquire(Needed, Deps).
|
||||
|
||||
acquire([Dep | Rest], Deps) ->
|
||||
case fetch(Dep) of
|
||||
ok -> acquire(Rest, Deps);
|
||||
Error -> Error
|
||||
end;
|
||||
acquire([], Deps) ->
|
||||
ok = ensure(Deps),
|
||||
make(Deps).
|
||||
|
||||
make([Dep | Rest]) ->
|
||||
ensure([{fetch, Dep} | Rest]) ->
|
||||
case filelib:is_dir(zx_lib:ppath(lib, Dep)) of
|
||||
true ->
|
||||
true = include_env(Dep),
|
||||
ensure(Rest);
|
||||
false ->
|
||||
acquire(Dep, Rest)
|
||||
end;
|
||||
ensure([{local, {_, Name, _}, Dir} | Rest]) ->
|
||||
IncludeName = Name ++ "_include",
|
||||
IncludePath = filename:join(Dir, "include"),
|
||||
true = os:putenv(IncludeName, IncludePath),
|
||||
ensure(Rest);
|
||||
ensure([]) ->
|
||||
ok.
|
||||
|
||||
acquire(Dep, Rest) ->
|
||||
case fetch(Dep) of
|
||||
ok ->
|
||||
true = include_env(Dep),
|
||||
ensure(Rest);
|
||||
Error ->
|
||||
Error
|
||||
end.
|
||||
|
||||
|
||||
make([{fetch, Dep} | Rest]) ->
|
||||
case zx_daemon:build(Dep) of
|
||||
ok -> make(Rest);
|
||||
Error -> Error
|
||||
end;
|
||||
make([{local, _, Dir} | Rest]) ->
|
||||
{ok, WorkingDir} = file:get_cwd(),
|
||||
case file:set_cwd(Dir) of
|
||||
ok ->
|
||||
ok = zx_lib:build(),
|
||||
ok = file:set_cwd(WorkingDir),
|
||||
make(Rest);
|
||||
Error = {error, enoent} ->
|
||||
ok = tell(error, "Dir ~p does not exist!", [Dir]),
|
||||
Error
|
||||
end;
|
||||
make([]) ->
|
||||
ok.
|
||||
|
||||
|
||||
include_env(PackageID = {_, Name, _}) ->
|
||||
Path = filename:join(zx_lib:ppath(lib, PackageID), "include"),
|
||||
os:putenv(Name ++ "_include", Path).
|
||||
IncludeName = Name ++ "_include",
|
||||
IncludePath = filename:join(zx_lib:ppath(lib, PackageID), "include"),
|
||||
os:putenv(IncludeName, IncludePath).
|
||||
|
||||
|
||||
-spec upgrade() -> zx:outcome().
|
||||
@ -1146,6 +1166,8 @@ upgrade() ->
|
||||
-spec fetch(zx:package_id()) -> zx:outcome().
|
||||
|
||||
fetch(PackageID) ->
|
||||
{ok, PackageName} = zx_lib:package_string(PackageID),
|
||||
ok = tell("Fetching ~ts", [PackageName]),
|
||||
{ok, ID} = zx_daemon:fetch(PackageID),
|
||||
fetch2(ID).
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_auth).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn_sup).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -138,7 +138,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_daemon).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_key).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_lib).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_local).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_net).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_man).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_sup).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peers).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_proxy).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_sup).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_tty).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_userconf).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_zsp).
|
||||
-vsn("0.12.8").
|
||||
-vsn("0.13.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
{license,"MIT"}.
|
||||
{modules,[]}.
|
||||
{name,"zx"}.
|
||||
{package_id,{"otpr","zx",{0,12,8}}}.
|
||||
{package_id,{"otpr","zx",{0,13,0}}}.
|
||||
{prefix,"zx_"}.
|
||||
{repo_url,"https://gitlab.com/zxq9/zx"}.
|
||||
{tags,["tools","package manager","erlang"]}.
|
||||
Loading…
x
Reference in New Issue
Block a user