Skip to content

Commit 83bf2e4

Browse files
committed
add rebar3 sample project
1 parent 385f14b commit 83bf2e4

File tree

7 files changed

+291
-0
lines changed

7 files changed

+291
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.rebar3
2+
_build
3+
_checkouts
4+
_vendor
5+
.eunit
6+
*.o
7+
*.beam
8+
*.plt
9+
*.swp
10+
*.swo
11+
.erlang.cookie
12+
ebin
13+
log
14+
erl_crash.dump
15+
.rebar
16+
logs
17+
.idea
18+
*.iml
19+
rebar3.crashdump
20+
*~
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Apache License
2+
Version 2.0, January 2004
3+
4+
http://www.apache.org/licenses/
5+
6+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
8+
## 1. Definitions.
9+
10+
"License" shall mean the terms and conditions for use, reproduction, and
11+
distribution as defined by Sections 1 through 9 of this document.
12+
13+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
14+
owner that is granting the License.
15+
16+
"Legal Entity" shall mean the union of the acting entity and all other entities
17+
that control, are controlled by, or are under common control with that entity.
18+
For the purposes of this definition, "control" means (i) the power, direct or
19+
indirect, to cause the direction or management of such entity, whether by
20+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+
outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+
"You" (or "Your") shall mean an individual or Legal Entity exercising
24+
permissions granted by this License.
25+
26+
"Source" form shall mean the preferred form for making modifications, including
27+
but not limited to software source code, documentation source, and configuration
28+
files.
29+
30+
"Object" form shall mean any form resulting from mechanical transformation or
31+
translation of a Source form, including but not limited to compiled object code,
32+
generated documentation, and conversions to other media types.
33+
34+
"Work" shall mean the work of authorship, whether in Source or Object form, made
35+
available under the License, as indicated by a copyright notice that is included
36+
in or attached to the work (an example is provided in the Appendix below).
37+
38+
"Derivative Works" shall mean any work, whether in Source or Object form, that
39+
is based on (or derived from) the Work and for which the editorial revisions,
40+
annotations, elaborations, or other modifications represent, as a whole, an
41+
original work of authorship. For the purposes of this License, Derivative Works
42+
shall not include works that remain separable from, or merely link (or bind by
43+
name) to the interfaces of, the Work and Derivative Works thereof.
44+
45+
"Contribution" shall mean any work of authorship, including the original version
46+
of the Work and any modifications or additions to that Work or Derivative Works
47+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
48+
by the copyright owner or by an individual or Legal Entity authorized to submit
49+
on behalf of the copyright owner. For the purposes of this definition,
50+
"submitted" means any form of electronic, verbal, or written communication sent
51+
to the Licensor or its representatives, including but not limited to
52+
communication on electronic mailing lists, source code control systems, and
53+
issue tracking systems that are managed by, or on behalf of, the Licensor for
54+
the purpose of discussing and improving the Work, but excluding communication
55+
that is conspicuously marked or otherwise designated in writing by the copyright
56+
owner as "Not a Contribution."
57+
58+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59+
of whom a Contribution has been received by Licensor and subsequently
60+
incorporated within the Work.
61+
62+
## 2. Grant of Copyright License.
63+
64+
Subject to the terms and conditions of this License, each Contributor hereby
65+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
66+
irrevocable copyright license to reproduce, prepare Derivative Works of,
67+
publicly display, publicly perform, sublicense, and distribute the Work and such
68+
Derivative Works in Source or Object form.
69+
70+
## 3. Grant of Patent License.
71+
72+
Subject to the terms and conditions of this License, each Contributor hereby
73+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
74+
irrevocable (except as stated in this section) patent license to make, have
75+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
76+
such license applies only to those patent claims licensable by such Contributor
77+
that are necessarily infringed by their Contribution(s) alone or by combination
78+
of their Contribution(s) with the Work to which such Contribution(s) was
79+
submitted. If You institute patent litigation against any entity (including a
80+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
81+
Contribution incorporated within the Work constitutes direct or contributory
82+
patent infringement, then any patent licenses granted to You under this License
83+
for that Work shall terminate as of the date such litigation is filed.
84+
85+
## 4. Redistribution.
86+
87+
You may reproduce and distribute copies of the Work or Derivative Works thereof
88+
in any medium, with or without modifications, and in Source or Object form,
89+
provided that You meet the following conditions:
90+
91+
1. You must give any other recipients of the Work or Derivative Works a copy of
92+
this License; and
93+
94+
2. You must cause any modified files to carry prominent notices stating that
95+
You changed the files; and
96+
97+
3. You must retain, in the Source form of any Derivative Works that You
98+
distribute, all copyright, patent, trademark, and attribution notices from
99+
the Source form of the Work, excluding those notices that do not pertain to
100+
any part of the Derivative Works; and
101+
102+
4. If the Work includes a "NOTICE" text file as part of its distribution, then
103+
any Derivative Works that You distribute must include a readable copy of the
104+
attribution notices contained within such NOTICE file, excluding those
105+
notices that do not pertain to any part of the Derivative Works, in at least
106+
one of the following places: within a NOTICE text file distributed as part
107+
of the Derivative Works; within the Source form or documentation, if
108+
provided along with the Derivative Works; or, within a display generated by
109+
the Derivative Works, if and wherever such third-party notices normally
110+
appear. The contents of the NOTICE file are for informational purposes only
111+
and do not modify the License. You may add Your own attribution notices
112+
within Derivative Works that You distribute, alongside or as an addendum to
113+
the NOTICE text from the Work, provided that such additional attribution
114+
notices cannot be construed as modifying the License.
115+
116+
You may add Your own copyright statement to Your modifications and may provide
117+
additional or different license terms and conditions for use, reproduction, or
118+
distribution of Your modifications, or for any such Derivative Works as a whole,
119+
provided Your use, reproduction, and distribution of the Work otherwise complies
120+
with the conditions stated in this License.
121+
122+
## 5. Submission of Contributions.
123+
124+
Unless You explicitly state otherwise, any Contribution intentionally submitted
125+
for inclusion in the Work by You to the Licensor shall be under the terms and
126+
conditions of this License, without any additional terms or conditions.
127+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
128+
any separate license agreement you may have executed with Licensor regarding
129+
such Contributions.
130+
131+
## 6. Trademarks.
132+
133+
This License does not grant permission to use the trade names, trademarks,
134+
service marks, or product names of the Licensor, except as required for
135+
reasonable and customary use in describing the origin of the Work and
136+
reproducing the content of the NOTICE file.
137+
138+
## 7. Disclaimer of Warranty.
139+
140+
Unless required by applicable law or agreed to in writing, Licensor provides the
141+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
142+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
143+
including, without limitation, any warranties or conditions of TITLE, NON-
144+
INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
145+
solely responsible for determining the appropriateness of using or
146+
redistributing the Work and assume any risks associated with Your exercise of
147+
permissions under this License.
148+
149+
## 8. Limitation of Liability.
150+
151+
In no event and under no legal theory, whether in tort (including negligence),
152+
contract, or otherwise, unless required by applicable law (such as deliberate
153+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
154+
liable to You for damages, including any direct, indirect, special, incidental,
155+
or consequential damages of any character arising as a result of this License or
156+
out of the use or inability to use the Work (including but not limited to
157+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
158+
any and all other commercial damages or losses), even if such Contributor has
159+
been advised of the possibility of such damages.
160+
161+
## 9. Accepting Warranty or Additional Liability.
162+
163+
While redistributing the Work or Derivative Works thereof, You may choose to
164+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
165+
other liability obligations and/or rights consistent with this License. However,
166+
in accepting such obligations, You may act only on Your own behalf and on Your
167+
sole responsibility, not on behalf of any other Contributor, and only if You
168+
agree to indemnify, defend, and hold each Contributor harmless for any liability
169+
incurred by, or claims asserted against, such Contributor by reason of your
170+
accepting any such warranty or additional liability.
171+
172+
END OF TERMS AND CONDITIONS
173+
174+
Copyright 2025, Sergey Ignatov <sergey.ignatov@jetbrains.com>.
175+
176+
Licensed under the Apache License, Version 2.0 (the "License");
177+
you may not use this file except in compliance with the License.
178+
You may obtain a copy of the License at
179+
180+
http://www.apache.org/licenses/LICENSE-2.0
181+
182+
Unless required by applicable law or agreed to in writing, software
183+
distributed under the License is distributed on an "AS IS" BASIS,
184+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185+
See the License for the specific language governing permissions and
186+
limitations under the License.

testData/rebar/rebar3app/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rebar3app
2+
=====
3+
4+
An OTP application
5+
6+
Build
7+
-----
8+
9+
$ rebar3 compile
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{erl_opts, [debug_info]}.
2+
{deps, []}.
3+
4+
{shell, [
5+
%% {config, "config/sys.config"},
6+
{apps, [rebar3app]}
7+
]}.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{application, rebar3app, [
2+
{description, "An OTP application"},
3+
{vsn, "0.1.0"},
4+
{registered, []},
5+
{mod, {rebar3app_app, []}},
6+
{applications, [
7+
kernel,
8+
stdlib
9+
]},
10+
{env, []},
11+
{modules, []},
12+
{licenses, ["Apache-2.0"]},
13+
{links, []}
14+
]}.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
%%%-------------------------------------------------------------------
2+
%% @doc rebar3app public API
3+
%% @end
4+
%%%-------------------------------------------------------------------
5+
6+
-module(rebar3app_app).
7+
8+
-behaviour(application).
9+
10+
-export([start/2, stop/1]).
11+
12+
start(_StartType, _StartArgs) ->
13+
rebar3app_sup:start_link().
14+
15+
stop(_State) ->
16+
ok.
17+
18+
%% internal functions
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
%%%-------------------------------------------------------------------
2+
%% @doc rebar3app top level supervisor.
3+
%% @end
4+
%%%-------------------------------------------------------------------
5+
6+
-module(rebar3app_sup).
7+
8+
-behaviour(supervisor).
9+
10+
-export([start_link/0]).
11+
12+
-export([init/1]).
13+
14+
-define(SERVER, ?MODULE).
15+
16+
start_link() ->
17+
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
18+
19+
%% sup_flags() = #{strategy => strategy(), % optional
20+
%% intensity => non_neg_integer(), % optional
21+
%% period => pos_integer()} % optional
22+
%% child_spec() = #{id => child_id(), % mandatory
23+
%% start => mfargs(), % mandatory
24+
%% restart => restart(), % optional
25+
%% shutdown => shutdown(), % optional
26+
%% type => worker(), % optional
27+
%% modules => modules()} % optional
28+
init([]) ->
29+
SupFlags = #{
30+
strategy => one_for_all,
31+
intensity => 0,
32+
period => 1
33+
},
34+
ChildSpecs = [],
35+
{ok, {SupFlags, ChildSpecs}}.
36+
37+
%% internal functions

0 commit comments

Comments
 (0)