Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Acceleo and Android

Acceleo and Android

Acceleo code generation, from the model to an Android application. Thanks to the use of Eclipse modeling, you will see how we can use a domain specific model to generate an Android application.

Stéphane Bégaudeau

April 05, 2011
Tweet

More Decks by Stéphane Bégaudeau

Other Decks in Programming

Transcript

  1. Goals of the tutorial Beginners See a simple concrete case

    study Acceleo addicts Discover new killing features Android experts Learn enough to build a full fledged generator
  2. I 'm I 'm not not an Android an Android

    development expert development expert
  3. A long history... A long history... Version 3.0 is part

    of the Eclipse Helios release train From Acceleo.org in 2006... ...to Eclipse.org in 2009
  4. 8 Metamodel and templates based technology Implementation of the Model

    To Text OMG standard (MTL) Eclipse Modeling / M2T Project Tooling to help starting a new generator from scratch A new code generation language
  5. 9 Acceleo Runtime (Compiler + Engine) Acceleo Development Tools +

    = Eclipse independant: can be run anywhere (plain old Jar, OSGi, Eclipse...) The Acceleo SDK
  6. 12 Unlock the power of your models Java UI Java

    DB XML Properties Different kinds of source artifacts to be generated
  7. 13 One kind of file to be generated... ...one MTL

    file to be created Good Practice
  8. 17 A little bit of syntax Queries can return any

    kind of objects Templates are better for generating text and return a string You can call Java services from a template or a query The result of a query is stored in a cache.
  9. 19 Initialize the generation project 1. Create new Acceleo project

    2. Use the wizard (update file paths) 3. Create a workflow file
  10. 20 3... 2... 1... Launch configuration Anything that can launch

    Java... Generated Java Main Stand alone Same VM as Eclipse Standalone Standalone
  11. 24 Hierarchy Tree Select a text section in the template,

    then right-click "Source > As For/If"
  12. 27 Extract as template Select a text section in the

    template, then right click "Refactor > Extract as template"
  13. Launch the generator - open the Result view - launch

    config as Eclipse plugin - activate the Traceability Have a look at the Result view
  14. 32 Configure the Android Development Kit Create a new Android

    Virtual Device - AVD Set the path to the SDK location
  15. 38 Packaging and deploying Generate an Eclipse UI plugin Add

    an action on right-click on models Create a builder Synchronize your code and your model
  16. 39 Packaging settings Filename pattern of the model Target folder

    of the generation Warning Eclipse specific
  17. 40 Workout 1. Create new Acceleo UI project 2. Use

    the wizard 3. Launch a 2n d Eclipse Runtime and test
  18. 43 Module B Template MT Module A Template MT Extends

    overrides Module C Imports C invokes MT, B.MT will be executed Overriding behavior
  19. 44 A common problem with code generators... if you change

    the generated code... your modifications are lost during the next generation. Lost code
  20. 45 © Copyright 2010 Obeo Protected area Will not be

    erased after re-generation Dont forget the comments marks... ... and the ID