Browse Source

fix app.src, cubical

Namdak Tonpa 6 years ago
parent
commit
6a8222955a
4 changed files with 9 additions and 7 deletions
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 6 4
      src/compile/mad_compile.erl
  4. 2 2
      src/compile/mad_cubical.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"0a277c").
+-define(VERSION,"4346b8").

BIN
mad


+ 6 - 4
src/compile/mad_compile.erl

@@ -39,11 +39,13 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
 
     SrcDir = filename:join([mad_utils:src(DepPath)]),
     PrivDir = filename:join([mad_utils:priv(DepPath)]),
-    PrivFiles = files(PrivDir,".ctt"),
+    PrivFiles = case application:get_env(mad,cubical,[]) of
+                     [] -> [];
+                     _ -> files(PrivDir,".ctt") end,
     AllFiles = files(SrcDir,".yrl") ++
                files(SrcDir,".xrl") ++
-               files(SrcDir,".erl") ++ % comment this to build with erlc/1
-               files(SrcDir,".app.src"),
+               files(SrcDir,".erl"), % comment this to build with erlc/1
+    AppSrcFiles = files(SrcDir,".app.src"),
     Files = case mad_utils:get_value(erl_first_files, Conf1, []) of
               []         -> AllFiles;
               FirstFiles ->
@@ -67,7 +69,7 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
             code:replace_path(Name,EbinDir),
 
             Opts = mad_utils:get_value(erl_opts, Conf1, []),
-            FilesStatus = compile_files(Files++PrivFiles,IncDir, EbinDir, Opts,Includes),
+            FilesStatus = compile_files(lists:sort(Files++PrivFiles)++AppSrcFiles,IncDir, EbinDir, Opts,Includes),
             DTLStatus = mad_dtl:compile(DepPath,Conf1),
             PortStatus = lists:any(fun(X)->X end,mad_port:compile(DepPath,Conf1)),
             % io:format("Status: ~p~n",[[Name,FilesStatus,DTLStatus,PortStatus,DepsRes]]),

+ 2 - 2
src/compile/mad_cubical.erl

@@ -3,9 +3,9 @@
 -compile(export_all).
 
 compile(File,Inc,Bin,Opt,Deps) ->
-    {X,Res,Msg} = sh:run("cubical -b " ++ File),
+    {X,Res,Msg} = sh:run(sh:executable("cubical"), ["-b", File], binary, "."),
     case Res of
          1 -> true;
-         0 -> case binary:match(Msg,[<<"successfully!">>]) of
+         0 -> case binary:match(Msg,[<<"File loaded.">>]) of
                    nomatch -> io:format("Error: ~p~n",[Msg]), true;
                    _ -> io:format("OK: ~p.~n",[filename:basename(File)]), false end end.