Skip to content

Commit f6dd18d

Browse files
author
Yorgos Saslis
committed
Moved Contributor's guide from the wiki page, to the project root
I saw `asciidoc` is used for most of the documentation, so I converted the guidelines from the wiki markup to `asciidoc`. Closes #2182
1 parent 13be3d8 commit f6dd18d

File tree

1 file changed

+282
-0
lines changed

1 file changed

+282
-0
lines changed

CONTRIBUTING.asciidoc

+282
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
= Contribute to Restcomm
2+
3+
Multiple types of contributions are possible :
4+
5+
* Using it in your product or project and providing feedback.
6+
* Code & Algorithms: Core Projects, Incubator projects, Frameworks
7+
* Use cases, feature requests: Roadmap influence
8+
* Community Support, bug fixes, forum posts: Help to be helped
9+
* Documentation: Everyone needs good docs, Code is a moving targed.
10+
* Testing (Perf, load, security, unit tests, interop, ...) / CI
11+
12+
Here is specific types of contributions that requires a little more details if you want to get involved
13+
14+
* Fixing Bugs : See https://help.github.com/articles/closing-issues-via-commit-messages
15+
* Reporting Bugs : To report a bug, if possible, provide a small example that illustrates the bug. You can pattern
16+
the test case usually along the lines of ones found in the
17+
link:https://github.com/Restcomm/Restcomm-Connect/tree/master/restcomm/restcomm.testsuite[testsuite].
18+
Having a test case handy speeds up the bug fix. Your test case will be included in the project as a test case.
19+
Open an Issue as defined in the section below so other users can know about the issue and its status.
20+
Please attach your test case or bug description with debug log files there.
21+
* Contributing Extensions and enhancements (i.e. support for extension RFCs and drafts that are not covered by
22+
Restcomm) or Contributing code snippets and examples or Contributing test cases to be included with the
23+
distribution: See Contribution Process below in Section "How to check out, change, review, and commit code".
24+
Also open a thread on link:http://groups.google.com/group/restcomm[the mailing list of Restcomm google group]
25+
to discuss it with the community and Restcomm Team Members.
26+
27+
Your contributions will be acknowledged individually in the code (as a comment) and in the
28+
link:http://www.telestax.com/opensource/#Contribute[Acknowledgement page].
29+
30+
31+
= Opening an Issue
32+
33+
link:https://github.com/Restcomm/Restcomm-Connect/issues/new[Open An Issue Here]
34+
35+
= Becoming a Contributor
36+
37+
In order to become a contributor with write access to the code, you will need to have demonstrated an understanding
38+
of the codebase and testsuite by participating in the design discussions and submitting patches for bugs/enchancements
39+
before we will grant developer access.
40+
41+
Contributing to Restcomm requires you to accept link:http://telestax.com/opensource/[the TeleStax Contributor Agreement]
42+
(bottom of the page).
43+
44+
= How to check out, change, review, and commit code
45+
== Introduction
46+
47+
Restcomm projects use Git, a distributed version control system. What this means is that, even though this page hosts
48+
a central repository, there can be many clone repositories with changes of their own, and then some of those can be
49+
merged back into the main repository.
50+
51+
*The great part is that you can start contributing and create our own clone without having write access to the
52+
Restcomm repository*
53+
54+
This document describes the workflow for checking out code, making clones, reviewing patches, and committing code.
55+
56+
== Checking out Restcomm Connect (Linux)
57+
58+
For non-committers, checking out code is simple.
59+
60+
=== Install Git
61+
62+
Follow the installing Git instructions. Ubuntu users can simply type:
63+
64+
[source,bash]
65+
----
66+
sudo apt-get install git-core
67+
----
68+
69+
Configure Git to convert line endings on commit
70+
71+
[source,bash]
72+
----
73+
git config --global core.autocrlf input
74+
----
75+
76+
=== Checkout the code
77+
78+
To check out the code :
79+
80+
[source,bash]
81+
----
82+
git clone [email protected]:Restcomm/Restcomm-Connect.git
83+
----
84+
85+
86+
=== Building Restcomm From Source
87+
To Build Restcomm from Source, follow those instructions : http://docs.telestax.com/restcomm-mobicents-building-from-source/
88+
89+
90+
=== Committing code
91+
92+
The following License Header has to be placed on top of each source code file contributed
93+
94+
[source,java]
95+
----
96+
/*
97+
* TeleStax, Open Source Cloud Communications
98+
* Copyright 2011-2015, Telestax Inc and individual contributors
99+
* by the @authors tag.
100+
*
101+
* This program is free software: you can redistribute it and/or modify
102+
* under the terms of the GNU Affero General Public License as
103+
* published by the Free Software Foundation; either version 3 of
104+
* the License, or (at your option) any later version.
105+
*
106+
* This program is distributed in the hope that it will be useful,
107+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
108+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109+
* GNU Affero General Public License for more details.
110+
*
111+
* You should have received a copy of the GNU Affero General Public License
112+
* along with this program. If not, see <http://www.gnu.org/licenses/>
113+
*
114+
*/
115+
----
116+
117+
The model we've chosen for developing Restcomm is the following:
118+
119+
Each contributor creates their own fork of the Restcomm project (you want to contribute to) repository.
120+
121+
This clone is hosted on Github servers, and can be created by clicking *Fork* button from
122+
https://github.com/Restcomm/Restcomm-Connect
123+
124+
The contributor then makes a local clone of their GitHub fork, which is stored on their local machine.
125+
Instructions for checking it out is https://github.com/<contributor_github_account>/Restcomm
126+
127+
The contributor creates a new Issue explaining their contribution at
128+
https://github.com/Restcomm/Restcomm-Connect/issues/new
129+
130+
The contributor then creates a new branch into their local clone
131+
132+
[source,bash]
133+
----
134+
git checkout -b feature-branch
135+
----
136+
137+
Do the changes into their branch for their local branch for the contribution and commit them
138+
139+
[source,bash]
140+
----
141+
git commit -a -m "commit message"
142+
----
143+
144+
**//IMPORTANT//:Please use the Github integration to use the commit message to tie the commits to the Issue you're
145+
working on. More information on that can be found at https://help.github.com/articles/closing-issues-via-commit-messages**
146+
147+
**//IMPORTANT//: When your change is pulled into the main Restcomm source, the change description that you entered here
148+
will show up as changes in the main Restcomm source, so please use a meaningful description - fixing bug, making
149+
changes, etc. are not ok, please instead use something like fixing transform bug caused by NPE, etc. so that it makes
150+
sense in the context of Restcomm as a whole, not just your clone.**
151+
152+
If you have any new files, make sure to use the following command before committing
153+
154+
[source,bash]
155+
----
156+
git add <file or directory>
157+
----
158+
159+
Same thing if you want to remove some files
160+
161+
[source,bash]
162+
----
163+
git rm <file or directory>
164+
----
165+
166+
== Pushing changes to your online clone
167+
168+
When a change is ready to be integrated back into the repository, that change is pushed from the developer's local
169+
clone to their Github Fork clone.
170+
171+
[source,bash]
172+
----
173+
git push origin feature-branch
174+
----
175+
176+
To avoid merge soup, please rebase your branch first
177+
178+
==== Bringing in new changes from the upstream repository
179+
180+
If the main repository has evolved since your last push to your clone repository, you will need to bring those changes
181+
into your repository as well as potentially merge them.
182+
183+
You need to add a remote via which you will identify the upstream repository:
184+
185+
[source,bash]
186+
----
187+
git remote add upstream [email protected]:Restcomm/Restcomm-Connect.git
188+
----
189+
190+
Now whenever you want to merge upstream changes into your clone, do the following:
191+
192+
[source,bash]
193+
----
194+
git fetch upstream
195+
git merge upstream/master
196+
----
197+
198+
==== Pushing changes to your clone repository
199+
200+
First pull in all of the latest changes from upstream, apply them to your master branch, then rebase your feature
201+
branch against master before merging it into master and pushing it upstream:
202+
203+
[source,bash]
204+
----
205+
git checkout master
206+
git fetch upstream
207+
git merge upstream/master
208+
git checkout awesome-feature
209+
git rebase master
210+
(fix any conflicts with upstream changes)
211+
git push origin feature-branch
212+
----
213+
214+
Browse to Source -> Changes from the project page for your clone and navigate to the page with details on the branch
215+
to be reviewed. For example, https://github.com/<contributor_github_account>/Restcomm/tree/development
216+
217+
You will need to paste the URL for this page into the issue you created earlier.
218+
Describe the code to be reviewed, its purpose, and paste in the URL for the relevant changeset(s) or branch(es).
219+
220+
The code will be reviewed on the contributor's clone - if any further changes are suggested, a couple of iterations
221+
might be needed so the contributor will need to modify the code again, commit, push and comment on the issue.
222+
223+
Once the change is approved, a committer of Restcomm will merge it back into the main repository with the following
224+
commands.
225+
226+
[source,bash]
227+
----
228+
git checkout -b feature-branch
229+
git pull https://github.com/<contributor_github_account>/Restcomm/ feature-branch
230+
git checkout master
231+
git merge feature-branch
232+
----
233+
234+
Even though this may sound complicated, this process makes code reviews easier and allows a lot of people to work on
235+
changes in parallel.
236+
237+
==== Code formatting
238+
239+
In order to avoid merge conflicts, be it with new features or bug fixes, Restcomm takes advantage of maven code
240+
formatting plugin. By default, all of our projects trigger this plugin during build. It provides information on code
241+
style and violations of certain rules.
242+
Example failure may look as follows:
243+
244+
[source,bash]
245+
----
246+
[INFO] Starting audit...
247+
/home/baranowb/Restcomm/git/test/src/main/java/Test.java:46: Line has trailing spaces.
248+
/home/baranowb/Restcomm/git/test/src/main/java/Test.java:47:1: '{' should be on the previous line.
249+
/home/baranowb/Restcomm/git/test/src/main/java/Test.java:50: Line has trailing spaces.
250+
Audit done.
251+
----
252+
253+
Contributor responsibility is to provide us with code, which obeys formatting rules. If source does not pass code
254+
style checks, it won't be accepted!
255+
256+
===== IDE formatting support
257+
258+
IDEs have native support for formatting. To take advantage of it, you need to import configuration files.
259+
Restcomm has projects wide configuration for IDEs. It can be found here:
260+
http://grepcode.com/snapshot/repo1.maven.org/maven2/org.mobicents/checkstyle/1.0.0.FINAL/
261+
or in any tagged relase of this artifact.
262+
263+
===== Eclipse
264+
To import formatter rules into eclipse perform following:
265+
266+
* Window > Preferences > Java > Code Style > Clean Up > 'Import' -> cleanup.xml
267+
* Window > Preferences > Java > Code Style > Formatter > 'Import' -> formatter.xml
268+
269+
Optionally:
270+
* Window > Preferences > Java > Code Style > Code Templates > 'Import' -> templates.xml
271+
272+
===== Maven checkstyle configuration
273+
274+
The checkstyle plugin is pre-configured in mobicents-parent artifact. To enable it in any subproject which depends on it, you need to add only following lines in *plugins* section of master project pom:
275+
276+
[source,xml]
277+
----
278+
<plugin>
279+
<groupId>org.apache.maven.plugins</groupId>
280+
<artifactId>maven-checkstyle-plugin</artifactId>
281+
</plugin>
282+
----

0 commit comments

Comments
 (0)