EDT:Compiler Settings Introduction

From Eclipsepedia

Revision as of 21:45, 20 December 2011 by Jinfahua.cn.ibm.com (Talk | contribs)

Jump to: navigation, search

Contents

EDT compiler settings introduction

EDT is designed for extension, which means that the 3rd party can extend the EDT framework to customize their own compilers and generators. Currently, 'EDT Compiler', and 'Java/JavaScript Generator' are supported in EDT 0.7. It would have other compilers & generators available in EDT in future. Compiler and generators should be configured when developing EGL applications.

For the compilers, currently EDT 0.7 only has 'EDT Compiler' and it's the default compiler in the EDT 0.7, so users do not need care about the compilers.

For the generators, EDT 0.7 supports Java & JavaScript generators. Java generator is used for generating the EGL code to Java. Generally, the EGL files configured with Java generators are EGL services and programs. Also the interfaces, libraries & records used in services & programs are also need to configured with Java generators. On the other hand, the RUI handlers are mostly configured with JavaScript generator, because normally it will be generated to JavaScript running in browser. It's possible that the interfaces, libraries & records would be also used in RUI handlers, so those parts should be configured JavaScript generator as well. Otherwise, the generated JavaScript file of RUIHandler cannot resolve the generated JavaScript of interfaces, libraries or records. From the previous introduction, you can know that if a type is reference in both service & RUI handlers, then the referenced part should be configured with both Java & JavaScript generators.

EDT also supports to specify the compiler & generators setting by project or package level. The settings in parent will be inherited to the children if they are not changed by user. It looks like that configuring the compiler & generators are not easy work for you. But fortunately, in most of cases, you can follow the default compiler settings created by project wizard and without need configure them manually if following the usage of convention for packages.

In the project creation wizard (File > New > EGL Project), 4 types of project templates are available as in below picture. The 2nd project template is only for a sample, so actually the wizard provides 3 kinds of project templates.


Basic

If the 'Basic' template is selected and click 'Next' button, then the 2nd page of the wizard will let you choose compiler & generators. You can check the 'Override generation settings from workspace preferences' to override the setting for the project. If keeping the default settings, then the created project will specified with Java & JavaScript generators. So if EGL source files under this project will be generated in both Java & JavaScript.

User can check the compiler & generators settings by right clicking projects or packages > Properties > EGL Compiler. Also, user can modify the generator settings if the project or package is allowed to change the settings in this window. Please refer to below screen-shot the compiler settings for a package.

Compiler setting project.jpg

Web 2.0 client application

The project created by this template only has a package named 'client' configured with JavaScript generator by default, which means that only JavaScript will be generated for the EGL source files in this project.


Web 2.0 client application with services

The project created by this template will have 3 packages, user can put the EGL source files to different packages with different purpose of the file. For example, if a type which is referenced in both 'client' & 'server' package, then the type should be put into 'common' package.
- 'client' package configured with JavaScript generator only.
- 'common' package configured with both Java & JavaScript generator.
- 'server' package configured with Java generator only.

Set default compiler and generator setting for workspace

User can set the default generator folder for Java & JavaScript generators by clicking 'Windows > Preference > EGL > Compiler > EDT', please refer to below picture. You can specify a different generator folder for Java & JavaScript generators.