eMoflon / emoflon-ibex

Shared, eMoflon-specific component for incremental unidirectional and bidirectional graph transformations
GNU General Public License v3.0
12 stars 4 forks source link

Code generation for graph transformation on metamodels with basePackage #387

Closed FabianMarcoBauer closed 5 years ago

FabianMarcoBauer commented 5 years ago

When creating metamodels it is possible to define a basePackage, in which the generated model code will be located. When creating graph constraints for a metamodel with a base package, the imports in the generated code will ignore the base package and point to the wrong location.

Example (see handbook for metamodeling under "Can I have dots in an EPackage name (e.g. org.moflon.example.sokoban)?"):

  1. Change the genmodel and namespace annotations at the top of SokobanLanguage.emf to
    @GenModel(documentation="Meta-model for Sokoban", 
          basePackage="org.moflon.example.sokobanLanguage")
    @namespace(uri="platform:/plugin/SokobanLanguage/model/SokobanLanguage.ecore", 
    prefix="org.moflon.example.sokobanLanguage")
  2. remove the old generated code
  3. regenerate the model code
  4. Adjust the MANIFEST.MF to export the packages org.moflon.example.sokobanLanguage.SokobanLanguage.impl, org.moflon.example.sokobanLanguage.SokobanLanguage.util and org.moflon.example.sokobanLanguage.SokobanLanguage .
  5. Clean and rebuild the SokobanRules project.
  6. The imports in the generated code will point to SokobanLanguage.SokobanLanguagePackage, SokobanLanguage.Figure, ... instead of org.moflon.example.sokobanLanguage.SokobanLanguage.SokobanLanguagePackage, org.moflon.example.sokobanLanguage.SokobanLanguage.Figure, ...
anthonyanjorin commented 5 years ago

Adjusting the generated imports is possible using our moflon.properties file. Please refer to Q4 in the appendix of the handbook on unidirectional model transformation.

Note, however, that we do not support every option in the GenModel. There are just way too many.

Please try it out and close this issue if that fixes the problem.

FabianMarcoBauer commented 5 years ago

Setting the import mapping in the moflon.properties file solved this issue. Than you very much.