Introduction

This document describes how you can use scripts to generate code from a Rose model. The script can be either a regular shell script that invokes Eclipse headless applications or an Ant script that invokes the task provided by this plugin.

Overall Comments

Rose and Generator Applications

The application provided by this plugin generates the ecore and genmodel files from models defined using Rose.

Rose application details
IDorg.eclipse.emf.importer.rose.Rose2GenModel
Classorg.eclipse.emf.importer.rose.RoseImporterApplication

To generate the actual Java code you will need to use a second application, provided by the "org.eclipse.emf.codegen.ecore" plugin.

Generator application details
IDorg.eclipse.emf.codegen.ecore.Generator
Classorg.eclipse.emf.codegen.ecore.Generator

In order to run these or any other Eclipse application, you need to execute the following command (without the line breaks):

java
  -classpath <eclipseDir>/startup.jar org.eclipse.core.launcher.Main
  -data <full path to a workspace - ideally an empty directory>
  -application <application ID>
  <application arguments>

The directory "examples/library/build" has shell scripts that generate the code for the model provided. If you have any questions after reading and experimenting with it, look at the applications's javadoc for more details. Also, check the application's class "getUsage()" method for the list of possible arguments.

Rose Ant Task

The Rose task details are:

Nameemf.Rose2Java
Classorg.eclipse.emf.importer.rose.taskdefs.RoseGeneratorTask

This is the usual command line to run an Ant script using a headless Eclipse instance (remove the line breaks):

java
  -classpath <eclipseDir>/startup.jar org.eclipse.core.launcher.Main
  -data <full path to a workspace - ideally an empty directory>
  -application org.eclipse.ant.core.antRunner
  -buildfile <full path to your script>

The directory "examples/library/build" has an Ant script that generate the code for the model provided. The task's javadoc has lots of information you may find useful.