Difference between revisions of "Environment and development tools - Optional"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<!-- BEGIN origin interlang links -->
 +
<!-- You can edit this section but do NOT remove these comments
 +
    Links below will be automatically replicated on translated pages by PolyglotBot -->
 +
[[fr:Outils_de_développement_-_Composants_optionnels]]
 +
[[es:Herramientas_de_Desarrollo_-_Opcional]]
 +
<!-- END interlang links -->
 +
 
{{TemplateDocDev}}
 
{{TemplateDocDev}}
This page describe all optional components you can install to support more technologies for development around Dolibarr.
+
This page describes optional components you may install to support more technologies for development of Dolibarr.
They are not required to develop Dolibarr nor modules but may be usefull for specific development.
+
They are not required to develop Dolibarr nor modules but may be useful for specific development.
 +
 
 +
 
 +
==If you want to make Perl scripts==
 +
 
 +
*Install the Eclipse plugin for Perl: EPIC
  
== If you manage other projects with SVN ==
+
For this, use the '''Find And Install process''' and add the update URL:  
* Install Eclipse plugin for SVN: SubClipse
 
For this, use the '''Find And Install process''' and add the SVN update URL:  
 
  
http://subclipse.tigris.org/install.html
+
[http://e-p-i-c.sourceforge.net/updates https://e-p-i-c.sourceforge.net/updates]  or
  
or
+
https://www.epic-ide.org/updates/
* Install Eclispe plugin for SVN: Subversive
 
  
http://community.polarion.com/projects/subversive/download/eclipse/2.0/ganymede-site/ - [required] Subversive SVN Connectors
+
==If you want to make Python scripts==
  
http://community.polarion.com/projects/subversive/download/integrations/ganymede-site/ - [optional] Subversive Integrations
+
*Install the Eclipse plugin for Python: PyDev
  
== If you want to make Perl scripts ==
+
For this, use the '''Find And Install process''' and add the update URL: http://pydev.org/updates  
* Install the Eclipse plugin for Perl: EPIC
 
For this, use the '''Find And Install process''' and add the update URL: http://e-p-i-c.sourceforge.net/updates
 
  
== If you want to make Python scripts ==
+
==If you are using Windows==
* Install the Eclipse plugin for Python: PyDev
 
For this, use the '''Find And Install process''' and add the update URL: http://pydev.org/updates
 
  
== If you are using Windows ==
+
*Notepad++ (for those who can't stand java or are using a computer too old for Eclipse).
  
* Notepad++ (for those which can't stand java or using a computer too old for Eclipse).
+
*WinMerge (to compare files and directories)
  
* WinMerge (to compare files and directories)
+
*CygWin (to have the "patch" command)
  
* CygWin (to have the "patch" command)
+
==If you want to do step by step debugging or tuning (XDebug)==
  
== To make FirePHP Debug ==
+
*To add global tuning information, from dolibarr 3.8, for pages on your browser javascript console log, add environment variable MAIN_SHOW_TUNING_INFO to 1 on your webserver.
If using Ubuntu, you can also complete PHP with FirePHP module by running
+
 
<source lang="php">
+
For Apache, just add the following line into your apache.conf:
pear channel-discover pear.firephp.org
+
<syntaxhighlight lang="ini">
pear install firephp/FirePHPCore
+
SetEnv MAIN_SHOW_TUNING_INFO 1
 
</source>
 
</source>
 +
For Nginx, add the following line to your php location:
 +
<syntaxhighlight lang="ini">
 +
fastcgi_param MAIN_SHOW_TUNING_INFO true;
 +
</source>
 +
The variable name is DOL_TUNING for versions of Dolibarr < 3.8.
  
== If you want to make step by step debugging or tunning (XDebug) ==
+
*Install XDebug:
* To add global tuning information for pages on your browser javascript console log, add environment variable DOL_TUNING to 1 into Apache. For this, just add the following line into your apache.conf:
+
 
<source lang="ini">
+
===[[File:Logo_windows.png|24px]] In Windows===
SetEnv DOL_TUNING 1
+
 
</source>
+
*Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin.
  
* Install XDebug:
+
*Modify php.ini file to add parameters:
=== [[File:Logo_windows.png|24px]] In Windows ===
 
* Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin.
 
  
* Modify php.ini file to add parameters:
+
<syntaxhighlight lang="ini">
<source lang="ini">
 
 
  [xdebug]
 
  [xdebug]
 
  xdebug.remote_enable=on
 
  xdebug.remote_enable=on
Line 61: Line 68:
 
  xdebug.profiler_enable=0
 
  xdebug.profiler_enable=0
 
  xdebug.profiler_enable_trigger=1
 
  xdebug.profiler_enable_trigger=1
</source>
+
</syntaxhighlight>
 +
 
 +
===[[File:Logo_ubuntu.png|24px]] In Ubuntu / Linux===
 +
 
 +
*Install package '''php-xdebug''':
 +
 
 +
<syntaxhighlight lang="bash">
 +
sudo apt-get install php-xdebug
 +
</syntaxhighlight>
  
=== [[File:Logo_ubuntu.png|24px]] In Ubuntu / Linux ===
+
*Modify xdebug.ini to add parameters after the line zend_extension=xxx (or similar):
* Install package '''php-xdebug''':
 
<source lang="bash">
 
sudo apt-get install php5-xdebug
 
</source>
 
  
* Modify xdebug.ini to add parameters after the line zend_extension=xxx (or similar):
+
<syntaxhighlight lang="ini">
<source lang="ini">
 
 
  ; With xdebug 2.1 and more
 
  ; With xdebug 2.1 and more
 
  xdebug.remote_enable=on
 
  xdebug.remote_enable=on
Line 85: Line 95:
 
  xdebug.auto_trace=0
 
  xdebug.auto_trace=0
 
  xdebug.trace_enable_trigger=1
 
  xdebug.trace_enable_trigger=1
</source>
+
</syntaxhighlight>
 +
 
 +
===[[File:Eclipsephp.jpg|24px]] Eclipse configuration===
  
=== [[File:Eclipsephp.jpg|24px]] Eclipse configuration ===
+
*Open Eclipse. In Window->Preferences->General->Web Browser, select external web browser, and set it to Default system web browser.
* Open Eclipse. In Window->Preferences->General->Web Browser, select external web browser, and set it to Default system web browser.  
 
  
* Go into the debug section, by Window->Preferences->PHP->Debug, and set the PHP Debugger option to XDebug (by default this is set to the Zend Debugger). Note the chekbox “Break at first line” in this page as well – you can change this later on, as required.  
+
*Go into the debug section, by Window->Preferences->PHP->Debug, and set the PHP Debugger option to XDebug (by default this is set to the Zend Debugger). Note the chekbox “Break at first line” in this page as well – you can change this later on, as required.
  
* After you’ve applied your changes, go into the PHP Debug prespective, and go to menu Debug Configurations… Here, make sure the Server Debugger is set to XDebug, and that the PHP server points to http://localhost/ or an appropriate server location. The file section should point to the file to be debugged, relative to your workspace, the relative path maybe something /dolibarr/htdocs/index.php.
+
*After you’ve applied your changes, go into the PHP Debug prespective, and go to menu Debug Configurations… Here, make sure the Server Debugger is set to XDebug, and that the PHP server points to http://localhost/ or an appropriate server location. The file section should point to the file to be debugged, relative to your workspace, the relative path maybe something /dolibarr/htdocs/index.php.
  
* Check the URL section to see whether it points to the correct location – if not, make sure you uncheck the “Auto-Generate” check box, and enter in the correct location. Apply the changes and close the dialog box.
+
*Check the URL section to see whether it points to the correct location – if not, make sure you uncheck the “Auto-Generate” check box, and enter in the correct location. Apply the changes and close the dialog box.
  
* You should now be ready to debug Dolibarr. Click on Run->Debug or F11 to enable debugging, Eclipse should switch to the Debug View, and the page should start loading in your external browser. If “Break at First Line” checkbox was checked previously, then the program would have “stopped” at the first line. You can step into or step over subsequent lines using the controls on your top left corner. Alternatively, you can place breakpoints at various locations and stop code execution there as well.
+
*You should now be ready to debug Dolibarr. Click on Run->Debug or F11 to enable debugging, Eclipse should switch to the Debug View, and the page should start loading in your external browser. If “Break at First Line” checkbox was checked previously, then the program would have “stopped” at the first line. You can step into or step over subsequent lines using the controls on your top left corner. Alternatively, you can place breakpoints at various locations and stop code execution there as well.
  
  
 
Then to analyze files generated by XDebug profiling, you must call the page by adding parameter XDEBUG_PROFILE=1 to generate the file and then install KCacheGrind (Linux) or WinCacheGrind (Windows) to analyze them.
 
Then to analyze files generated by XDebug profiling, you must call the page by adding parameter XDEBUG_PROFILE=1 to generate the file and then install KCacheGrind (Linux) or WinCacheGrind (Windows) to analyze them.
  
== To develop or use Quality controls (PHPUnit, PHPCodeSniffer, PHPCpd, PHPDepends) ==
+
==To develop or use Quality controls (PHPUnit, PHPCodeSniffer, PHPCpd, PHPDepends)==
=== From Eclipse ===
+
===From Eclipse===
You can also optionnally install The PHP Tools integration (PTI) using the Eclipse plugin installer menu with this following URL:
+
The plugin to provide phpcodesniffer or phpunit for Eclipse is now deprecated.
 +
 
 +
*PHPUnit is supported by default on a standard Eclipse installation
 +
 
 +
*To get PHP Codesniffer, you can create an entry "External Tools" with this setup
 +
 
 +
[[Image:Setup_phpcs.png]]
 +
 
 +
<br />
 +
 
 +
===From Command Line===
 +
====Install PHPUnit====
 +
 
 +
*Project-page:  https://phpunit.de/
 +
*Download a release archive from https://github.com/sebastianbergmann/phpunit and extract it to a directory that is listed in the include_path of your php.ini configuration file.
 +
*Module xdebug can also be required if you plan to make reporting of test code covering.
  
http://www.phpsrc.org/eclipse/pti/
+
====Execute PHPUnit tests or generate code coverage reports====
  
If you do so, menu to launch tools tests are available in your Eclipse menu.  
+
*Go into directory '''/test''' of sources. Read file '''README''' to know the process to execute one or several unit tests.
  
Modify your Eclipse setup (Windows-Preferences-PHPTools-PHPCodeSniffer) to add a new directory standard found into''' dev/codesniffer'''.
+
====Install other quality tools (phpcs, phpcd, phpdepends)====
  
Modify your Eclipse setup (Windows-Preferences-PHPTools-PHPUnit) like on screen shot (click to zoom):
+
*Take a look at tools documentation (PHPCodeSniffer, PHPPcd, PHPDepends). For example, to install or upgrade PHPCodeSniffer
  
[[File:Eclipse setup PHPUnit.png|100px]]
+
<syntaxhighlight lang="bash">
 +
sudo pear upgrade PHP_CodeSniffer
 +
</syntaxhighlight>
 +
And check into PHPCodeSniffer setup, that you use the PEAR libraries store into */usr/bin/php*
  
If you did not install PTI, you must install and run PHPUnit and other quality tools manually from command line.
+
==To develop or use Selenium tests==
 +
===From Firefox===
 +
====Install plugin for Firefox Selenium IDE====
  
=== From Command Line ===
+
*Download file of plugin "Selenium IDE" for Firefox.
==== Instal PHPUnit ====
+
*Add it into firefox in menu Tools - Complementary modules.
* Download a release archive from http://pear.phpunit.de/get/ and extract it to a directory that is listed in the include_path of your php.ini configuration file.
 
* Prepare the phpunit script:
 
** For Linux: Rename the phpunit.php script to phpunit and replace the @php_bin@ string in it with the path to your PHP command-line interpreter (usually /usr/bin/php).
 
** For Windows: Replace the @php_bin@ string in file phpunit.bat with the path of your PHP command-line interpreter and @bin_dir@ string with the path of the PHPunit directory.
 
** Edit your Path to inclulde PHPunit directory
 
** Make script runnable (chmod +x phpunit on Linux).
 
* Prepare the PHPUnit/Util/PHP.php script:
 
** Replace the @php_bin@ string if it exists in file it with the path to your PHP command-line interpreter (usually /usr/bin/php).
 
* Module xdebug can also be required if you plan to make reporting of test code covering.
 
  
==== Execute PHPUnit tests or generate code coverage reports ====
+
====Execute Selenium tests====
* Go into directory '''/test''' of sources. Read file '''README''' to know the process to execute a unit test campaign.
 
  
==== Install other quality tools ====
+
*Go into menu Tools - Selinum IDE of Firefox.
* Take a look at tools documentation (PHPCodeSniffer, PHPPcd, PHPDepends).
+
*Open xml file of the suite tests.
 +
*Execute the test.
  
== To develop or use Selenium tests ==
+
==To build Doxygen documentation==
=== From Firefox ===
 
==== Install plugin for Firefox Selenium IDE ====
 
* Download file of plugin "Selenium IDE" for Firefox.
 
* Add it into firefox in menu Tools - Complementary modules.
 
  
==== Execute Selenium tests ====
+
*Install Doxygen available for download at http://www.doxygen.org (or install package doxygen with Ubuntu).
* Go into menu Tools - Selinum IDE of Firefox.
+
*Install Eclipse plugin by adding source http://download.gna.org/eclox/update/ into your Eclipse update setup. Then setup your Eclipse (Window-Preferences-Doxygen) to define path to Doxygen tool.
* Open xml file of the suite tests.
 
* Execute the test.
 
  
== To build Doxygen documentation ==
+
==To add asciidoc support into Eclipse==
* Install Doxygen available for download at http://www.doxygen.org (or install package doxygen with Ubuntu).
 
* Install Eclipse plugin by adding source http://download.gna.org/eclox/update/ into your Eclipse update setup. Then setup your Eclipse (Window-Preferences-Doxygen) to define path to Doxygen tool.
 
  
== To develop Android component ==
+
*Add the URL to Install repositories http://download.eclipse.org/mylyn/snapshots/nightly/docs/. Then install package '''Mylyn Docs - Mylyn Wikitext Extras'''
* Download android SDK and unzip it: http://developer.android.com/sdk
 
* Install Android Eclipse plugin:
 
** Start Eclipse, then select Help > Install New Software.
 
** Click Add, in the top-right corner.
 
** In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/
 
** If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
 
** In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
 
** In the next window, you'll see a list of the tools to be downloaded. Click Next.
 
** Read and accept the license agreements, then click Finish.
 
** If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
 
** When the installation completes, restart Eclipse.
 

Latest revision as of 13:32, 3 June 2022


This page describes optional components you may install to support more technologies for development of Dolibarr. They are not required to develop Dolibarr nor modules but may be useful for specific development.


If you want to make Perl scripts

  • Install the Eclipse plugin for Perl: EPIC

For this, use the Find And Install process and add the update URL:

https://e-p-i-c.sourceforge.net/updates or

https://www.epic-ide.org/updates/

If you want to make Python scripts

  • Install the Eclipse plugin for Python: PyDev

For this, use the Find And Install process and add the update URL: http://pydev.org/updates

If you are using Windows

  • Notepad++ (for those who can't stand java or are using a computer too old for Eclipse).
  • WinMerge (to compare files and directories)
  • CygWin (to have the "patch" command)

If you want to do step by step debugging or tuning (XDebug)

  • To add global tuning information, from dolibarr 3.8, for pages on your browser javascript console log, add environment variable MAIN_SHOW_TUNING_INFO to 1 on your webserver.

For Apache, just add the following line into your apache.conf:

SetEnv MAIN_SHOW_TUNING_INFO 1
</source>
For Nginx, add the following line to your php location:
<syntaxhighlight lang="ini">
fastcgi_param MAIN_SHOW_TUNING_INFO true;
</source>
The variable name is DOL_TUNING for versions of Dolibarr < 3.8.

*Install XDebug:

===[[File:Logo_windows.png|24px]] In Windows===

*Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin.

*Modify php.ini file to add parameters:

<syntaxhighlight lang="ini">
 [xdebug]
 xdebug.remote_enable=on
 xdebug.remote_handle=dbgp
 xdebug.remote_host=localhost
 xdebug.remote_port=9000
 xdebug.show_local_vars=off
 xdebug.profiler_output_dir=c:/temp
 xdebug.profiler_append=0
 xdebug.profiler_enable=0
 xdebug.profiler_enable_trigger=1

Logo ubuntu.png In Ubuntu / Linux

  • Install package php-xdebug:
sudo apt-get install php-xdebug
  • Modify xdebug.ini to add parameters after the line zend_extension=xxx (or similar):
 ; With xdebug 2.1 and more
 xdebug.remote_enable=on
 xdebug.remote_handle=dbgp
 xdebug.remote_host=localhost
 xdebug.remote_port=9000
 xdebug.show_local_vars=off
 xdebug.profiler_output_dir=/var/tmp
 xdebug.profiler_enable=0
 xdebug.profiler_enable_trigger=1
 ; Add also this with xdebug 2.2 and more
 xdebug.show_mem_delta=1
 xdebug.trace_output_dir=/var/tmp
 xdebug.auto_trace=0
 xdebug.trace_enable_trigger=1

Eclipsephp.jpg Eclipse configuration

  • Open Eclipse. In Window->Preferences->General->Web Browser, select external web browser, and set it to Default system web browser.
  • Go into the debug section, by Window->Preferences->PHP->Debug, and set the PHP Debugger option to XDebug (by default this is set to the Zend Debugger). Note the chekbox “Break at first line” in this page as well – you can change this later on, as required.
  • After you’ve applied your changes, go into the PHP Debug prespective, and go to menu Debug Configurations… Here, make sure the Server Debugger is set to XDebug, and that the PHP server points to http://localhost/ or an appropriate server location. The file section should point to the file to be debugged, relative to your workspace, the relative path maybe something /dolibarr/htdocs/index.php.
  • Check the URL section to see whether it points to the correct location – if not, make sure you uncheck the “Auto-Generate” check box, and enter in the correct location. Apply the changes and close the dialog box.
  • You should now be ready to debug Dolibarr. Click on Run->Debug or F11 to enable debugging, Eclipse should switch to the Debug View, and the page should start loading in your external browser. If “Break at First Line” checkbox was checked previously, then the program would have “stopped” at the first line. You can step into or step over subsequent lines using the controls on your top left corner. Alternatively, you can place breakpoints at various locations and stop code execution there as well.


Then to analyze files generated by XDebug profiling, you must call the page by adding parameter XDEBUG_PROFILE=1 to generate the file and then install KCacheGrind (Linux) or WinCacheGrind (Windows) to analyze them.

To develop or use Quality controls (PHPUnit, PHPCodeSniffer, PHPCpd, PHPDepends)

From Eclipse

The plugin to provide phpcodesniffer or phpunit for Eclipse is now deprecated.

  • PHPUnit is supported by default on a standard Eclipse installation
  • To get PHP Codesniffer, you can create an entry "External Tools" with this setup

Setup phpcs.png


From Command Line

Install PHPUnit
Execute PHPUnit tests or generate code coverage reports
  • Go into directory /test of sources. Read file README to know the process to execute one or several unit tests.
Install other quality tools (phpcs, phpcd, phpdepends)
  • Take a look at tools documentation (PHPCodeSniffer, PHPPcd, PHPDepends). For example, to install or upgrade PHPCodeSniffer
sudo pear upgrade PHP_CodeSniffer

And check into PHPCodeSniffer setup, that you use the PEAR libraries store into */usr/bin/php*

To develop or use Selenium tests

From Firefox

Install plugin for Firefox Selenium IDE
  • Download file of plugin "Selenium IDE" for Firefox.
  • Add it into firefox in menu Tools - Complementary modules.
Execute Selenium tests
  • Go into menu Tools - Selinum IDE of Firefox.
  • Open xml file of the suite tests.
  • Execute the test.

To build Doxygen documentation

  • Install Doxygen available for download at http://www.doxygen.org (or install package doxygen with Ubuntu).
  • Install Eclipse plugin by adding source http://download.gna.org/eclox/update/ into your Eclipse update setup. Then setup your Eclipse (Window-Preferences-Doxygen) to define path to Doxygen tool.

To add asciidoc support into Eclipse