Setup of Development Environment for Windows: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
(Remove restart for git)
Line 60: Line 60:


== Bazaar ==
== Bazaar ==
Please follow the instructions at [[How to work with bazaar through the GUI on Windows]] to download Bazaar and to get the latest version of the code.
Please follow the instructions at [[How to work with bazaar on the command line]] or [[How to work with bazaar through the GUI on Windows]] to download Bazaar and to get the latest version of the code.


== Uncrustify ==
== Uncrustify ==

Revision as of 10:06, 3 Ocak 2011

Overview

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!

If you already have some or all of the software installed that is listed here, please make sure it is the same version that we specify before skipping the relevant section on this page!


Development Hardware Needed

Any PC that you would otherwise use for serious software development should suffice.

  • As a rough guide, a PC with a processor speed of more than 2GHz and at least 1 GB of RAM should be OK.
    • If your PC is below that specification, development will probably be possible, but rather slow and cumbersome.
    • On the other hand: Timotheus works with a Acer One Netbook, N280 CPU 1.6 Ghz, 2 GB RAM; speed is fine.
  • More than 2GB of RAM is not necessary if the only applications that you run simultaneously are the ones which are used for developing openPETRA.
  • The faster the processor, the better.
    • When compiling, it all comes down to processor speed, number of cores of the processor, and the architecture of the processor.
      • We have seen quite a boost in compilation speed with the new "i" series of Intel processors.
  • A multi-processor PC has its advantages.
    • The SharpDevelop IDE can do parallel compilations of Projects that aren't interdependent - that can speed up compilation notably (we saw an average of 20%-40% speed gain when comparing compilation of all the Client Projects on two processor cores compared to compiling on one processor core). We have verified this to scale very well on up to four processors (we don't have PC's with more processors than that...).
    • NAnt (our build system) can do parallel compilations of Projects that aren't interdependent - that can speed up compilation notably. We have verified this to scale very well on up to four processors (we don't have PC's with more processors than that...).
  • A 64-bit Operating System (e.g. Windows 7 64-bit) has no advantages for the purposes of developing openPETRA.

Time required for setting up an openPETRA development environment

Depending on the speed of your PC, and of course the speed of your Internet connection and the speed of the respective download servers, the setting of up of a development environment for openPETRA on Windows can take something between 40-80 minutes.

Required software

Microsoft .NET 3.5

Download and install the two Microsoft .NET dependencies. They allow execution of and development for .NET applications (such as openPETRA).

Microsoft recommends to run 'Windows Update' before installing those two dependencies. It might also be a good idea to run 'Windows Update' after installing those two dependencies to check whether any updates or security patches are available.

Note: Both the Redistributable and the SDK are needed! (We currently only use .NET 2.0 for openPETRA, but the SharpDevelop IDE requires .NET 3.5 SP1 Redistributable and SDK)


SharpDevelop 3

SharpDevelop is the IDE (Integrated Development Environment) we use for developing openPETRA.


PuTTY / Plink

PuTTY is a SSH and telnet client for the Windows platform. Plink is a command-line interface to the PuTTY back ends, which is used by Git and TortoiseGit (see below).

PuTTY and Plink are needed for 'developer access' only, i.e. if you intend to feed your changes back to the openPETRA Git source code repository at some point. They are not needed for 'anonymous access'.


Free download: PuTTY Download Page

  • In the section 'Binaries', choose the installer under the heading 'A Windows installer for everything except PuTTYtel', e.g. putty-0.60-installer.exe
  • Run the installer and remember the path where you install PuTTY into - you need to specify the path during the installation of Git and TortoiseGit (the installers need to be pointed to the file 'plink.exe' in that directory when they ask for it).


Bazaar

Please follow the instructions at How to work with bazaar on the command line or How to work with bazaar through the GUI on Windows to download Bazaar and to get the latest version of the code.

Uncrustify

We use Uncrustify to automatically format the code so that it looks more the same.

Download the zip file from http://sourceforge.net/projects/uncrustify/ and unzip it to your Program Files directory. Just make sure your OpenPetra.build.config (see below) has the correct path.

for example:

<property name="Uncrustify.exe" value="${sys.env.ProgramFiles}/Uncrustify/uncrustify.exe"/>

Speaking of formatting code, please have a look at Coding Standard and Guidelines too.

NAnt

NAnt is our build system. It is used for ongoing compilation, for creation of Builds/Releases of openPETRA, and for the automation of quite a few tasks in the development lifecycle of openPETRA - including auto-generation of source code and Forms.

  • download NAnt 0.91-alpha2
    • please use this version as it works for us. Some of the released alpha or beta versions do not work (Example: 0.86-beta1; it breaks with message: Property 'sdkInstallRoot' has not been set.)
  • unzip the files to e.g. c:\program files\nant
  • open a Text Editor (e.g. Notepad, Notepad++) and create a new file with the file name c:\windows\nant.bat. It needs to have the following content:
@echo off
"C:\Program Files\NAnt\bin\NAnt.exe" %* -t:net-2.0

See also our Notes about NAnt.


Some people get this error, later when building OpenPetra:

Solution format of file '...\Common.sln' is not supported.

It seems, their NAnt is not able to understand the solution file, because it uses a format that is too new. The solution is to use NAntContrib, which uses msbuild for building the solutions.

  1. Download the latest nightly binary version of NAntContrib: http://nantcontrib.sourceforge.net/nightly/latest/nantcontrib-bin.zip
  2. According to the instructions in the Readme file of NAntContrib, copy the files from the bin directory in the zip file to your NAnt directory, to subdirectories <nant>\bin\extensions\common\neutral\NAntContrib\ and <nant>\lib\common\neutral\NAntContrib\
  3. when running nant compileCommon, nant should use the msbuild task.


Another posible error while trying to compile with nant is the following:

generateFrameworkPath
the path for the .NET Framework could not be found

A solution for this is editing the registry. On the indicated key (f.e. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework) create a new entry. Name it as indicated by the error message (f.e. SDKInstallRootv2.0). Its value will be the same as the value of "InstallRoot" (f.e. E:\WINDOWS\Microsoft.NET\Framework\)


There is a problem with .Net 4.0:

Unhandled Exception: System.TypeInitializationException:
  The type initializer for 'NAnt.Console.ConsoleStub' threw an exception.
  System.Security.SecurityException: Request for the permission of type
  'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0'

see the article http://keithbloom.wordpress.com/2010/09/21/nant-and-the-net-4-error/ with the solution: Remove <supportedRuntime version="v4.0.30319" /> from %InstallLocation%\NAnt\bin\NAnt.exe.config

Database systems

openPETRA works with a number of Database Management systems.

  • Choose one (or more) of the following Database Management systems. (If you want to start development quickly, SQLite is sufficient, so there is no immediate need to install PostgreSQL or MySQL. PostgreSQL is recommended for serious development, however).

If you want to switch from SQLite to PostgreSQL which we recommend for serious development, please follow the instructions at Setup_of_Development_environment#Use_another_database_system.

Optional Software

  • For the editing of YAML files (which we use for defining the layout of screens, the main menu entries, and code hierarchy) we use Notepad++, which has syntax highlighting support for YAML files.
    • Download Notepad++
    • Once the software is installed, it needs to be set up once to accept our file extension, '.yaml', in addition to the one is built in, '.yml' for the syntax highlighting to work:
      • Menu 'Settings' -> 'Style Configurator'. Select 'YAML' in the 'Language' list and enter 'yaml' in the 'User ext.' field. Choose 'Save & Close'. (You might need to close and re-open any .yaml file that you already have open to get the syntax highlighting working.)
  • The following pieces of software are only required when you want to build releases of OpenPetra:


Downloading of source code and configuring the build environment

Get the source code

The source code is managed with the Bazaar source code versioning system.

You should have got the source code already if you followed the instructions at How to work with bazaar on the command line or How to work with bazaar through the GUI on Windows.

Please understand that we will provide write permissions only to the core members of the development team, just to keep the project on one track (refereed to as 'developer access' below). We very much need your contributions though, and we will aim to quickly deal with submitted patches and code. Please see our document on submitting patches and features!

Creating the OpenPetra.build.config file

  • Make a copy of the file OpenPetra.build-sample-windows.config in the root of your OpenPetra source code directory and call it OpenPetra.build.config. You can do this in Windows Explorer.

Please check your OpenPetra.build.config file and make sure the paths are all adjusted to your system and the version numbers in the paths are correct. Important: you need to change the value of the property OpenPetraRoot.dir so that it points to the correct directory where you have stored your OpenPetra source code.

Finally: Building openPETRA with NAnt

After completing all the steps that are involved in the setup of your development environment for openPETRA, 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.

Please go to OpenPetra NAnt script for finishing your openPETRA development setup.

If you want to switch from SQLite to PostgreSQL which we recommend for serious development, please follow the instructions at Setup_of_Development_environment#Use_another_database_system.