Project Generator

Table of Contents

logo-large

Tutorial Actifsource Tutorial – Project Generator
Required Time - 30 Minutes
Prerequisites - Actifsource Tutorial – Installing Actifsource
- Actifsource Tutorial – Simple Service
Goal - Generate Eclipse Projects using actifsource
Topics covered - Create a project to generate eclipse projects
- Generate the project settings
- Create and distribute non-generated files
- Generate .projectconfig files to enable project creation
Notation ↪ To do
ⓘ Information
Bold: Terms from actifsource or other technologies and tools
Bold underlined: actifsource Resources
Monospaced: User input
Italics: Important terms in current situation
Disclaimer The authors do not accept any liability arising out of the application or use of any information or equipment described herein. The information contained within this document is by its very nature incomplete. Therefore the authors accept no responsibility for the precise accuracy of the documentation contained herein. It should be used rather as a guide and starting point.
Contact Actifsource AG
Täfernstrasse 37
5405 Baden-Dättwil
Switzerland
www.actifsource.com
Trademark Actifsource is a registered trademark of Actifsource AG in Switzerland, the EU, USA, and China. other names appearing on the site may be trademarks of their respective owners.

Overview

  • Create an eclipse project generator project

  • Generate the project settings

    image2 image2

  • Place non-generated files

    image3 image3

  • Generate .projectconfig files to enable project creation

    image4 image4

Part I Preparation

image5 image5

Part I Create Project Data

image6 image6

  • Create a new Class named “Project” in the package ch.actifsource.tutorial.project.generator.spec using the New Resource Wizard

image7 image7

  • Create a new Template named “ProjectSettingsTemplate” by right clicking the newly created class Project and selecting the New Template Wizard.
  • Since you clicked on the resource Project actifsource automatically fills in the base type, meaning the template is executed for each instance of the class Project

image2 image2

  • Write the content of the .project file or copy it from one of your existing eclipse project.
  • Replace the variable information by linking to the actifsource model (Use Content Assist: Ctrl+Space).
  • Use the project name to create a subdirectory for each project in the target folder.
  • In this example we only generate the project name from the model, feel free to extend the model to fit your needs.

Part II Add non generated files

image3 image3

  • Sometimes you may have configuration files equal for all projects, in this case just put them into a folder in the generator project.
  • Create a “src_common” folder and copy the .asproject and the .classpath file of a preconfigured project into it or use the ones on the following page.

image8 image8

image9 image9

Part III Create Project Configuration

  • Now after you generated and copied all project files, like the .project, .classpath and .asproject, you need to generate a .projectconfig file.
  • You need to create a .projectconfig file for each project. The .projectconfig defines the eclipse name of the project and the initial file structure. Since all settings are stored inside the projects file structure as setting-files, this also defines the initial project setup.

image4 image4

  • Write a template for the .projectconfig file, as before use the projectname from the model.

  • Actifsource provides the following elements inside the project-element.

    • dir with attribute name to create a directory in project root
    • file with attribute src and dst to copy a file from the generator project to the generated project use the overwrite attribute to specify if the file is overwritten each time generator runs again
    • workingset with attribute name to add the project to a specific

Part IV Setup BuildConfig and Targetfolder

image10 image10

  • Create a BuildConfig named “ProjectBuild” using the New BuildConfig Wizard and including all templates.

image12 image12

  • Create a new package ch.actifsource.tutorial.project.generator.usage.

image13 image13

  • Create an instance of the Project class in the package ch.actifsource.tutorial.project.generator.usage named “TestProject”.
  • This step will result in the first try to generate the project, but fails due to missing the buildconfig setup.

image14 image14

  • Right click on the project and select properties
  • Click on the category actifsource
  • Goto the target folder tab and click on the src-folder
  • Add the buildconfig ProjectBuild
  • Add the package ch.actifsource.tutorial.project.generator.usage
  • Now actifsource will generate the xml files with current xml-comment and the project builder creates a new project.

Part V Conclusion

  • As you have seen generating projects is very similar to generating any other file, except that you have to generate the project type specific settings files and a project configuration file.
  • Depending on your needs you may define the builders listed in .project files or the required libraries listed in .classpath files based on your models information.

actifsource-point-large