Texo/Developing

From Eclipsepedia

< Texo
Revision as of 16:04, 1 April 2012 by Mtaal.elver.org (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

This page outlines how to setup a development environment to develop in Texo.

GIT

The Texo project uses git. Texo core is at git on eclipse.org, the example projects are hosted on github here.

To clone the eclipse.org git repository use this command:

  • committers:

git clone ssh://committer_id@git.eclipse.org/gitroot/texo/org.eclipse.emf.texo.git

  • non-committers:

git clone http://git.eclipse.org/gitroot/texo/org.eclipse.emf.texo.git

You can browse the Texo git repository: org.eclipse.emf.texo.git (browse, stats, fork on OrionHub)


Within the git repository you will find the projects structured as follows:

  • features: contains the feature projects
  • infra: contains both developer setup as well as the build setup projects
  • core: contains the core plugins used both when generating code, at runtime and during testing
  • runtime: the plugins for running texo on the server (in combination with the core plugins)
  • tests: the plugins used for testing

For more information on git and eclipse see these pages:

Texo moved to Git in November 2011, the previous cvs repository is not available anymore. See here for the archived cvs repository.

Commit Mailing List

To subscribe to the commit mailing list visit this page: https://dev.eclipse.org/mailman/listinfo/texo-commit.

Setup Development environment

Texo has the following dependencies:

  • Eclipse 3.6 or 3.7
  • EMF 2.6 or 2.7
  • XPand

Eclipse can be downloaded from here.

EMF is possibly already present as part of the Eclipse install.

XPAND and EMF can be installed through the update manager (type the names mwe, xpand etc. in the search box):

To get all the development projects clone the git repository as outlined above and import all the projects in the repository.

As a next step import the clean up and formatter profiles. These can be found in the Texo Develop project.

  • Goto Window > Preferences
  • To Java > Code Style > Formatter and click import, find the texo_formatter.xml in the Texo Develop project on your file system and import it
  • To Java > Code Style > Clean Up and click import, find the texo_cleanup.xml in the Texo Develop project on your file system and import it

Testing

This is by far the most important must-do. Code and functionality must be supported with Junit test cases. Each plugin should have an equivalent *.test plugin which contains testcases which test the functionality.

Although many developers like testng, Texo uses Junit because it is slightly better supported by Eclipse and Eclipse build environments.

Texo currently does not use code coverage tools. There is however the wish to add this in the future.

JDK 1.5

Texo should be compiled for the JDK 1.5 platform. This is normally setup correctly in each plugin.

Code Formatting

The plugin projects have been set up to format the code using the Texo profile when saving a file. The Texo profiles can be found in the develop project.

Copyright

All files should start with a copy right section like this:

/**
 * <copyright>
 *
 * Copyright (c) 2011 Springsite BV (The Netherlands) and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Martin Taal - Initial API and implementation
 *
 * </copyright>
 *
 * $Id: AbstractModelFeatureMapEntry.java,v 1.2 2010/01/30 15:59:35 mtaal Exp $
 */

(copyright holder and contributors ofcourse set to the one creating/adapting the file)

Javadoc, Documentation

Javadoc:

  • All public and protected methods must have javadoc, except for getters and setters which do not do more than just set/get a value.
  • There must be javadoc in the class header.

The following guidelines should be followed when documenting code:

  • comment special cases in the code or special conditions/invariants
  • rather use clear and describing variable and method names than comments
  • always add comments to empty catch blocks
  • use common sense

Formatting and compiling settings

Each plugin project has to use the same settings for formatting as in the org.eclipse.emf.texo project. Specifically in the project properties:

  • Java Code Style > Clean Up: 'Enable project specific settings' has to be checked and use the Texo profile (which can be found in the Texo Develop project).
  • Java Code Style > Formatter: 'Enable project specific settings' has to be checked and use the Texo profile (which can be found in the Texo Develop project).
  • Java Compiler: 'Enable project specific settings' has to be checked and use the J2SE-1.5 as specified in the plugin (see below)
  • Java Editor > Save Action: 'Enable project specific settings' has to be checked and has to be set in the same way as in the org.eclipse.emf.texo project
  • Plug-in Development > Plug-in Manifest Compiler: has to be set in the same was as in the org.eclipse.emf.texo project

Plugin and Feature setup

See also this description for standards for Features and Plugins of the Modeling project and these guidelines from the Common-Build-Infrastructure.

A summary:

When creating a new plugin/feature for Texo then the same structure has to be followed as is visible in the org.eclipse.emf.texo plugin and feature. The following files should be present in the root:

  • about.html
  • copyright.txt
  • epl-v10.html
  • license.html
  • plugin.properties with pluginName and providerName externalized

A feature project has the following additional files:

  • about.ini
  • about.properties
  • modeling32.png

The version of the plugin and feature have to end with .qualifier (for example 0.1.0.qualifier).

The build.properties should include all these files in the build.

All plugins should use the J2SE-1.5 execution environment.

All the above files can be copied from the org.eclipse.emf.texo plugin/feature project.

Eclipse Components and Projects used by Texo

  • EMF Ecore: for runtime model support
  • EMF XMI/XML: for XML Serialization
  • Xpand/Xtend: for code generation
  • JMerge (part of EMF): for merging generated code with manually changed code
  • JDT: for postprocessing of generated classes (organize imports)

The build environment has been setup using Buckminster and Hudson.

Interesting links

Here are links related to coding practices: