-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrebar.config.template
More file actions
176 lines (125 loc) · 6.61 KB
/
rebar.config.template
File metadata and controls
176 lines (125 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
% This is a configuration file of rebar3, so that Ceylan-Myriad can better
% integrate in the current OTP ecosystem, despite its (more complex, probably
% more flexible) native build based on GNU make.
%
% If the name of this file is 'rebar.config', then it is a generated file,
% otherwise it is a template (located in conf/rebar.config.template), meant to
% be filled by information determined at build time or coming from
% GNUmakevars.inc.
%
% The previous version of this file used a compile pre-hook (triggering the
% 'rebar3-compile' make target), however having BEAM files that were more recent
% than their sources was not sufficient to prevent rebar from attempting to
% recompile them (and fail).
%
% As the option of writing a custom rebar compile module and/or plugin was not
% deemed so relevant (long, complicated and risky), we also tried with no luck
% the generation of a separate, fake, non-nested, already fully-built
% OTP-standard layout (see the 'create-fake-otp-project' make target), however
% rebar was still attempting to perform extraneous, failing recompilations.
%
% Finally we created from scratch a direct rebar structure with 'rebar3 new lib
% myriad' and filled by hand the resulting rebar.config until it became
% satisfactory enough; then we automated (at least most of) its generation from
% Make, so that upper layers could integrate similarly.
% Base layout obtained thanks to: 'rebar3 new lib myriad', as Myriad is a
% library OTP application (without supervision trees), and to be taken into
% account, from the library root, through 'make rebar3-application' or 'make
% rebar3-release'.
% See also:
% - http://erlang.org/doc/design_principles/release_structure.html
% - https://www.rebar3.org/docs/releases
% - https://learnyousomeerlang.com/release-is-the-word
% We try to stick close to the latest stable OTP version:
{minimum_otp_vsn, "26.0"}.
% Settings for the 'default' profile follow.
% No dependency (except Erlang of course):
{deps, []}.
% Include directories found in INC.
%
% No need to select here a JSON backend (i.e. neither use_jsx_json_backend nor
% use_jiffy_json_backend is useful), as their look-up is now done at runtime
% (and anyway we now rely an Erlang builtin support for JSON).
%
{erl_opts, [ {myriad_version,"VERSION_FOR_OTP"}, {d,myriad_debug_mode}, debug_info, {debug_info_key,"DEBUG_KEY_FOR_REBAR"}, report_warnings, warn_export_all, warn_export_vars, warn_shadow_vars, warn_obsolete_guards, warn_unused_import, warnings_as_errors, {parse_transform,myriad_parse_transform}, INCS_FOR_REBAR ]}.
% Bootstrapped modules (from BOOTSTRAP_MODULES):
{erl_first_files, [ FIRST_FILES_FOR_REBAR ]}.
% (hooks needed, for example to create the include symlinks and for the build
% itself)
%
% Previously 'MYRIAD_REBAR_PROFILE=${REBAR_PROFILE}' was added, yet
% REBAR_PROFILE is actually not set, so we rely on our default value instead.
%
%{pre_hooks, [ {compile, "make -s rebar3-compile-pre-hook"} ]}.
%{post_hooks, [ {compile, "make -s rebar3-compile-post-hook"} ]}.
% Previously, bulletproof build was deemed likely needed sooner or later to
% prevent spurious, ill-configured compilations that would be attempted by
% rebar3, when used as a dependency, however the opposite happened (for projects
% based on Myriad, with bulletproof hooks rebar3 started to attempt such a
% failing rebuild, whereas with the base hooks not). Not hiding Myriad build
% elements seemed the way to go.
%
% Yet since then (and after many rebar versions), adding our version define
% (i.e. {myriad_version,"VERSION_FOR_OTP"}) made the non-bulletproof build of
% Myriad fail. Switching back to the bulletproof (moreover with hiding), for
% Myriad and least for most of its dependencies, seemed to fix the issue.
%
% Should issues like these come again, maybe the
% '{erlc_compiler, [{recursive,false}]}.' rebar setting could help.
{pre_hooks, [ {compile, "make -s rebar3-bulletproof-compile-pre-hook REBAR_HOOK_EXTRA_OPTS='--hiding-for-rebar --verbose'"} ]}.
%{pre_hooks, [ {compile, "make -s rebar3-bulletproof-compile-pre-hook REBAR_HOOK_EXTRA_OPTS='--no-hiding-for-rebar --verbose'"} ]}.
% Verbosity disabled:
%{pre_hooks, [ {compile, "make -s rebar3-bulletproof-compile-pre-hook REBAR_HOOK_EXTRA_OPTS='--no-hiding-for-rebar'"} ]}.
{post_hooks, [ {compile, "make -s rebar3-bulletproof-compile-post-hook REBAR_HOOK_EXTRA_OPTS='--hiding-for-rebar --verbose'"} ]}.
%{post_hooks, [ {compile, "make -s rebar3-bulletproof-compile-post-hook REBAR_HOOK_EXTRA_OPTS='--no-hiding-for-rebar --verbose'"} ]}.
% Verbosity disabled:
%{post_hooks, [ {compile, "make -s rebar3-bulletproof-compile-post-hook REBAR_HOOK_EXTRA_OPTS='--no-hiding-for-rebar'"} ]}.
% For release generation:
%
% (defaults are for the development mode)
%
% With relx, only direct dependencies need to be listed, and version constraints
% can be used, instead of exact, specific versions.
%
{relx, [
{release, {myriad_release, "VERSION_FOR_OTP"},
[sasl, myriad]},
%{sys_config, "./config/sys.config"},
%{vm_args, "./config/vm.args"},
% Base, development version:
{dev_mode, true},
{include_erts, false},
{extended_start_script, true},
{include_src, false}
]}.
{profiles, [
% Production mode (the default one when used as a dependency):
{prod, [
% Like for the default profile, except for removed {d,myriad_debug_mode} and
% added {d,exec_target_is_production}:
%
{erl_opts, [ {myriad_version,"VERSION_FOR_OTP"}, {d,exec_target_is_production}, debug_info, {debug_info_key,"DEBUG_KEY_FOR_REBAR"}, report_warnings, warn_export_all, warn_export_vars, warn_shadow_vars, warn_obsolete_guards, warn_unused_import, warnings_as_errors, {parse_transform,myriad_parse_transform}, INCS_FOR_REBAR ]},
% For the build makefiles:
{env, [ { 'REBAR_PROFILE', "prod" } ] },
{relx, [
% Not wanting the release to contain symlinks to applications:
{dev_mode, false},
% Creating a full target system:
{include_erts, true},
{extended_start_script, true},
{include_src, false}
]} ] },
{test, [
% Test profile, like the production one except for the three, final,
% token-related defines:
%
% (see erl_opts above about JSON backends)
%
{erl_opts, [ {myriad_version,"VERSION_FOR_OTP"}, {d,exec_target_is_production}, debug_info, {debug_info_key,"DEBUG_KEY_FOR_REBAR"}, report_warnings, warn_export_all, warn_export_vars, warn_shadow_vars, warn_obsolete_guards, warn_unused_import, warnings_as_errors, {parse_transform,myriad_parse_transform}, INCS_FOR_REBAR, {d,my_first_test_token}, {d,my_second_test_token,200}, {d,my_third_test_token,some_text} ]}
]}
]}.
% For Hex packages (see https://hex.pm/):
%
% (use 'rebar3 update' to enable the hex plugin)
%
{plugins, [rebar3_hex]}.