Skip to content

Commit

Permalink
support app.script
Browse files Browse the repository at this point in the history
  • Loading branch information
mihawk committed Nov 7, 2016
1 parent d85ab3b commit 8e3fa4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/compile/mad_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ validate_property({modules, _}, Modules) -> {modules, Modules};
validate_property({vsn, Value}, _) -> {vsn, to_list(Value)};
validate_property(Else, _) -> Else.

consult(F) -> AppSrc = mad_utils:consult(F),
case mad_script:script(F, AppSrc, "dummy") of
R when is_tuple(R) -> [R]; E -> E end.

compile(File,_Inc,Bin,_Opt,_Deps) ->
AppFile = filename:join(Bin, app_src_to_app(File)),
Compiled = mad_compile:is_compiled(AppFile, File),
if Compiled =:= false ->
mad:info("Writing ~s~n", [AppFile -- mad_utils:cwd()]),
BeamFiles = filelib:wildcard("*.beam", Bin),
Modules = [list_to_atom(filename:basename(X, ".beam")) || X <- BeamFiles],
[Struct|_] = mad_utils:consult(File),
%[Struct|_] = mad_utils:consult(File),
[Struct|_] = consult(File),
{application, AppName, Props} = Struct,
Props0 = add_modules_property(Props),
Props1 = generate_deps(AppName,Props0),
Expand Down

0 comments on commit 8e3fa4f

Please sign in to comment.