Skip to content
  Kermeta  

Kermeta Java-EMF Compiling Issues

Document Actions
This article gives the guidelines in order to install and try the compiler of Kermeta: kmt to Java-EMF plugins

Introduction

The Kermeta compiler consists on a transformation from a kmt file to an Ecore file (step 1), finally the generation a plugin with the Java by using the EMF facilities (step 2).

The resulting Java may be used both in Eclipse Application or in Java Application (standalone) and is fully compatible with EMF. A listing of dependencies is available below.

The compiling process generates a set of files: *.km, *.traceability, *.ecore, *.simk, *.genmodel.

A configuration file may be added: *.compiler.properties (more info. below).

The 2nd step may be replayed by a right-click on the generated Ecore file.

Installation in "end-user mode"

Since Kermeta 1.3.0, the compiler is provided both in the Kermeta update site and in the bundle, go to the Download section.

Installation and materials in development mode

  1. Download the bundle Kermeta 1.3.2 and unzip it
  2. Create a workspace
  3. Download the psfFile (pserver - extssh) dedicated to the main Eclipse and import it in your workspace => all the required plugins will be downloaded from the GForge INRIA CVS
  4. Read the readme.txt in the plugin org.antlr.antlr2 and do the recommandations
  5. Create an Eclipse Application Run Configuration: "Run Configurations > Eclipse Application > double click to create a new one"
    1. Fill the name of the configuration
    2. Set the VM arguments in section "Arguments"
      1. -Xmx512m
        -Xss1024k
        -XX:PermSize=512m
        -XX:MaxPermSize=512m
        -XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
    3. Run (at the right button)
  6. A new instance of Eclipse is launched
  7. Your environement is right for testing the Kermeta Compiler !

First try

  1. right click on a kmt file: "Compile Kmt to EMF plugin (Experimental)"
  2. An Eclipse plugin will be generated, after that you can try to run one generated main contained in the src-runner Java source folder.

Customizing the plugin generation

You are able to add a "properties file" for customizing the plugin generation.

To do it: an UI Action can be performed on the kmt file: right-click > Kermeta advanced > Generate the properties file [..]

This file must be in the same folder than the main kmt file and respect the naming rule: {kmt_file_name_without_the_kmt_extension}.compiler.properties

This configuration file will be taking into account, when you are compiling from a kmt file or the generated ecore file, for this last case you are able to re-generate the plugin without redo kmt2{ecore, simk}

The available properties are listed below, every property is optional (the values are String without quote):

  • plugin_id = {name and id of the generated plugin}
  • copyright_header = {header include in each file}
  • require_bundles = {plugin dependencies if your program depends on external plugins} | String separated by comma
  • bundle_version = {version number of your plugin like 0.1.0 instead of the default 1.0.0}
  • main_operations = {operation qualifiedNames} | String separated by comma, e.g.: mypackage::MyClass::myMainOperation, mypackage::MyClass::myMainOperation2
  • runner_src_dir = {by default src-runner} | a String without space
  • unzip_externs = {zip file containing the externs required to the compiled source code} | String separated by comma, the String is composed of 2 parts separated by a ";", the first part is the location of the zip file, the second one is the folder in the generated plugin, ex.: platform:/resource/MyProject/util/externs.zip;src-extern, if the choosen folder is not in a declared Java Source Folder then you should change its nature by right-click on this folder Build Path > Use as Source Folder.
  • enable_emf_load_initialization = {enable EMF-reflection load initialization for large model} | String equals to true or false

Creating a standalone version of your compiled code, required libs

<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.emf.common_2.4.0.v200808251517.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.emf.ecore.xmi_2.4.1.v200808251517.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.emf.ecore_2.4.1.v200808251517.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.core.resources_3.4.0.v20080604-1400.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.emf.codegen_2.4.0.v200808251517.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.emf.ecoretools.registration_1.0.0.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.equinox.registry_3.4.0.v20080516-0950.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/fr.irisa.triskell.eclipse.util_1.2.0.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.equinox.common_3.4.0.v20080421-2006.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.core.jobs_3.4.0.v20080512.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/fr.irisa.triskell.kermeta.model_1.2.0.jar"/>
<classpathentry kind="lib" path="C:/eclipse-ganymede/eclipse/plugins/org.eclipse.osgi_3.4.0.v20080605-1900.jar"/>

Note: this listing definition is in progress.

Current limitations of the compiler

  • recursive function types
  • super of function type
  • function like variable
  • model typing
  • succession of lambda expressions using self as Target
  • calling function types from subtype: switch (dynamic linking)
  • more information (require registration on this website)

Samples status are available on the Triskell wiki (restricted access) at: http://triskell.wiki.irisa.fr/tiki-index.php?page=KCTS and all the corresponding bugs are on the forge.

Created by cfaucher
Last modified 24.11.2009 11:33 AM