Setup of Development environment: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
No edit summary
Line 28: Line 28:
After completing all the steps that are involved in the setup of your development environment on the operating system of your choice, you are ready for the compiling and starting of openPETRA!
After completing all the steps that are involved in the setup of your development environment on the operating system of your choice, you are ready for the compiling and starting of openPETRA!


We have a central NAnt script that is able to build openPETRA, to generate a lot of code and is able to do all automated tasks in the openPETRA project.
Our NAnt files are split up in several pieces. A small NAnt file is located in most directories. It will include a central NAnt file according to what is needed. The central NAnt files are located in ''inc/nant''. Most targets are available in all directories of our code base.
 


=== get help ===
=== get help ===
To see the available commands, just run the following two commands on the command line:
To see the available commands, just go to the root directory of the checked out openPetra and run the command line:
cd openpetraorg\trunk
  nant help
  nant help
or
nant -projecthelp
Be aware, that nant -projecthelp only shows the help information of targets, which are directly defined in the build file, but not in the imported buildfile!


=== initial steps ===
=== initial steps ===
First you need to compile the PetraTools which is a set of programs for creating databases and more:
First you should build openPetra and generate the project and solution files. This is done by following command:
  nant compileCommon
  nant generateSolution
nant compilePetraTools


Now you need to create a database. If you don't change the config file, the SQLite database system will be used.
Now you need to create a database. If you do not add a nant file called ''OpenPetra.build.config'' with the config file with a property names ''DBMS.Type'', the SQLite database system will be used.
  nant recreateDatabase
  nant recreateDatabase


Then you want to load the database with base data:
Then you want to load the database with base data:
  nant resetDatabase
  nant resetDatabase
You should compile OpenPetra.org this way:
nant compilePetra


Start the OpenPetra.org Server:
Start the OpenPetra.org Server:
Line 64: Line 62:


=== further steps ===
=== further steps ===
==== creating a new project file into an existing solution ====
To create a new project, there is the NAnt task addProject:
nant addProject -D:solution=Testing.sln -D:path=Testing\CodeGeneration -D:namespace=Tests.CodeGeneration
nant addProject -D:solution=Client.sln -D:namespace=Ict.Petra.Client.MFinance.Gui.Test -D:path=Petra\Client\lib\MFinance\Gui
This will create the project file and AssemblyInfo in the given path, the file name is calculated from the namespace. The project will be added to the solution. Most references to dlls are included already. Don't forget to add the new project file and the AssemblyInfo to Bazaar.


At the moment, this only works for NUnit tests (Testing.sln), Client.sln and Server.sln. Shared.sln and the ClientPlugins.sln and ServerPlugins.sln should be supported soon as well.
==== Targets in source directories ====
 
'''clean''': Remove generated files and output files
 
'''uncrustify''' or '''indent''': re-formats the source files in the directory according to programming guidelines
 
'''depend''': find out dependencies in sub-project and generates nant files in the source directories
 
'''compile''': Compiles the source files in this directory
 
'''generateCsproject''': Generate the project file for this directory
 
 
==== Creating a new source sub-directory ====


You must not investigate some work into the file layout because before each commit you have to run
Just add the directory and put the source files into it. Run
nant uncrustifyPetraShared
  nant generateSolution
will regenerate the project files and add it to the solution

Revision as of 14:44, 28 February 2011

Overview and Introduction

All the development tools we use are open source themselves, so developers do not need to spend money to be able to partly or fully join the openPETRA development!

The openPETRA developers in OM work on Windows, but all the tools (including the DB systems) are available on various operating systems (supported on Windows, on a number of Linux distributions and on MacOS), with the exception of the IDE (Integrated Development Environment). A very powerful open source IDE, SharpDevelop, is available only for Windows and this is the IDE we use at OM. Another open source IDE, MonoDevelop, is cross-platform and possibly not that powerful (yet). The openPETRA developers in OM haven't tried using MonoDevelop, but it should work, at least as the C# code editor. We do have a fully-fledged build system which is based on NAnt (similar to Ant, but for .NET and not Java), which is cross-platform and that is what we mostly use for compiling anyways.


Setup by Operating System

Please follow the Link for the operating system of your choice. You are more than welcome to add your own instructions here if the OS of your choice isn't listed here yet and you have found out how to set the development tools up on this OS!

Use another database system

By default, the development environment is set up using SQLite as the default database. This is the easiest way to get a quick start. For serious development of OpenPetra, it makes more sense to use either PostgreSQL or MySQL, because eg. they enforce the constraints and therefore coding errors come to light much quicker.

To switch to another database systems, please follow these steps:

  • Change your OpenPetra.build.config file, change the value of DBMS.Type. Please enter the password of your database admin user in DBMS.Password.
  • run nant recreateDatabase und nant resetDatabase which will create the database and load the base and demo data.
  • delete the file openpetraorg/etc/Server.config, and run nant startPetraServer, which should copy the right config file

NAnt script

After completing all the steps that are involved in the setup of your development environment on the operating system of your choice, you are ready for the compiling and starting of openPETRA!

Our NAnt files are split up in several pieces. A small NAnt file is located in most directories. It will include a central NAnt file according to what is needed. The central NAnt files are located in inc/nant. Most targets are available in all directories of our code base.

get help

To see the available commands, just go to the root directory of the checked out openPetra and run the command line:

nant help

or

nant -projecthelp

Be aware, that nant -projecthelp only shows the help information of targets, which are directly defined in the build file, but not in the imported buildfile!

initial steps

First you should build openPetra and generate the project and solution files. This is done by following command:

nant generateSolution

Now you need to create a database. If you do not add a nant file called OpenPetra.build.config with the config file with a property names DBMS.Type, the SQLite database system will be used.

nant recreateDatabase

Then you want to load the database with base data:

nant resetDatabase

Start the OpenPetra.org Server:

nant startPetraServer

Start the OpenPetra.org client:

nant startPetraClient

With the base database, there is the user demo with password demo that you can use to login to your installation of OpenPetra.org. The user sysadmin with password CHANGEME (capital letters!!) will allow you to create more users, backup the database, etc.

See Basic Tutorial for information what is actually working already.

Stop the OpenPetra.org Server:

nant stopPetraServer

further steps

Targets in source directories

clean: Remove generated files and output files

uncrustify or indent: re-formats the source files in the directory according to programming guidelines

depend: find out dependencies in sub-project and generates nant files in the source directories

compile: Compiles the source files in this directory

generateCsproject: Generate the project file for this directory


Creating a new source sub-directory

Just add the directory and put the source files into it. Run

 nant generateSolution 

will regenerate the project files and add it to the solution