Browse Source

fix gproc compilation

Maxim Sokhatsky 10 years ago
parent
commit
62332dd562

BIN
mad


+ 5 - 0
src/compile/mad_app.erl

@@ -4,7 +4,11 @@
 
 
 app_src_to_app(Filename) -> filename:basename(Filename, ".app.src") ++ ".app".
 app_src_to_app(Filename) -> filename:basename(Filename, ".app.src") ++ ".app".
 
 
+to_list(X) when is_atom(X) -> atom_to_list(X);
+to_list(X) -> X.
+
 validate_property({modules, _}, Modules) -> {modules, Modules};
 validate_property({modules, _}, Modules) -> {modules, Modules};
+validate_property({vsn, Value}, _) -> {vsn, to_list(Value)};
 validate_property(Else, _) -> Else.
 validate_property(Else, _) -> Else.
 
 
 compile(File,_Inc,Bin,_Opt) ->
 compile(File,_Inc,Bin,_Opt) ->
@@ -27,3 +31,4 @@ add_modules_property(Properties) ->
     case lists:keyfind(modules, 1, Properties) of
     case lists:keyfind(modules, 1, Properties) of
         {modules, _} -> Properties;
         {modules, _} -> Properties;
         _ -> Properties ++ [{modules, []}] end.
         _ -> Properties ++ [{modules, []}] end.
+

+ 1 - 1
src/compile/mad_port.erl

@@ -20,7 +20,7 @@ compile_port(Dir,Specs,Config) ->
            Template = string:join(filelib:wildcard(Dir ++ "/" ++ Files)," ") 
            Template = string:join(filelib:wildcard(Dir ++ "/" ++ Files)," ") 
               ++ " CFLAGS LDFLAGS -o " ++ Dir ++ "/" ++ Out,
               ++ " CFLAGS LDFLAGS -o " ++ Dir ++ "/" ++ Out,
        Args = string:strip(replace_env(Template,Env),both,32),
        Args = string:strip(replace_env(Template,Env),both,32),
-       {Atom,Status,Report} = sh:run("cc",string:tokens(Args," "),binary,Dir,Env),
+       {_,Status,Report} = sh:run("cc",string:tokens(Args," "),binary,Dir,Env),
        case Status == 0 of
        case Status == 0 of
           true -> skip;
           true -> skip;
           false -> io:format("Port Compilation Error: ~p",[Report]) end
           false -> io:format("Port Compilation Error: ~p",[Report]) end

+ 1 - 2
src/compile/mad_script.erl

@@ -2,9 +2,8 @@
 -copyright('Sina Samavati').
 -copyright('Sina Samavati').
 -compile(export_all).
 -compile(export_all).
 
 
-script(ConfigFile, Conf, Name) ->
+script(ConfigFile, Conf, _) ->
     File = ConfigFile ++ ".script",
     File = ConfigFile ++ ".script",
-    Filename = filename:basename(File),
     case file:script(File, [{'CONFIG', Conf}, {'SCRIPT', File}]) of
     case file:script(File, [{'CONFIG', Conf}, {'SCRIPT', File}]) of
         {ok, {error,_}} -> Conf;
         {ok, {error,_}} -> Conf;
         {ok, Out} -> Out;
         {ok, Out} -> Out;

+ 1 - 1
src/mad.app.src

@@ -1,6 +1,6 @@
 {application, mad,
 {application, mad,
  [{description, "MAD VXZ Build Tool"},
  [{description, "MAD VXZ Build Tool"},
-  {vsn, "0.8"},
+  {vsn, "0.8.1"},
   {registered, []},
   {registered, []},
   {applications, [kernel,stdlib]},
   {applications, [kernel,stdlib]},
   {env, []}]}.
   {env, []}]}.

+ 11 - 12
src/mad.erl

@@ -16,7 +16,7 @@ main(Params) ->
     Conf = mad_utils:consult(ConfigFileAbs),
     Conf = mad_utils:consult(ConfigFileAbs),
     Conf1 = mad_script:script(ConfigFileAbs, Conf, ""),
     Conf1 = mad_script:script(ConfigFileAbs, Conf, ""),
 
 
-    Fun = fun({Name,Params}) -> ?MODULE:Name(Cwd, ConfigFile, Conf1, Params) end,
+    Fun = fun({Name,Par}) -> ?MODULE:Name(Cwd, ConfigFile, Conf1, Par) end,
     lists:foreach(Fun, FP).
     lists:foreach(Fun, FP).
 
 
 %% fetch dependencies
 %% fetch dependencies
@@ -41,41 +41,40 @@ compile(Cwd, ConfigFile, Conf, Params) ->
     mad_compile:'compile-apps'(Cwd, ConfigFile, Conf).
     mad_compile:'compile-apps'(Cwd, ConfigFile, Conf).
 
 
 %% reltool apps resolving
 %% reltool apps resolving
-plan(Cwd,ConfigFileName,Config,Params) ->
+plan(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Plan Params: ~p~n",[Params]),
     io:format("Plan Params: ~p~n",[Params]),
-    mad_plan:main([ list_to_atom(filename:basename(App))
-        || App <- filelib:wildcard("{apps,deps}/*"), filelib:is_dir(App) ]).
+    mad_plan:main([]).
 
 
-repl(Cwd,ConfigFileName,Config,Params) ->
+repl(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Repl Params: ~p~n",[Params]),
     io:format("Repl Params: ~p~n",[Params]),
     mad_repl:main(Params).
     mad_repl:main(Params).
 
 
-bundle(Cwd,ConfigFileName,Config,Params) ->
+bundle(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Tool Params: ~p~n",[Params]),
     io:format("Tool Params: ~p~n",[Params]),
     Name = case Params of [] -> mad_utils:cwd(); E -> E end,
     Name = case Params of [] -> mad_utils:cwd(); E -> E end,
     mad_bundle:main(filename:basename(Name)).
     mad_bundle:main(filename:basename(Name)).
 
 
-app(Cwd,ConfigFileName,Config,Params) ->
+app(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Create App Params: ~p~n",[Params]),
     io:format("Create App Params: ~p~n",[Params]),
     mad_create:app(Params).
     mad_create:app(Params).
 
 
-lib(Cwd,ConfigFileName,Config,Params) ->
+lib(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Create Lib Params: ~p~n",[Params]),
     io:format("Create Lib Params: ~p~n",[Params]),
     mad_create:lib(Params).
     mad_create:lib(Params).
 
 
-start(Cwd,ConfigFileName,Config,Params) ->
+start(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Start Params: ~p~n",[Params]),
     io:format("Start Params: ~p~n",[Params]),
     mad_run:start(Params).
     mad_run:start(Params).
 
 
-attach(Cwd,ConfigFileName,Config,Params) ->
+attach(_Cwd,_ConfigFileName,_Config,Params) ->
 %    io:format("Attach Params: ~p~n",[Params]),
 %    io:format("Attach Params: ~p~n",[Params]),
     mad_run:attach(Params).
     mad_run:attach(Params).
 
 
-stop(Cwd,ConfigFileName,Config,Params) ->
+stop(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Stop Params: ~p~n",[Params]),
     io:format("Stop Params: ~p~n",[Params]),
     mad_run:stop(Params).
     mad_run:stop(Params).
 
 
-release(Cwd,ConfigFileName,Config,Params) ->
+release(_Cwd,_ConfigFileName,_Config,Params) ->
     io:format("Release Params: ~p~n",[Params]),
     io:format("Release Params: ~p~n",[Params]),
     mad_release:main(Params).
     mad_release:main(Params).
 
 

+ 1 - 1
src/mad_bundle.erl

@@ -11,7 +11,7 @@ main(App) ->
 read_file(File) -> {ok, Bin} = file:read_file(filename:absname(File)), Bin.
 read_file(File) -> {ok, Bin} = file:read_file(filename:absname(File)), Bin.
 
 
 static() -> Name = "static.gz",
 static() -> Name = "static.gz",
-    {ok,{File,Bin}} = zip:create(Name,
+    {ok,{_,Bin}} = zip:create(Name,
         [F || F <- mad_repl:wildcards(["{apps,deps}/*/priv/**","priv/**"]), not filelib:is_dir(F) ],
         [F || F <- mad_repl:wildcards(["{apps,deps}/*/priv/**","priv/**"]), not filelib:is_dir(F) ],
         [{compress,all},memory]), [ { Name, Bin } ].
         [{compress,all},memory]), [ { Name, Bin } ].
 
 

+ 1 - 1
src/mad_compile.erl

@@ -77,7 +77,7 @@ list(X) -> X.
 erlc(DepPath) ->
 erlc(DepPath) ->
     ErlFiles = filelib:wildcard(DepPath++"/src/**/*.erl"),
     ErlFiles = filelib:wildcard(DepPath++"/src/**/*.erl"),
     io:format("Files: ~s~n\r",[[filename:basename(Erl)++" " ||Erl<-ErlFiles]]),
     io:format("Files: ~s~n\r",[[filename:basename(Erl)++" " ||Erl<-ErlFiles]]),
-    {Res,Status,X} = sh:run("erlc",["-o"++DepPath++"/ebin/","-I"++DepPath++"/include"]++
+    {_,Status,X} = sh:run("erlc",["-o"++DepPath++"/ebin/","-I"++DepPath++"/include"]++
         ErlFiles,binary,filename:absname("."),[{"ERL_LIBS","apps:deps"}]),
         ErlFiles,binary,filename:absname("."),[{"ERL_LIBS","apps:deps"}]),
     case Status == 0 of
     case Status == 0 of
          true -> skip;
          true -> skip;

+ 1 - 1
src/mad_create.erl

@@ -15,4 +15,4 @@ app(Params) ->
        _ -> skip
        _ -> skip
        end || {File,Bin} <-Apps].
        end || {File,Bin} <-Apps].
 
 
-lib(Params) -> ok.
+lib(_) -> ok.

+ 6 - 7
src/mad_plan.erl

@@ -2,18 +2,17 @@
 -author('Maxim Sokhatsky').
 -author('Maxim Sokhatsky').
 -compile(export_all).
 -compile(export_all).
 
 
-sort(Pairs) -> iterate(Pairs, [], all(Pairs)).
+sort(Pairs) -> iterate(Pairs, [], lhs(Pairs) ++ rhs(Pairs)).
+lhs(L) -> [X || {X, _} <- L].
+rhs(L) -> [Y || {_, Y} <- L].
+remove_pairs(L1, L2) -> [All || All={X, _Y} <- L2, not lists:member(X, L1)].
+subtract(L1, L2) -> [X || X <- L1, not lists:member(X, L2)].
 iterate([], L, All) -> {ok,remove_duplicates(L ++ subtract(All, L))};
 iterate([], L, All) -> {ok,remove_duplicates(L ++ subtract(All, L))};
 iterate(Pairs, L, All) ->
 iterate(Pairs, L, All) ->
     case subtract(lhs(Pairs), rhs(Pairs)) of
     case subtract(lhs(Pairs), rhs(Pairs)) of
         []  -> io:format("Cycling Apps: ~p~n\r", [Pairs]);
         []  -> io:format("Cycling Apps: ~p~n\r", [Pairs]);
         Lhs -> iterate(remove_pairs(Lhs, Pairs), L ++ Lhs, All) end.
         Lhs -> iterate(remove_pairs(Lhs, Pairs), L ++ Lhs, All) end.
 
 
-remove_pairs(L1, L2) -> [All || All={X, _Y} <- L2, not lists:member(X, L1)].
-all(L) -> lhs(L) ++ rhs(L).
-lhs(L) -> [X || {X, _} <- L].
-rhs(L) -> [Y || {_, Y} <- L].
-subtract(L1, L2) -> [X || X <- L1, not lists:member(X, L2)].
 remove_duplicates([]) -> [];
 remove_duplicates([]) -> [];
 remove_duplicates([H|T]) ->
 remove_duplicates([H|T]) ->
     case lists:member(H, T) of
     case lists:member(H, T) of
@@ -31,7 +30,7 @@ orderapps() ->
     {ok,Sorted} = sort(Pairs),
     {ok,Sorted} = sort(Pairs),
     Sorted.
     Sorted.
 
 
-main(AppList) ->
+main(_) ->
     Ordered = orderapps(),
     Ordered = orderapps(),
     io:format("Ordered: ~p~n\r",[Ordered]),
     io:format("Ordered: ~p~n\r",[Ordered]),
     file:write_file(".applist",io_lib:format("~w",[Ordered])),
     file:write_file(".applist",io_lib:format("~w",[Ordered])),

+ 1 - 1
src/mad_release.erl

@@ -15,7 +15,7 @@ main(Params) ->
     [N|_] = Params,
     [N|_] = Params,
     Apps = [ filename:basename(F) || F <- filelib:wildcard("{apps,deps}/*"),  filelib:is_dir(F)],
     Apps = [ filename:basename(F) || F <- filelib:wildcard("{apps,deps}/*"),  filelib:is_dir(F)],
     release(N,Apps),
     release(N,Apps),
-    {Res,Status,X} = sh:run("relx",[],binary,".",[]),
+    {_,Status,X} = sh:run("relx",[],binary,".",[]),
     case Status == 0 of
     case Status == 0 of
          true -> skip;
          true -> skip;
          false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]) end.
          false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]) end.

+ 4 - 5
src/mad_repl.erl

@@ -14,10 +14,9 @@ applist() ->
     Name = ".applist",
     Name = ".applist",
     case file:read_file(Name) of
     case file:read_file(Name) of
          {ok,Binary} -> parse_applist(Binary); 
          {ok,Binary} -> parse_applist(Binary); 
-         {error,Reason} ->
+         {error,_} ->
            case mad_repl:load_file(Name) of
            case mad_repl:load_file(Name) of
-              <<>> -> mad_plan:main([ list_to_atom(filename:basename(App))
-                || App <- wildcards(["{apps,deps}/*"]), filelib:is_dir(App) ]);
+              <<>> -> mad_plan:main([]);
               Plan -> parse_applist(Plan) end end.
               Plan -> parse_applist(Plan) end end.
 
 
 wildcards(List) -> lists:concat([filelib:wildcard(X)||X<-List]).
 wildcards(List) -> lists:concat([filelib:wildcard(X)||X<-List]).
@@ -44,7 +43,7 @@ load_config() ->
         {App,Cfg}
         {App,Cfg}
     end || {App,Cfg} <- Apps ].
     end || {App,Cfg} <- Apps ].
 
 
-load_apps([],Config) -> [ begin
+load_apps([],_) -> [ begin
     case lists:member(A,system()) of
     case lists:member(A,system()) of
          true -> application:start(A);
          true -> application:start(A);
             _ ->
             _ ->
@@ -56,7 +55,7 @@ load_apps([],Config) -> [ begin
 
 
     end || A <- applist()];
     end || A <- applist()];
 load_apps(["applist"],Config) -> load_apps([],Config);
 load_apps(["applist"],Config) -> load_apps([],Config);
-load_apps(Params,Config) -> [ application:ensure_all_started(list_to_atom(A))||A<-Params].
+load_apps(Params,_) -> [ application:ensure_all_started(list_to_atom(A))||A<-Params].
 
 
 cwd() -> {ok, Cwd} = file:get_cwd(), Cwd.
 cwd() -> {ok, Cwd} = file:get_cwd(), Cwd.
 
 

+ 3 - 3
src/mad_run.erl

@@ -1,8 +1,8 @@
 -module(mad_run).
 -module(mad_run).
 -compile(export_all).
 -compile(export_all).
 
 
-start(Params) ->
-    {Res,Status,X} = sh:run("run_erl",["-daemon",".devbox/",".devbox/logs/","exec mad rep"],
+start(_) ->
+    {_,Status,X} = sh:run("run_erl",["-daemon",".devbox/",".devbox/logs/","exec mad rep"],
       binary,".",
       binary,".",
         [{"RUN_ERL_LOG_GENERATIONS","1000"},
         [{"RUN_ERL_LOG_GENERATIONS","1000"},
          {"RUN_ERL_LOG_MAXSIZE","20000000"},
          {"RUN_ERL_LOG_MAXSIZE","20000000"},
@@ -11,7 +11,7 @@ start(Params) ->
          true -> skip;
          true -> skip;
          false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]) end.
          false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]) end.
 
 
-attach(Params) ->
+attach(_) ->
     io:format("to_erl .devbox/~n"). % use like $(mad attach)
     io:format("to_erl .devbox/~n"). % use like $(mad attach)
 
 
 stop(_) -> ok. % TODO: stop box
 stop(_) -> ok. % TODO: stop box

+ 2 - 3
src/mad_utils.erl

@@ -26,9 +26,8 @@ get_value(Key, Opts, Default) ->
             Value;
             Value;
         _ -> Default end.
         _ -> Default end.
 
 
-script(ConfigFile, Conf, Name) ->
+script(ConfigFile, Conf, _Name) ->
     File = ConfigFile ++ ".script",
     File = ConfigFile ++ ".script",
-    Filename = filename:basename(File),
     case file:script(File, [{'CONFIG', Conf}, {'SCRIPT', File}]) of
     case file:script(File, [{'CONFIG', Conf}, {'SCRIPT', File}]) of
         {ok, {error,_}} -> Conf;
         {ok, {error,_}} -> Conf;
         {ok, Out} -> Out;
         {ok, Out} -> Out;
@@ -91,5 +90,5 @@ fold_params(Params) ->
       end, {[],[]}, Atomized),
       end, {[],[]}, Atomized),
    Fold.
    Fold.
 
 
-compile(File,Inc,Bin,Opt) -> ok.
+compile(_,_,_,_) -> ok.