forked from SonarOpenCommunity/sonar-cxx
-
Notifications
You must be signed in to change notification settings - Fork 1
Build the plugin
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:
- 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.
- In case you have to debug code which is executed during analyzer run you have to prepare and start the sonar-runner for debugging.
- Copy your plugin's jar file to
SONAR_HOME/extensions/plugins
- Start SonarQube normally, (debug is commented out in wrapper.config)
- At a command prompt, cd to the directory of the project you'll be analyzing
- 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
- Attach the IDE to the debug process on port 8000, set breakpoints in the source, and debug!
- In case you have to debug code on the sever side do the following steps:
- Copy your plugin's jar file to
SONAR_HOME/extensions/plugins
- Edit
SONAR_HOME/conf/wrapper.conf
and uncomment the line:wrapper.java.additional.3=-agentlib:jdwp=transport=dt_socket,server=y,address=8000
- Launch SonarQube normally. The following line will appear in the log: Listening for transport dt_socket at address: 8000
- 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