Code Sharing Strategy

From Gephi:Wiki

Jump to: navigation, search

Contents

Code sharing

Some basic rules how we code in Gephi and how we use Netbeans:

Using libraries

If you use libraries, wrap them into one or several modules. Further information here: http://wiki.netbeans.org/DevFaqWrapperModules

The module codebase should be org.gephi.lib.NAME.

Please send email to DEV mailing-list about that change and include it in the ChangeLog, not to forgot to update the license page on the website.

Code formatting

Always format all the code you submit. Use the Netbeans format feature, with default parameters.

License

This is the Gephi offical license.

/*
Copyright 2008-2010 Gephi
Authors : YOUR_NAME <your.email@myorg>
Website : http://www.gephi.org

This file is part of Gephi.

Gephi is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

Gephi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Gephi.  If not, see <http://www.gnu.org/licenses/>.
*/

Please put your name on the top of the license at 'YOUR_NAME' and put this license in all files you own.

You can directly include license texts in Netbeans using Tools>Templates.

Javadoc

All open APIs (public interfaces) should have a complete Javadoc. Of course this is a global aim for the future and should be completed when you estimate a module is finished. In the mean time, be sure your real name appears completely in all classes you own. This is the minimum thing you should add. As for license, it can be done with Netbeans.

It is recommended to read the Javadoc Good practices. It gives guidance and rules to make good Javadoc.

Module name convention

Please respect new modules naming convetion:

  • No whitespace
  • Add Wrapper in case of a library wrapper

Codebase convention

New modules should follow the following codebase rules:

API org.gephi.NAME.api
API Implementation org.gephi.NAME
SPI org.gephi.NAME.spi
SPI Implementation org.gephi.NAME.plugin
SPI Implementation UI org.gephi.ui.NAME.plugin
Desktop UI org.gephi.desktop.NAME

Module branding

Branding options for Netbeans modules. Set it from module Properties > Display.

  • Display name can have whitespace
  • Display Category:
    • Gephi Core for all API and Impl modules
    • Plugin for all Plugin and PluginUI modules
    • Libraries for all libs
    • Gephi UI for all Desktop modules

And don't forgot to set the license and author in the Build > Packaging settings.

License should be ../agpl-3.0.txt and Author Gephi.org

Distributed development

Launchpad identity

Set your identity to bazaar, in order your commit will be recognized in Launchpad. You have to do this only once. Enter the command

bzr launchpad-login my_launchad_login

This command will fail if you haven't set up an SSH key in launchpad yet. To find out how to do that go to [[1]].

Then, the command bzr whoami should return your identity.

Create your gephi branch

  1. Go to launchpad > gephi > code > register a branch and create your branch, eg: ~MYSELF/gephi/MYBRANCH
  2. Go in a directory and type bzr branch lp:gephi/0.7 MYBRANCH
  3. You're ready to follow the typical daily workflow (see below)

Typical daily workflow

  1. Close Netbeans to avoid any configuration file synchronization issue
  2. Enter your branch directory : cd MYBRANCH
  3. Be sure to have the last Gephi code from the main branch : bzr merge lp:gephi/0.7
  4. Manually check for merging conflicts with bzr conflicts
  5. Add your new files with bzr add MYFOLDER or bzr add . (this last one will do a recursive add)
  6. .. if you made a mistake, you can safely "unadd" it by typing bzr remove --new --keep MYFOLDER
  7. Start Netbeans IDE and try to build the Gephi 0.7 distribution, and watch for dependencies errors (eg. "couldn't find org.java.swingx.my.class")
  8. To fix dependencies errors, add missing modules to the Gephi 0.7 distribution : right click > "add existing module", and add by example "SwingX Module"
  9. Commit your work with an useful comment with bzr commit -m "added and fixed a lot of things in my module"
  10. Push to your branch: bzr push lp:~MYSELF/gephi/MYBRANCH

More help on Launchpad.

Before commit

  • Be sure you added all the files needed and all the dependencies in order your code compile.
  • Always set a comment to your commit, at least a single line.

Auto-Update

Thanks to Netbeans Platform, Gephi has an auto-update feature. Update is done according to the "Specification version" for each module. Therefore, if you made a change that will be deployed through auto-update, increment the Specification Version of all modules you touched.

Personal tools