Skip to content
Simon edited this page Jun 9, 2021 · 7 revisions

There is several way to contribute to Leshan like :

In this guide we will focus on code contribution.

How to contribute code

Here we consider that you already played with Leshan, if this is not the case please have a look to our Getting-started.
Before to propose code, you should consider to open a github issue to discuss about your changes with the community.
Code contribution is done via github pull-request, so if you're not so familiar with that, you can have a look to this guide.

Legal stuff ...

Apologies in advance for the extra work required here. This is necessary to comply with the Eclipse Foundation's strict IP policy.

In order for any contributions to be accepted you MUST do the following things.

  • Sign the Eclipse Contributor Agreement. To sign the Eclipse ECA you need to:
    • Create an eclipse account if you don't already have one. Anyone who currently uses Eclipse Bugzilla or Gerrit systems already has one of those. If you don’t, you need to register.
    • Login to sign ECA, select the “Contributor License Agreement” tab.
  • Add your github username in your Eclipse Foundation account settings. Log in it to Eclipse and go to account settings.

For more details, you can read the eclipse contribution guide.

Get Ready to Code !

First step, you need to fork the leshan repository, clicking Fork button on top-right corner of the page. For more details about forking.
Now get the code locally,

git clone git@github.com:YourGithubId/leshan.git

then build leshan,

mvn clean install

then create a new branch for your feature.

git checkout -b yourBranchName

We strongly advice you to read our Code-&-design-guidelines.
You should also have a look to the description of each Leshan modules.

You are now reading to modify Leshan !

Test it !

Before to share your work, you should consider to run automatic tests using :

mvn clean install

If you have a Redis instance available, you can also test our redis store implementation using :

# run test with default Redis URI : redis://localhost:6379
mvn clean install -Predis 
# you can use the REDIS_URI environment variable to change the URI
# using this format : redis://:password@hostname:port/db_number

You should also consider to write some JUnit tests.

Share it !

Commit your changes in your feature branches (do not forgot to sign it), then push it to your remote fork.

Now you need to send a pull-request. :warning: Do not use this branch for any other development, otherwise further changes that you make will be visible in the PR.

Refine it!

Committers/Users will review it and give you some feedbacks.
You should also review it yourself to be sure this is readable for committers. If this is not, don't wait for comment and fix it. To fix your code, no need to create a new PR.
Just modify your works in the same git branch then push it again.

You can even rewrite your git history if you want using rebase and push --force :