Skip to content
Baptiste Wicht edited this page Jan 4, 2016 · 8 revisions

###Sign up for GitHub

TBD

###Checkout Sources

If you have never used Git before, you need to do some setup first. Run the following commands so that GIT knows your name and email.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Setup line endings preferences:

# For Unix/Mac users
git config --global core.autocrlf input
git config --global core.safecrlf true

# For Windows users
git config --global core.autocrlf true
git config --global core.safecrlf true

Get sources by executing:

git clone https://github.com/SonarOpenCommunity/sonar-cxx.git

Committers must configure their SSH key (see GitHub documentation for Windows and Mac) and clone repository:

git clone [email protected]:SonarOpenCommunity/sonar-cxx.git

###Build

  • Install JDK 7 or greater.
  • Install Maven 3.2.1 or greater.
  • Execute mvn clean install on command line in root folder of your local copy.
  • For development you can use e.g. Eclipse or NetBeans 8.0 or greater.

###Debug

If you want to debug your code there are at least three possibilities:

  1. Best and easiest possibility is to write an Unit Test for your changes. In this case you can run your debugger for your particular Unit Test to debug into your code within the IDE. Any other changes are not needed in this case.
  2. In case you have to debug code which is executed during analyzer run you have to prepare and start the sonar-runner for debugging.
  3. Copy your plugin's jar file to SONAR_HOME/extensions/plugins
  4. Start SonarQube normally, (debug is commented out in wrapper.config)
  5. At a command prompt, cd to the directory of the project you'll be analyzing
  6. Start sonar-runner in debug mode with the following commands
    SET SONAR_RUNNER_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
  7. Attach the IDE to the debug process on port 8000, set breakpoints in the source, and debug!
  8. In case you have to debug code on the sever side do the following steps:
  9. Copy your plugin's jar file to SONAR_HOME/extensions/plugins
  10. Edit SONAR_HOME/conf/wrapper.conf and uncomment the line: wrapper.java.additional.3=-agentlib:jdwp=transport=dt_socket,server=y,address=8000
  11. Launch SonarQube normally. The following line will appear in the log: Listening for transport dt_socket at address: 8000
  12. Attach the IDE to the debug process on port 8000, set breakpoints in the source, and debug!

See also Coding a Plugin / Debugging

###Testing

We have plenty of unit tests (not all of them being really 'unit') and a couple of integration-level smoke-tests. The former can be run with e.g. mvn test; refer to Integration test suite on how to use the latter.

###Helpful Links