Merge remote-tracking branch 'canonical/next'
[sinan.git] / include / sinan.hrl
blob3acbb5f44d143e72725f5ede0904bb73b7f2799c
1 %%%---------------------------------------------------------------------------
2 %%% @author Eric Merritt
3 %%% @doc
4 %%% Provides the task and resource definitions for the system.
5 %%% @end
6 %%% @copyright 2007 Erlware
7 %%%---------------------------------------------------------------------------
9 %% @doc Describes n application, and whether or not the application is a
10 %% runtime dep or compile time dep, also wether it is a project
11 %% application or a dependency
12 -record(app, {name :: atom(),
13 vsn :: string(),
14 path :: string(),
15 type :: runtime | compiletime,
16 project :: boolean(),
17 %% Everything below will only be populated if the
18 %% project field above is true otherwise they will be
19 %% undefined.
20 id="" :: string() | list(),
21 maxP=infinity :: integer() | infinity,
22 maxT=infinity :: integer() | infinity,
23 env=[] :: list(),
24 start_phases = undefined :: term() | undefined,
25 basedir :: string() | undefined,
26 description="" :: string() | list(),
27 registered :: [atom()] | undefined,
28 applications :: [atom()] | undefined,
29 included_applications :: [atom()] | undefined,
30 dep_constraints :: term() | undefined,
31 mod :: term() | undefined,
32 dotapp :: string() | undefined,
33 deps :: [atom()] | undefined,
34 properties=[] :: proplists:proplist(),
35 modules :: [atom()] | undefined}).
37 %% @doc describes a module in the system
38 %% - name: is the name of the module
39 -record(module, {name :: module(),
40 type :: hrl | yrl | erl | {other, string()},
41 path :: string(),
42 module_deps :: [module()],
43 includes :: [atom()],
44 include_timestamps :: [{string(),
45 sin_file_info:date_time()}],
46 tags :: [atom()],
47 called_modules :: [atom()],
48 changed :: sin_file_info:date_time(),
49 change_sig :: number()}).
52 -record(task, {name :: atom(), % The 'user friendly' name of the task
53 task_impl :: atom(), % The implementation of the task, maybe fun or
54 bare :: boolean(), % Indicates whether a build config is needed
55 deps :: [atom()], % The list of dependencies
56 desc :: string(), % The description for the task
57 short_desc :: string(), % A one line short description of the task
58 example :: string(), % An example of the task usage
59 opts :: list()}). % The list of options that the task requires/understands
62 -define(SIN_EXEP_UNPARSE(S, Problem, Description),
63 {pe, S, {_, _, {Problem, Description}}}).
64 -define(SIN_EXEP_UNPARSE(S, Problem),
65 {pe, S, {_, _, Problem}}).
67 -define(SIN_RAISE(State, Problem),
68 throw({pe,
69 sin_state:add_run_error(?MODULE,
70 {?MODULE, ?LINE, Problem}, State),
71 {?MODULE, ?LINE, Problem}})).
73 -define(SIN_RAISE(State, Problem, Description),
74 throw({pe,
75 sin_state:add_run_error(?MODULE,
76 {?MODULE, ?LINE,
77 {Problem, Description}}, State),
78 {?MODULE, ?LINE,
79 {Problem, Description}}})).
81 -define(SIN_RAISE(State, Problem, Description, DescArgs),
82 throw({pe,
83 sin_state:add_run_error(?MODULE,
84 {?MODULE, ?LINE,
85 {Problem,
86 lists:flatten(
87 io_lib:format(Description,
88 DescArgs))}}, State),
89 {?MODULE, ?LINE,
90 {Problem,
91 lists:flatten(io_lib:format(Description, DescArgs))}}})).
93 -define(WARN(State, Warnings),
94 ((fun() ->
95 WarnRef =
96 sin_state:add_run_warning(?MODULE, Warnings, State),
97 WarnRef
98 end)())).
101 -define(WARN(State, Warnings, Detail),
102 ((fun() ->
103 WarnRef =
104 sin_state:add_run_warning(?MODULE,
105 lists:flatten(io_lib:format(Warnings, Detail)), State),
106 WarnRef
107 end)())).