---
ebin/sinan.app | 69 +++++++++++++++---------------
src/sin_task.erl | 46 ++++++++++----------
src/sinan.erl | 122 +++++++++++++++++++++++++++---------------------------
3 files changed, 119 insertions(+), 118 deletions(-)
diff --git a/ebin/sinan.app b/ebin/sinan.app
index fc9b4ae..eedc3ca 100644
--- a/ebin/sinan.app
+++ b/ebin/sinan.app
@@ -4,45 +4,46 @@
[{description, "Build system for erlang"},
{vsn, "1.0.1"},
{modules, [sin_hooks,
- sin_task_doc,
- sin_task_version,
- sin_build_arg_parser,
- sin_release,
- sin_task,
- sin_task_gen,
- sin_topo,
- sin_config,
- sin_resolver,
- sin_task_build,
- sin_task_help,
- sin_utils,
- sin_config_parser,
- sin_sig,
- sin_task_clean,
- sin_task_release,
- sin_deps,
- sin_skel,
- sin_task_depends,
- sin_task_shell,
- sinan,
- sin_gen,
- sin_discover,
- sin_sup,
- sin_app,
- sin_task_dist,
- sin_task_test,
- sin_task_xref,
- sin_task_erts,
- sin_compile_yrl,
- sin_compile_erl,
- sin_exceptions,
- sin_error_store]},
+ sin_task_doc,
+ sin_task_version,
+ sin_build_arg_parser,
+ sin_release,
+ sin_task,
+ sin_task_gen,
+ sin_topo,
+ sin_config,
+ sin_resolver,
+ sin_task_build,
+ sin_task_help,
+ sin_utils,
+ sin_config_parser,
+ sin_sig,
+ sin_task_clean,
+ sin_task_release,
+ sin_deps,
+ sin_skel,
+ sin_task_depends,
+ sin_task_shell,
+ sinan,
+ sin_gen,
+ sin_discover,
+ sin_sup,
+ sin_app,
+ sin_task_cucumber,
+ sin_task_dist,
+ sin_task_test,
+ sin_task_xref,
+ sin_task_erts,
+ sin_compile_yrl,
+ sin_compile_erl,
+ sin_exceptions,
+ sin_error_store]},
{registered, [sin_sup]},
{applications, [kernel, stdlib, compiler,
edoc, syntax_tools, eunit, proper,
ktuo, ewrepo, ewlib, xtools,
xmerl, mnesia, sgte, erlware_commons,
- parsetools, getopt]},
+ parsetools, getopt]},
{mod, {sin_app, []}},
{start_phases, []}]}.
diff --git a/src/sin_task.erl b/src/sin_task.erl
index 33e76c2..8892975 100644
--- a/src/sin_task.erl
+++ b/src/sin_task.erl
@@ -11,15 +11,15 @@
-include("internal.hrl").
-export([get_task/1,
- get_task_list/1,
- get_tasks/0,
- behaviour_info/1,
- signal_error/0,
- has_errors/0,
- format_exception/1]).
+ get_task_list/1,
+ get_tasks/0,
+ behaviour_info/1,
+ signal_error/0,
+ has_errors/0,
+ format_exception/1]).
-export_type([task_description/0,
- task_name/0]).
+ task_name/0]).
%%====================================================================
%%% Types
@@ -44,9 +44,9 @@ get_task_list(TaskName) ->
Tasks = get_tasks(),
RootTask = get_task(TaskName, Tasks),
lists:map(fun(DepTaskName) ->
- get_task(DepTaskName, Tasks)
- end,
- process_deps(RootTask, Tasks)).
+ get_task(DepTaskName, Tasks)
+ end,
+ process_deps(RootTask, Tasks)).
%% @doc get a list of all tasks in the system
-spec get_tasks() -> [record(task)].
@@ -102,21 +102,21 @@ get_task(TaskName, _) ->
process_deps(Task, Tasks) ->
{DepChain, _, _} = process_deps(Task, Tasks, []),
['NONE' | Rest] =
- reorder_tasks(lists:flatten([{'NONE', Task#task.name} | DepChain])),
+ reorder_tasks(lists:flatten([{'NONE', Task#task.name} | DepChain])),
Rest.
process_deps(Task, Tasks, Seen) ->
case lists:member(Task, Seen) of
- true ->
- {[], Tasks, Seen};
- false ->
- Deps = Task#task.deps,
- DepList = lists:map(fun(Dep) ->
- {Dep, Task#task.name}
- end, Deps),
- {NewDeps, _, NewSeen} = lists:foldl(fun process_dep/2,
- {[], Tasks, Seen}, Deps),
- {[DepList | NewDeps], Tasks, NewSeen}
+ true ->
+ {[], Tasks, Seen};
+ false ->
+ Deps = Task#task.deps,
+ DepList = lists:map(fun(Dep) ->
+ {Dep, Task#task.name}
+ end, Deps),
+ {NewDeps, _, NewSeen} = lists:foldl(fun process_dep/2,
+ {[], Tasks, Seen}, Deps),
+ {[DepList | NewDeps], Tasks, NewSeen}
end.
process_dep(TaskName, {Deps, Tasks, Seen}) ->
@@ -131,8 +131,8 @@ reorder_tasks(OTaskList) ->
TaskList;
{cycle, _} ->
?SIN_RAISE(cycle_fault,
- "There was a cycle in the task list. "
- "Unable to complete build!")
+ "There was a cycle in the task list. "
+ "Unable to complete build!")
end.
%%====================================================================
diff --git a/src/sinan.erl b/src/sinan.erl
index 70fbb32..38939c8 100644
--- a/src/sinan.erl
+++ b/src/sinan.erl
@@ -37,16 +37,16 @@
-spec do_task(task_name(), string(), sin_config:config()) -> ok.
do_task(Task, StartDir, Override) ->
try
- TaskDesc = sin_task:get_task(Task),
- case TaskDesc#task.bare of
- false ->
- do_task_full(StartDir, Override, Task);
- true ->
- do_task_bare(StartDir, Override, Task)
- end
+ TaskDesc = sin_task:get_task(Task),
+ case TaskDesc#task.bare of
+ false ->
+ do_task_full(StartDir, Override, Task);
+ true ->
+ do_task_bare(StartDir, Override, Task)
+ end
catch
{pe, {_, _, {task_not_found, TaskName}}} ->
- sin_error_store:signal_error(),
+ sin_error_store:signal_error(),
ewl_talk:say("Task not found ~s.", [TaskName])
end.
@@ -55,22 +55,22 @@ do_task(Task, StartDir, Override) ->
do_task_full(StartDir, Override, Task) when is_atom(Task) ->
try
Config = sin_discover:discover(StartDir, Override),
- ProjectRoot = sin_config:get_value(Config, "project.dir"),
- run_task(Task, ProjectRoot, Config)
+ ProjectRoot = sin_config:get_value(Config, "project.dir"),
+ run_task(Task, ProjectRoot, Config)
catch
no_build_config ->
- sin_error_store:signal_error(),
+ sin_error_store:signal_error(),
ewl_talk:say("No build config found.");
{unable_to_create_canonical, {_, _,Desc}} ->
- sin_error_store:signal_error(),
- ewl_talk:say("Error discovering project layout: ~s", Desc);
- Error = {pe, {Module, _, _}} ->
- sin_error_store:signal_error(),
- ewl_talk:say("build problem ~s", [Module:format_exception(Error)]);
- Type:Exception ->
- sin_error_store:signal_error(),
- ewl_talk:say("build problem ~p:~p:~p",
- [Type, Exception, erlang:get_stacktrace()])
+ sin_error_store:signal_error(),
+ ewl_talk:say("Error discovering project layout: ~s", Desc);
+ Error = {pe, {Module, _, _}} ->
+ sin_error_store:signal_error(),
+ ewl_talk:say("build problem ~s", [Module:format_exception(Error)]);
+ Type:Exception ->
+ sin_error_store:signal_error(),
+ ewl_talk:say("build problem ~p:~p:~p",
+ [Type, Exception, erlang:get_stacktrace()])
end.
%% @doc run the specified task, without expecting a build config and what not.
@@ -128,9 +128,9 @@ usage() ->
usage(OptSpecList) ->
getopt:usage(OptSpecList, "", "[command] [option1 option2]....",
[{"var=value",
- "Variables that will affect the compilation (e.g. debug=1)"},
+ "Variables that will affect the compilation (e.g.
debug=1)"},
{"command",
- "Commands that will be executed by erlb (e.g. compile)"}]).
+ "Commands that will be executed by erlb (e.g. compile)"}]).
-spec option_spec_list() -> list().
option_spec_list() ->
@@ -147,29 +147,29 @@ run_task(Task, ProjectDir, BuildConfig) ->
try
Tasks = sin_task:get_task_list(Task),
case sin_hooks:get_hooks_function(ProjectDir) of
- no_hooks ->
- lists:foldl(
- fun(TaskDesc, NewConfig) ->
- ewl_talk:say("starting: ~p",
- TaskDesc#task.name),
- NewNewConfig =
- (TaskDesc#task.task_impl):do_task(NewConfig),
- NewNewConfig
- end, BuildConfig, Tasks);
- HooksFun ->
- lists:foldl(
- fun(TaskDesc, NewConfig) ->
- ewl_talk:say("starting: ~p", TaskDesc#task.name),
- HooksFun(pre, Task, NewConfig),
- NewNewConfig =
- (TaskDesc#task.task_impl):do_task(NewConfig),
- HooksFun(post, Task, NewNewConfig),
- NewNewConfig
- end, BuildConfig, Tasks)
+ no_hooks ->
+ lists:foldl(
+ fun(TaskDesc, NewConfig) ->
+ ewl_talk:say("starting: ~p",
+ TaskDesc#task.name),
+ NewNewConfig =
+ (TaskDesc#task.task_impl):do_task(NewConfig),
+ NewNewConfig
+ end, BuildConfig, Tasks);
+ HooksFun ->
+ lists:foldl(
+ fun(TaskDesc, NewConfig) ->
+ ewl_talk:say("starting: ~p", TaskDesc#task.name),
+ HooksFun(pre, Task, NewConfig),
+ NewNewConfig =
+ (TaskDesc#task.task_impl):do_task(NewConfig),
+ HooksFun(post, Task, NewNewConfig),
+ NewNewConfig
+ end, BuildConfig, Tasks)
end
catch
- throw:{task_not_found, Task} ->
- sin_talk:say("Unknown task ~p", [Task])
+ throw:{task_not_found, Task} ->
+ sin_talk:say("Unknown task ~p", [Task])
end.
%% @doc parse the start dir out of the args passed in.
@@ -177,10 +177,10 @@ run_task(Task, ProjectDir, BuildConfig) ->
find_start_dir(Options) ->
case lists:keysearch(start_dir, 1, Options) of
{value, {start_dir, StartDir}} ->
- StartDir;
- _ ->
- {ok, Dir} = file:get_cwd(),
- Dir
+ StartDir;
+ _ ->
+ {ok, Dir} = file:get_cwd(),
+ Dir
end.
%% @doc Setup all configuration overrides from the command line
@@ -188,11 +188,11 @@ find_start_dir(Options) ->
sin_config:config().
setup_config_overrides(Options, Args) ->
push_values_if_exist(sin_config:parse_args(Args, sin_config:new()),
- Options,
- [{release, "-r"},
- {start_dir, "start_dir"},
- {project, "project.name"},
- {version, "project.vsn"}]).
+ Options,
+ [{release, "-r"},
+ {start_dir, "start_dir"},
+ {project, "project.name"},
+ {version, "project.vsn"}]).
%% @doc This pushes the values given in the args (if they exist) into the
%% override config under the name specified in key.
@@ -204,11 +204,11 @@ setup_config_overrides(Options, Args) ->
sin_config:config().
push_values_if_exist(Config, Options, [{Name, Key} | Rest]) ->
case lists:keysearch(Name, 1, Options) of
- {value, {Name, Value}} ->
- push_values_if_exist(sin_config:store(Config, Key, Value),
- Options, Rest);
- _ ->
- push_values_if_exist(Config, Options, Rest)
+ {value, {Name, Value}} ->
+ push_values_if_exist(sin_config:store(Config, Key, Value),
+ Options, Rest);
+ _ ->
+ push_values_if_exist(Config, Options, Rest)
end;
push_values_if_exist(Config, _Options, []) ->
Config.
@@ -218,11 +218,11 @@ push_values_if_exist(Config, _Options, []) ->
%%====================================================================
push_values_if_exist_test() ->
Options = [{foo, "bar"},
- {bar, "baz"},
- {z, 333},
- {noid, avoid}],
+ {bar, "baz"},
+ {z, 333},
+ {noid, avoid}],
Config = push_values_if_exist(sin_config:new(), Options, [{bar, "monsefu"},
- {z, "chiclayo"}]),
+ {z,
"chiclayo"}]),
?assertMatch("baz", sin_config:get_value(Config, "monsefu")),
?assertMatch(333, sin_config:get_value(Config, "chiclayo")),
?assertMatch(undefined, sin_config:get_value(Config, "noid")).
--
1.7.5.2
--
You received this message because you are subscribed to the Google Groups
"erlware-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/erlware-dev?hl=en.