2010-12-15 10:31:42 +01:00
|
|
|
Hacking
|
|
|
|
|
=======
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
This is a guide about how to start hacking on *LibrePlan* project. If you want
|
|
|
|
|
more information about *LibrePlan* development you should visit the wiki
|
|
|
|
|
available at: http://wiki.libreplan.org/.
|
2010-12-15 10:31:42 +01:00
|
|
|
|
2011-06-15 10:43:40 +02:00
|
|
|
.. contents::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compilation requirements
|
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
|
|
* *Git* - Version Control System
|
|
|
|
|
|
|
|
|
|
Needed to clone source code repository
|
|
|
|
|
|
|
|
|
|
* *Maven 2* - Java software project management and comprehension tool
|
|
|
|
|
|
|
|
|
|
Needed to build and compile the project
|
|
|
|
|
|
|
|
|
|
* *JDK 6* - Java Development Kit
|
|
|
|
|
|
|
|
|
|
Project depends on Java 6 and JDK is needed in order to compile it
|
|
|
|
|
|
|
|
|
|
* *PostgreSQL* - Object-relational SQL database
|
|
|
|
|
|
|
|
|
|
Database server
|
|
|
|
|
|
|
|
|
|
* *Python Docutils* - Utilities for the documentation of Python modules
|
|
|
|
|
|
|
|
|
|
Used to generate HTMLs help files from RST files (reStructuredText)
|
|
|
|
|
|
|
|
|
|
* *Make* - An utility for Directing compilation
|
|
|
|
|
|
|
|
|
|
Needed to compile the help
|
|
|
|
|
|
|
|
|
|
* *gettext* - GNU Internationalization utilities
|
|
|
|
|
|
|
|
|
|
Used for i18n support in the project
|
|
|
|
|
|
|
|
|
|
* *GNU FreeFont* - Freefont Serif, Sans and Mono Truetype fonts
|
|
|
|
|
|
|
|
|
|
Font family used in reports
|
|
|
|
|
|
|
|
|
|
* *CutyCapt* - Utility to capture WebKit's rendering of a web page
|
|
|
|
|
|
|
|
|
|
Required for printing
|
|
|
|
|
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
LibrePlan compilation
|
2011-06-15 10:43:40 +02:00
|
|
|
---------------------
|
|
|
|
|
|
|
|
|
|
Debian/Ubuntu
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# apt-get install git-core maven2 openjdk-6-jdk postgresql postgresql-client python-docutils make gettext ttf-freefont cutycapt
|
|
|
|
|
|
|
|
|
|
* Connect to database::
|
|
|
|
|
|
|
|
|
|
# su postgres -c psql
|
|
|
|
|
|
|
|
|
|
* Use SQL sentences::
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
CREATE DATABASE libreplandev;
|
|
|
|
|
CREATE DATABASE libreplandevtest;
|
|
|
|
|
CREATE USER libreplan WITH PASSWORD 'libreplan';
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ git clone git://libreplan.git.sourceforge.net/gitroot/libreplan/libreplan
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Compile project::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ cd libreplan/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn clean install
|
|
|
|
|
|
|
|
|
|
* Launch application::
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
$ cd libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn jetty:run
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
* Go to http://localhost:8080/libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
Fedora
|
|
|
|
|
~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# yum install git maven java-1.6.0-openjdk postgresql postgresql-server python-docutils make gettext gnu-free-fonts-compat
|
|
|
|
|
|
|
|
|
|
* Start database service::
|
|
|
|
|
|
|
|
|
|
# service postgresql initdb
|
|
|
|
|
# service postgresql start
|
|
|
|
|
|
|
|
|
|
* Connect to database::
|
|
|
|
|
|
|
|
|
|
# su postgres -c psql
|
|
|
|
|
|
|
|
|
|
* Use SQL sentences::
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
CREATE DATABASE libreplandev;
|
|
|
|
|
CREATE DATABASE libreplandevtest;
|
|
|
|
|
CREATE USER libreplan WITH PASSWORD 'libreplan';
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Set ``postgres`` user password::
|
|
|
|
|
|
|
|
|
|
ALTER USER postgres WITH PASSWORD 'postgres';
|
|
|
|
|
|
|
|
|
|
* Edit ``/var/lib/pgsql/data/pg_hba.conf`` and replace ``ident`` by ``md5``
|
|
|
|
|
|
|
|
|
|
* Reload database configuration::
|
|
|
|
|
|
|
|
|
|
# service postgresql reload
|
|
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ git clone git://libreplan.git.sourceforge.net/gitroot/libreplan/libreplan
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Compile project::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ cd libreplan/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn clean install
|
|
|
|
|
|
|
|
|
|
* Launch application::
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
$ cd libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn jetty:run
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
* Go to http://localhost:8080/libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
openSUSE
|
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# zypper install git-core java-1_6_0-openjdk-devel postgresql-server postgresql docutils make gettext-tools freefont
|
|
|
|
|
|
|
|
|
|
* Install Maven::
|
|
|
|
|
|
|
|
|
|
# cd /opt/
|
|
|
|
|
# wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz
|
|
|
|
|
# tar -xzvf apache-maven-2.2.1-bin.tar.gz
|
|
|
|
|
|
|
|
|
|
Edit ``/etc/bash.bashrc.local`` and add the following lines::
|
|
|
|
|
|
|
|
|
|
export M2_HOME=/opt/apache-maven-2.2.1
|
|
|
|
|
export M2=$M2_HOME/bin
|
|
|
|
|
export PATH=$M2:$PATH
|
|
|
|
|
|
|
|
|
|
* Start database service::
|
|
|
|
|
|
|
|
|
|
# /etc/init.d/postgresql start
|
|
|
|
|
|
|
|
|
|
* Connect to database::
|
|
|
|
|
|
|
|
|
|
# su postgres -c psql
|
|
|
|
|
|
|
|
|
|
* Use SQL sentences::
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
CREATE DATABASE libreplandev;
|
|
|
|
|
CREATE DATABASE libreplandevtest;
|
|
|
|
|
CREATE USER libreplan WITH PASSWORD 'libreplan';
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandev TO libreplan;
|
|
|
|
|
GRANT ALL PRIVILEGES ON DATABASE libreplandevtest TO libreplan;
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Set ``postgres`` user password::
|
|
|
|
|
|
|
|
|
|
ALTER USER postgres WITH PASSWORD 'postgres';
|
|
|
|
|
|
|
|
|
|
* Edit ``/var/lib/pgsql/data/pg_hba.conf`` and replace ``ident`` by ``md5``
|
|
|
|
|
|
|
|
|
|
* Restart database service::
|
|
|
|
|
|
|
|
|
|
# /etc/init.d/postgresql restart
|
|
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ git clone git://libreplan.git.sourceforge.net/gitroot/libreplan/libreplan
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Compile project::
|
|
|
|
|
|
2011-12-22 22:05:02 +01:00
|
|
|
$ cd libreplan/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn clean install
|
|
|
|
|
|
|
|
|
|
* Launch application::
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
$ cd libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn jetty:run
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
* Go to http://localhost:8080/libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
CutyCapt compilation
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
Like *CutyCapt* is not packaged for all distributions here are the instructions.
|
|
|
|
|
|
|
|
|
|
Ubuntu/Debian
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# apt-get install subversion libqt4-dev libqtwebkit-dev qt4-qmake g++ make
|
|
|
|
|
|
|
|
|
|
In Ubuntu Lucid 10.04 remove ``libqtwebkit-dev`` package.
|
|
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
|
|
|
|
$ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
|
|
|
|
|
|
|
|
|
|
* Compile::
|
|
|
|
|
|
|
|
|
|
$ cd CutyCapt
|
|
|
|
|
$ qmake CutyCapt.pro
|
|
|
|
|
$ make
|
|
|
|
|
|
|
|
|
|
* Install::
|
|
|
|
|
|
2011-06-30 08:01:20 +02:00
|
|
|
# cp CutyCapt /user/bin/cutycapt
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
Fedora
|
|
|
|
|
~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# yum install subversion qt-devel qt-webkit-devel gcc-c++ make
|
|
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
|
|
|
|
$ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
|
|
|
|
|
|
|
|
|
|
* Compile::
|
|
|
|
|
|
|
|
|
|
$ cd cutycapt/CutyCapt
|
|
|
|
|
$ qmake-qt4 CutyCapt.pro
|
|
|
|
|
$ make
|
|
|
|
|
|
|
|
|
|
* Install::
|
|
|
|
|
|
2011-06-30 08:01:20 +02:00
|
|
|
# cp CutyCapt /user/bin/cutycapt
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
openSUSE
|
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* Install requirements::
|
|
|
|
|
|
|
|
|
|
# zypper install subversion libqt4-devel libQtWebKit-devel gcc-c++ make
|
|
|
|
|
|
|
|
|
|
* Download source code::
|
|
|
|
|
|
|
|
|
|
$ svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt cutycapt
|
|
|
|
|
|
|
|
|
|
* Compile::
|
|
|
|
|
|
|
|
|
|
$ cd cutycapt/CutyCapt
|
|
|
|
|
$ qmake-qt4 CutyCapt.pro
|
|
|
|
|
$ make
|
|
|
|
|
|
|
|
|
|
* Install::
|
|
|
|
|
|
2011-06-30 08:01:20 +02:00
|
|
|
# cp CutyCapt /user/bin/cutycapt
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Compilation profiles
|
|
|
|
|
--------------------
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
There are different compilation profiles in *LibrePlan*. Check ``<profiles>``
|
2011-06-15 10:43:40 +02:00
|
|
|
section in root ``pom.xml`` to see the different profiles (there are also some
|
|
|
|
|
profiles defined in ``pom.xml`` of business and webapp modules).
|
|
|
|
|
|
|
|
|
|
* *dev* - Development environment (default)
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
It uses databases ``libreplandev`` and ``libreplandevtest``.
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* *prod* - Production environment
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
Unlike *dev* it uses database ``libreplanprod`` and `libreplanprodtest``.
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
It is needed to use it in combination with *postgresql* or *mysql* profiles.
|
|
|
|
|
|
|
|
|
|
This is usually used while testing the stable branch in the repository. This
|
|
|
|
|
allows developers to easily manage 2 different databases one for last
|
|
|
|
|
development in master branch and another for bugfixing over stable branch.
|
|
|
|
|
|
|
|
|
|
* *postgresql* - PostgreSQL database (default)
|
|
|
|
|
|
|
|
|
|
It uses PostgreSQL database server getting database names from *dev* or *prod*
|
|
|
|
|
profiles.
|
|
|
|
|
|
|
|
|
|
* *mysql* - MySQL database
|
|
|
|
|
|
|
|
|
|
It uses MySQL database server getting database names from *dev* or *prod*
|
|
|
|
|
profiles.
|
|
|
|
|
|
|
|
|
|
* *reports* - JasperReports (default)
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
If it is active *LibrePlan* reports are compiled.
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
It is useful to disable this profile to save compilation time during
|
|
|
|
|
development.
|
|
|
|
|
|
|
|
|
|
* *userguide* - User documentation (default)
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
If it is active *LibrePlan* help is compiled and HTML files are generated.
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
User documentation is written in *reStructuredText* and it is generated
|
|
|
|
|
automatically thanks to this profile.
|
|
|
|
|
|
|
|
|
|
Like for *reports*, it is useful deactivate this profile during development
|
|
|
|
|
to save compilation time.
|
|
|
|
|
|
|
|
|
|
* *liquibase-update* - Liquibase update (default)
|
|
|
|
|
|
|
|
|
|
If it is active Liquibase changes are applied in the database.
|
|
|
|
|
|
|
|
|
|
* *liquibase-updatesql* - Liquibase update SQL
|
|
|
|
|
|
|
|
|
|
If it is active it is generated a file with SQL sentences for Liquibase
|
|
|
|
|
changes needed to apply on database.
|
|
|
|
|
|
|
|
|
|
This is used to generate upgrade files in releases.
|
|
|
|
|
|
2012-03-14 17:21:23 +01:00
|
|
|
* *i18n* - Internationalization (default)
|
|
|
|
|
|
|
|
|
|
It uses gettext to process language files in order to be used in *LibrePlan*.
|
|
|
|
|
|
|
|
|
|
Like for *reports* and *userguide*, it is useful deactivate this profile
|
|
|
|
|
during development to save compilation time.
|
|
|
|
|
|
2011-06-15 10:43:40 +02:00
|
|
|
How to use profiles
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Profiles active by default are used always if not deactivated. In order to
|
|
|
|
|
activate or deactivate a profile you should use parameter ``-P`` for Maven
|
|
|
|
|
command. For example:
|
|
|
|
|
|
2012-03-14 17:21:23 +01:00
|
|
|
* Deactivate *reports*, *userguide* and *i18n* to save compilation time::
|
2011-06-15 10:43:40 +02:00
|
|
|
|
2012-03-14 17:21:23 +01:00
|
|
|
mvn -P-reports,-userguide,-i18n clean install
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Use production environment::
|
|
|
|
|
|
|
|
|
|
mvn -Pprod,postgresql clean install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
-----
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
*LibrePlan* has a lot of JUnit test that by default are passed when you compile
|
2011-06-15 10:43:40 +02:00
|
|
|
the project with Maven. You can use ``-DskipTests`` to avoid tests are passed
|
|
|
|
|
always. Anyway, you should check that tests are not broken before sending or
|
|
|
|
|
pushing a patch.
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
mvn -DskipTests clean install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MySQL
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
|
For MySQL users here are specific instructions.
|
|
|
|
|
|
|
|
|
|
* SQL sentences to create database::
|
|
|
|
|
|
2011-11-25 10:40:34 +01:00
|
|
|
CREATE DATABASE libreplandev;
|
|
|
|
|
CREATE DATABASE libreplandevtest;
|
|
|
|
|
GRANT ALL ON libreplandev.* to 'libreplan'@'localhost' identified by 'libreplan';
|
|
|
|
|
GRANT ALL ON libreplandevtest.* to 'libreplan'@'localhost' identified by 'libreplan';
|
2011-06-15 10:43:40 +02:00
|
|
|
|
|
|
|
|
* Compile project::
|
|
|
|
|
|
|
|
|
|
$ mvn -Pdev,mysql clean install
|
|
|
|
|
|
|
|
|
|
* Launch application::
|
|
|
|
|
|
2011-10-28 08:17:54 +02:00
|
|
|
$ cd libreplan-webapp/
|
2011-06-15 10:43:40 +02:00
|
|
|
$ mvn -Pdev,mysql jetty:run
|