Kermeta Java-EMF Compiling Issues
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
- Download the bundle Kermeta 1.3.2 and unzip it
- Create a workspace
- 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
- Read the readme.txt in the plugin org.antlr.antlr2 and do the recommandations
- Create an Eclipse Application Run Configuration: "Run Configurations > Eclipse Application > double click to create a new one"
- Fill the name of the configuration
- Set the VM arguments in section "Arguments"
- -Xmx512m
-Xss1024k
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith - Run (at the right button)
- A new instance of Eclipse is launched
- Your environement is right for testing the Kermeta Compiler !
First try
- right click on a kmt file: "Compile Kmt to EMF plugin (Experimental)"
- 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
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.