Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:Compiler Settings Introduction"

m
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= EDT compiler settings introduction<br>  =
+
In EDT 0.7, the EDT Compiler contains two generators: one for Java and one for JavaScript. The Java generator is used for generating EGL code to Java. Generally, the EGL files configured with Java generator are EGL services and programs. Interfaces, libraries, and records used in services and programs also need to be configured with the Java generator. On the other hand, the Rich UI handlers are mostly configured with the JavaScript generator, because normally they will be generated to JavaScript running in a browser. It's possible that interfaces, libraries, and records would be also used in RUI handlers; if so, then those parts should be configured with the JavaScript generator as well. Otherwise, the generated JavaScript file of a RUIHandler cannot resolve references to the interfaces, libraries or records. If a type is referenced in both services and RUI handlers, then the referenced part should be configured with both Java and JavaScript generators
  
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 &amp; generators available in EDT in future. Compiler and generators should be configured when developing EGL applications.  
+
You can configure the compiler and generators for your EGL applications at a project or package level. The settings in the parent level will be inherited by the children unless they are not changed.  
  
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.
+
=== Compiler setting in the New EGL Project Wizard<br>  ===
  
For the generators, EDT 0.7 supports Java &amp; 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 &amp; records used in services &amp; 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 &amp; 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 &amp; RUI handlers, then the referenced part should be configured with both Java &amp; JavaScript generators.  
+
In the EGL Project wizard ('''File &gt; New &gt; EGL Project'''), four types of project templates are available. The EGL project wizard provides compiler and generator defaults based on the project template selected.&nbsp;The Hello World project template is a sample which uses both the Java and JavaScript generators by default. The other templates allow you to specify the generators you want to use.&nbsp;In most cases you can follow the default settings created by the New EGL Project wizard, and you won't need to configure the settings manually if you follow the usage conventions for packages.<br>
  
EDT also supports to specify the compiler &amp; 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 &amp; 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.  
+
[[Image:Project templates.jpg]]<br>
  
In the project creation wizard (File &gt; New &gt; 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.<br>  
+
<br>  
  
 +
A project created using the '''Basic '''template uses both the Java and JavaScript generators. EGL source files in a basic project will be generated into both Java and JavaScript.<br><br>
  
 +
The '''Web 2.0 client application''' template has a single package named '''client '''configured with JavaScript generator by default. Only JavaScript will be generated for the EGL source files in this project.
  
== Basic <br> ==
+
<br>  
  
If the 'Basic' template is selected and click 'Next' button, then the 2nd page of the wizard will let you choose compiler &amp; 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 &amp; JavaScript generators. So if EGL source files under this project will be generated in both Java &amp; JavaScript.
+
A project created with the&nbsp;'''Web 2.0 client application with services''' template contains 3 packages; client, server, and common. The client package is configured with JavaScript generator. The server package is configured with the Java generator. The common package is configured with both the Java and JavaScript generators. You can put the EGL source files in different packages depending on the purpose of each file. For example, if a type is referenced in both the client and server packages, then the type should be put into the common package.&nbsp;<br>
  
User can check the compiler &amp; generators settings by right clicking projects or packages &gt; Properties &gt; 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.<br>  
+
<br>  
  
[[Image:Compiler_setting_project.jpg]]<br>
+
You can check Override generation settings from workspace preferences to override the settings for the project.  
  
== Web 2.0 client application  ==
+
&lt;insert image of compiler setting page&gt;<br>
  
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.
+
=== Compiler settings in the Properties  ===
  
== <br>Web 2.0 client application with services  ==
+
You can view or edit the compiler and generator settings by right-clicking '''Projects '''or&nbsp;'''Packages &gt; Properties &gt; EGL Compiler'''. Also, you can specify whether the project or package is allowed to change the settings in this window. Please refer to the screen shot below to see the compiler settings for a package.<br>  
  
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' &amp; 'server' package, then the type should be put into 'common' package.<br>- 'client' package configured with JavaScript generator only. <br>- 'common' package configured with both Java &amp; JavaScript generator.<br>- 'server' package configured with Java generator only.
+
[[Image:Compiler setting project.jpg]]<br>  
  
== Set default compiler and generator setting for workspace  ==
+
== Set default compiler and generator setting for your workspace  ==
  
User can set the default generator folder for Java &amp; JavaScript generators by clicking 'Windows &gt; Preference &gt; EGL &gt; Compiler &gt; EDT', please refer to below picture. You can specify a different generator folder for Java &amp; JavaScript generators.<br>
+
You can set the default generator folder for the Java and JavaScript generators by clicking '''Windows &gt; Preferences &gt; EGL &gt; Compiler &gt; EDT'''.&nbsp; You can specify a different generator folder for the Java and&nbsp; JavaScript generators.<br>  
 +
 
 +
[[Image:Compiler preference.jpg]]
 +
 
 +
<br>
 +
 
 +
== Extending EDT compiler and generators  ==
 +
 
 +
EDT is designed for extensibility, which means that you can extend the EDT framework with your own compilers and generators.&nbsp;<br>
 +
 
 +
[[Category:EDT]]

Latest revision as of 18:48, 17 February 2012

In EDT 0.7, the EDT Compiler contains two generators: one for Java and one for JavaScript. The Java generator is used for generating EGL code to Java. Generally, the EGL files configured with Java generator are EGL services and programs. Interfaces, libraries, and records used in services and programs also need to be configured with the Java generator. On the other hand, the Rich UI handlers are mostly configured with the JavaScript generator, because normally they will be generated to JavaScript running in a browser. It's possible that interfaces, libraries, and records would be also used in RUI handlers; if so, then those parts should be configured with the JavaScript generator as well. Otherwise, the generated JavaScript file of a RUIHandler cannot resolve references to the interfaces, libraries or records. If a type is referenced in both services and RUI handlers, then the referenced part should be configured with both Java and JavaScript generators

You can configure the compiler and generators for your EGL applications at a project or package level. The settings in the parent level will be inherited by the children unless they are not changed.

Compiler setting in the New EGL Project Wizard

In the EGL Project wizard (File > New > EGL Project), four types of project templates are available. The EGL project wizard provides compiler and generator defaults based on the project template selected. The Hello World project template is a sample which uses both the Java and JavaScript generators by default. The other templates allow you to specify the generators you want to use. In most cases you can follow the default settings created by the New EGL Project wizard, and you won't need to configure the settings manually if you follow the usage conventions for packages.

Project templates.jpg


A project created using the Basic template uses both the Java and JavaScript generators. EGL source files in a basic project will be generated into both Java and JavaScript.

The Web 2.0 client application template has a single package named client configured with JavaScript generator by default. Only JavaScript will be generated for the EGL source files in this project.


A project created with the Web 2.0 client application with services template contains 3 packages; client, server, and common. The client package is configured with JavaScript generator. The server package is configured with the Java generator. The common package is configured with both the Java and JavaScript generators. You can put the EGL source files in different packages depending on the purpose of each file. For example, if a type is referenced in both the client and server packages, then the type should be put into the common package. 


You can check Override generation settings from workspace preferences to override the settings for the project.

<insert image of compiler setting page>

Compiler settings in the Properties

You can view or edit the compiler and generator settings by right-clicking Projects or Packages > Properties > EGL Compiler. Also, you can specify whether the project or package is allowed to change the settings in this window. Please refer to the screen shot below to see the compiler settings for a package.

Compiler setting project.jpg

Set default compiler and generator setting for your workspace

You can set the default generator folder for the Java and JavaScript generators by clicking Windows > Preferences > EGL > Compiler > EDT.  You can specify a different generator folder for the Java and  JavaScript generators.

Compiler preference.jpg


Extending EDT compiler and generators

EDT is designed for extensibility, which means that you can extend the EDT framework with your own compilers and generators. 

Copyright © Eclipse Foundation, Inc. All Rights Reserved.