Browse Source

make mad regular OTP application back

Maxim Sokhatsky 11 years ago
parent
commit
fe1e953680

+ 0 - 1
apps/mad/rebar.config

@@ -1 +0,0 @@
-{deps_dir, ["../../deps"]}.

+ 0 - 3
apps/rebar.config

@@ -1,3 +0,0 @@
-{sub_dirs, [ "mad" ]}.
-{lib_dirs, ["../apps"]}.
-{deps_dir, ["../deps"]}.

+ 1 - 1
build

@@ -10,7 +10,7 @@ main(_) ->
 
 files() ->
     [{filename:basename(F), read_file(F)}
-     || F <- filelib:wildcard(filename:join("apps/mad/ebin", "*")) ++
+     || F <- filelib:wildcard(filename:join("ebin", "*")) ++
             filelib:wildcard(filename:join(["deps", "*", "ebin", "*"]))].
 
 read_file(File) ->

BIN
mad


+ 1 - 1
otp.mk

@@ -7,7 +7,7 @@ ERL_LIBS := $(subst $(space),:,$(ROOTS))
 test: ct
 compile: get-deps
 get-deps compile clean:
-	./mad $@
+	rebar $@
 escript: compile
 	./build
 $(PLT_NAME):

+ 0 - 1
rebar.config

@@ -1,5 +1,4 @@
 {cache,"~/.mad/repos"}.
-{sub_dirs,["apps"]}.
 {deps_dir,"deps"}.
 {deps, [
         {getopt, ".*",   {git, "git://github.com/jcomellas/getopt.git", {tag, "v0.8.2"}}}

+ 0 - 0
apps/mad/src/mad.app.src → src/mad.app.src


+ 6 - 4
apps/mad/src/mad.erl → src/mad.erl

@@ -49,12 +49,14 @@ main(Args) ->
 
 %% compile dependencies and the app
 compile(Cwd, ConfigFile, Conf) ->
-    'compile-deps'(Cwd, ConfigFile, Conf),
-    'compile-apps'(Cwd, ConfigFile, Conf).
+    'compile-apps'(Cwd, ConfigFile, Conf),
+    'compile-deps'(Cwd, ConfigFile, Conf).
 
 'compile-apps'(Cwd, ConfigFile, Conf) ->
-    Dirs = mad_utils:sub_dirs(Cwd, ConfigFile, Conf),
-    mad_compile:deps(Cwd, Conf, ConfigFile, Dirs).
+    Dirs = get_value(sub_dirs, Conf, []),
+    case Dirs of
+        [] -> mad_compile:dep(Cwd, Conf, ConfigFile, Cwd);
+        Apps -> mad_compile:deps(Cwd, Conf, ConfigFile, Apps) end.
 
 'compile-deps'(Cwd, ConfigFile, Conf) ->
     mad_compile:deps(Cwd, Conf, ConfigFile, get_value(deps, Conf, [])).

+ 2 - 2
apps/mad/src/mad_compile.erl → src/mad_compile.erl

@@ -11,7 +11,7 @@
 deps(_, _, _, []) -> ok;
 deps(Cwd, Conf, ConfigFile, [H|T]) ->
     {Name, _} = mad_deps:name_and_repo(H),
-    case get(mad_utils:to_atom(Name)) of
+    case get(Name) of
         compiled -> ok;
         _ -> dep(Cwd, Conf, ConfigFile, Name) end,
     deps(Cwd, Conf, ConfigFile, T).
@@ -50,7 +50,7 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
 
             dtl(DepPath,Conf1),
 
-            put(mad_utils:to_atom(Name), compiled),
+            put(Name, compiled),
             ok
     end.
 

+ 0 - 0
apps/mad/src/mad_deps.erl → src/mad_deps.erl


+ 0 - 0
apps/mad/src/mad_utils.erl → src/mad_utils.erl


+ 0 - 0
apps/mad/test/helper.erl → test/helper.erl


+ 0 - 0
apps/mad/test/mad_compile_SUITE.erl → test/mad_compile_SUITE.erl


+ 0 - 0
apps/mad/test/mad_compile_SUITE_data/include/three_inc.hrl → test/mad_compile_SUITE_data/include/three_inc.hrl


+ 0 - 0
apps/mad/test/mad_compile_SUITE_data/src/three.app.src → test/mad_compile_SUITE_data/src/three.app.src


+ 0 - 0
apps/mad/test/mad_compile_SUITE_data/src/three.erl → test/mad_compile_SUITE_data/src/three.erl


+ 0 - 0
apps/mad/test/mad_compile_SUITE_data/src/three_src.hrl → test/mad_compile_SUITE_data/src/three_src.hrl


+ 0 - 0
apps/mad/test/mad_deps_SUITE.erl → test/mad_deps_SUITE.erl


+ 0 - 0
apps/mad/test/mad_utils_SUITE.erl → test/mad_utils_SUITE.erl


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/rebar.config → test/mad_utils_SUITE_data/rebar.config


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/rebar.config.script → test/mad_utils_SUITE_data/rebar.config.script


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/sub_dir1/rebar.config → test/mad_utils_SUITE_data/sub_dir1/rebar.config


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/sub_dir1/trap/.gitkeep → test/mad_utils_SUITE_data/sub_dir1/trap/.gitkeep


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/sub_dir2/rebar.config → test/mad_utils_SUITE_data/sub_dir2/rebar.config


+ 0 - 0
apps/mad/test/mad_utils_SUITE_data/sub_dir2/time-machine/.gitkeep → test/mad_utils_SUITE_data/sub_dir2/time-machine/.gitkeep