Setup of Development Environment for Windows: Difference between revisions
(Putty is not needed anymore) |
No edit summary |
||
Line 18: | Line 18: | ||
** 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...). | ** 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. | * A 64-bit Operating System (e.g. Windows 7 64-bit) has no advantages for the purposes of developing openPETRA. | ||
* Disk space needed: at least 1 GB | |||
** about 300 MB of this will be needed for the source code and compiled binaries of openPETRA; | |||
** about 200 MB will be needed for development environment software tools; | |||
** roughly 500 MB [+/- 300 MB…] will be needed for the .NET 3.5 SP 1 Redistributable and the corresponding SDK). | |||
== Time required for setting up an openPETRA development environment == | == Time required for setting up an openPETRA development environment == |
Revision as of 15:25, 6 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.
- When compiling, it all comes down to processor speed, number of cores of the processor, and the architecture of the processor.
- 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.
- Disk space needed: at least 1 GB
- about 300 MB of this will be needed for the source code and compiled binaries of openPETRA;
- about 200 MB will be needed for development environment software tools;
- roughly 500 MB [+/- 300 MB…] will be needed for the .NET 3.5 SP 1 Redistributable and the corresponding SDK).
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).
- Free downloads from Microsoft
- Microsoft .NET 3.5 SP1 Redistributable
- http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en
- Follow the 'Instructions' section on that web page and read the 'Important' section.
- This is not needed (and will indeed not work!) if you are installing on Windows 7, because the .NET Redistributable is already pre-installed (or even the Microsoft .NET 4 Redistributable, which will also work).
- http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en
- Windows Software Development Kit (SDK), .NET 3.5 SP1
- http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505
- There is no need to install all the components that are available - many involve huge further downloads! Only ".NET Development Tools" and "Debugging Tools for Windows" are needed for developing openPETRA.
- Microsoft .NET 3.5 SP1 Redistributable
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.
- Free download: http://www.icsharpcode.net/OpenSource/SD/Download/
- We currently use the latest SharpDevelop 3.2 build (Build 5777). (We don't recommend using the Beta version of SharpDevelop 4!)
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.
- Download the latest nightly binary version of NAntContrib: http://nantcontrib.sourceforge.net/nightly/latest/nantcontrib-bin.zip
- 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\
- 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).
- SQLite: no installation effort at all is required! See Notes about SQLite
- PostgreSQL (recommended). See Notes about PostgreSQL
- get the latest version from http://www.postgresql.org/download/windows. The one click installer works fine for me.
- You need to add a Postgresql user/role in pgAdmin with your windows username. Give permissions to create roles and databases to that user.
- MySQL. See Notes about MySQL
- get the latest Windows version from http://dev.mysql.com/downloads/mysql/. It is called MySQL Community Server. The MSI essential package works fine for me.
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:
- Poedit (for translation, generating the .mo file from the .po file): http://www.poedit.net/download.php (alternative: direct .mo file download from launchpad)
- Inno Setup 5 for building setup files: http://www.jrsoftware.org/isdl.php
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.