From 8e3fa4fa1e28c7cf5e4b7c8c0791f616a287ddda Mon Sep 17 00:00:00 2001 From: mihawk Date: Mon, 7 Nov 2016 14:25:46 +0700 Subject: [PATCH] support app.script --- src/compile/mad_app.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compile/mad_app.erl b/src/compile/mad_app.erl index 17ca26f..bfcb5a7 100644 --- a/src/compile/mad_app.erl +++ b/src/compile/mad_app.erl @@ -11,6 +11,10 @@ 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), @@ -18,7 +22,8 @@ compile(File,_Inc,Bin,_Opt,_Deps) -> 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),