summaryrefslogtreecommitdiff
path: root/src/rebar_resource.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_resource.erl')
-rw-r--r--src/rebar_resource.erl43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/rebar_resource.erl b/src/rebar_resource.erl
new file mode 100644
index 0000000..04b8d73
--- /dev/null
+++ b/src/rebar_resource.erl
@@ -0,0 +1,43 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+-module(rebar_resource).
+
+-export([]).
+
+-export_types([resource/0
+ ,type/0
+ ,location/0
+ ,ref/0]).
+
+-type resource() :: {type(), location(), ref()}.
+-type type() :: atom().
+-type location() :: string().
+-type ref() :: any().
+
+-ifdef(have_callback_support).
+
+%% In the case where R14 or lower is being used to compile the system
+%% we need to export a behaviour info
+-export([behaviour_info/1]).
+
+-spec behaviour_info(atom()) -> [{atom(), arity()}] | undefined.
+behaviour_info(callbacks) ->
+ [{lock, 2},
+ {download, 2},
+ {needs_update,2},
+ {make_vsn, 1}];
+behaviour_info(_) ->
+ undefined.
+
+-else.
+
+-callback lock(file:filename_all(), tuple()) ->
+ rebar_resource:resource().
+-callback download(file:filename_all(), tuple()) ->
+ {tarball, file:filename_all()} | {ok, any()} | {error, any()}.
+-callback needs_update(file:filename_all(), tuple()) ->
+ {tarball, file:filename_all()} | {ok, any()} | {error, any()}.
+-callback make_vsn(file:filename_all()) ->
+ {plain, string()} | {error, string()}.
+
+-endif.