Skip to content

Instantly share code, notes, and snippets.

@5HT
Created May 10, 2015 19:02
Show Gist options
  • Save 5HT/e7b6e434140dba9a0931 to your computer and use it in GitHub Desktop.
Save 5HT/e7b6e434140dba9a0931 to your computer and use it in GitHub Desktop.
$ git diff
diff --git a/include/mad.hrl b/include/mad.hrl
index 8302621..ca54a1f 100644
--- a/include/mad.hrl
+++ b/include/mad.hrl
@@ -1 +1 @@
--define(VERSION,"78713a").
+-define(VERSION,"95e4d5").
diff --git a/mad b/mad
index bbd7833..c7aa27c 100755
Binary files a/mad and b/mad differ
diff --git a/src/compile/mad_app.erl b/src/compile/mad_app.erl
index adbc181..63c1549 100644
bash-3.2$
--- a/src/compile/mad_app.erl
+++ b/src/compile/mad_app.erl
bash-3.2$
@@ -20,7 +20,8 @@ compile(File,_Inc,Bin,_Opt,_Deps) ->
Modules = [list_to_atom(filename:basename(X, ".beam")) || X <- BeamFiles],
[Struct|_] = mad_utils:consult(File),
{application, AppName, Props} = Struct,
- Props1 = add_modules_property(Props),
+ Props0 = add_modules_property(Props),
+ Props1 = generate_deps(Props0),
Props2 = [validate_property(X, Modules) || X <- Props1],
Struct1 = {application, AppName, Props2},
file:write_file(AppFile, io_lib:format("~p.~n", [Struct1])),
@@ -31,3 +32,11 @@ add_modules_property(Properties) ->
case lists:keyfind(modules, 1, Properties) of
{modules, _} -> Properties;
_ -> Properties ++ [{modules, []}] end.
+
+generate_deps(Properties) ->
+ case lists:keyfind(applications, 1, Properties) of
+ {applications, _} -> lists:keyreplace(applications,1,Properties,apps());
+ false -> Properties ++ [apps()] end.
+
+apps() -> {ok,Apps} = mad_plan:orderapps(),
+ {applications,Apps}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment