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 "LDT/User Area/Execution Environment file format"

< LDT
(Execution Environment)
(File structure)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
=Execution Environment=
 
=Execution Environment=
  
An Execution Environment, which may also be referred to as EE, is file containing information about the environment on which a lua application will be executed.
+
An Execution Environment, which may also be referred to as EE, is file containing information about the environment on which a Lua application will be executed.
  
So, If you want enable some IDE features (autocompletion, code documentation, ...) for a given execution environment (Lua 5.1, Corona, mihini, Gideros, ...) you can create your own custom EE, there are just a ''few rules'' to follow the type of the file and its inner structure.
+
So, if you want to enable some IDE features (autocompletion, code documentation, ...) for a given execution environment (Lua 5.1, Corona, mihini, Gideros, ...) you can create your own custom EE, there are just ''few rules'' to match the type of the file and its inner structure.
 +
 
 +
You could share your execution environment [[LDT/User_Area/Available_Execution_Environments|here]].
  
 
==File format==
 
==File format==
Line 17: Line 19:
 
** <code>docs/</code>
 
** <code>docs/</code>
 
*** <code>index.html</code>
 
*** <code>index.html</code>
** <code>*.rockspeck</code>
+
** <code>*.rockspec</code>
  
<code>api.zip</code> is a regular ZIP archive containing Lua API files written with the [[Koneki/LDT/Technical_Discussions/Documentation_Language| right format]].<br>
+
<code>api.zip</code> is a regular ZIP archive containing Lua API files (extension ''.luadoc'') written with the [[LDT/User_Area/Documentation_Language| right format]].<br>
You could generate this api files from your source code (lua and C)  with [[Koneki/LDT/User_Area/LuaDocumentor|LuaDocumentor]] command line tool.(perhaps one day luadocumentor will be able to generate the complete execution environment) <br>
+
You could generate these api files from your source code (lua and C)  with [[LDT/User_Area/LuaDocumentor|LuaDocumentor]] command line tool.(perhaps one day LuaDocumentor will be able to generate the complete execution environment) <br>
'''Note''': All the globals variable your will defined in global.lua will be considered as preloaded global variables, this means they will be always available in LDT autocompletion.  
+
'''Note on globals''': All the globals variable you will defined in global.lua will be considered as preloaded global variables, this means they will be always available in LDT autocompletion.
  
  
<code>docs</code> is a ''folder'' containing <code>html</code> documentation files. <code>index.html</code> is the file opened by LDT when user ask for EE documentation. (see [[Koneki/LDT/User_Area/LuaDocumentor|LuaDocumentor]])
+
<code>docs/</code> is a ''folder'' containing <code>html</code> documentation files. <code>index.html</code> is the file opened by LDT when user ask for EE documentation. (see [[LDT/User_Area/LuaDocumentor|LuaDocumentor]])
  
<code>*.rockspeck</code> enable to specify information about an EE, it is strongly inspired by the [http://luarocks.org/en/Rockspec_format Rockspeck format]. So far, following fields have been added to match LDT needs:
+
<code>*.rockspec</code> enable to specify information about an EE, it is strongly inspired by the [http://luarocks.org/en/Rockspec_format Rockspec format]. So far, following fields have been added to match LDT needs:
 
*<code>api</code>
 
*<code>api</code>
 
*<code>documentation</code>
 
*<code>documentation</code>
Line 37: Line 39:
  
 
It is temporary, we will soon handle all *.rockspec settings. This why you '''must write valid *.rockspec''' to be compliant with up coming versions of LDT.
 
It is temporary, we will soon handle all *.rockspec settings. This why you '''must write valid *.rockspec''' to be compliant with up coming versions of LDT.
 +
 +
'''Since 1.1:'''
 +
*<code>templates/</code> (optional)
 +
**<code>default/</code>
 +
If a ''Lua Project'' is created using an ''Execution Environment'' with the ''Create a default template ready to run'' option checked, it will be filled with files and folders under <code>templates/default/</code>. In the future, it will be possible to select different templates defined in the <code>templates/</code> folder. For now, only the <code>default/</code> sub folder is supported. By default, the buildpath of your project will only contain the folder ''src'', but it can be customized in the manifest.
 +
 +
'''Since 1.3:'''
 +
*<code>grammar/</code> (optional)
 +
The grammar of lua on which the execution environment is built.
 +
This information is used by LDT to select the right grammar automatically at [[LDT/User_Area/New_Noteworthy/New_Noteworthy_1.3#Lua_5.2_Project_Creation|project creation]].
  
 
===A sample of EE manifest===
 
===A sample of EE manifest===
<code><pre>
+
<source lang="lua">  
 
package = "lua"
 
package = "lua"
 
version = "5.1"
 
version = "5.1"
 +
grammar = "lua-5.1"
 
flags = { ee = true }
 
flags = { ee = true }
 
description = {
 
description = {
  summary = "Lua 5.1 Execution Environment",
+
  summary = "Lua 5.1 Execution Environment",
  detailed = [[ Lua 5.1 Execution Environment Support]],
+
  detailed = [[ Lua 5.1 Execution Environment Support]],
  licence = "MIT",
+
  licence = "MIT",
  homepage= "http://www.lua.org/manual/5.1/manual.html"
+
  homepage= "http://www.lua.org/manual/5.1/manual.html"
 
}
 
}
 
api = {
 
api = {
  file = "api.zip"
+
  file = "api.zip"
 
}
 
}
documentation ={
+
documentation = {
 
   dir="docs"
 
   dir="docs"
}</pre>
+
}
</code>
+
templates = {
 +
  default = {
 +
    buildpath = {"mysrc","mysecondsrc"},
 +
    openfile = "mysrc/myfile.lua"
 +
}</source>
 +
 
 +
'''Note on templates: '''
 +
The ''templates'' node is optional. If not set, a default one will be used with a ''src'' folder in source path and a default ''main.lua'' file.<br>
 +
The ''buildpath'' node is a list of folder project relative paths to be included in the buildpath of the created project. To add the whole project in the buildpath add ''/'' in the ''buildpath'' list. An error will be throw if the ''buildpath'' list contains a subfolder path to a previous path in the list (e.g. you can't have a list like that: <code>{"src/", "src/myfolder"}</code>).<br>
 +
The ''openfile'' node is a project relative path to the file to open when the project creation is finish ( by default ''src/main.lua'').

Latest revision as of 11:46, 18 May 2015

Execution Environment

An Execution Environment, which may also be referred to as EE, is file containing information about the environment on which a Lua application will be executed.

So, if you want to enable some IDE features (autocompletion, code documentation, ...) for a given execution environment (Lua 5.1, Corona, mihini, Gideros, ...) you can create your own custom EE, there are just few rules to match the type of the file and its inner structure.

You could share your execution environment here.

File format

An EE is simply a regular .zip file.

File structure

To be a valid EE, a ZIP file root must respect the following tree structure.

  • /
    • api.zip
    • docs/
      • index.html
    • *.rockspec

api.zip is a regular ZIP archive containing Lua API files (extension .luadoc) written with the right format.
You could generate these api files from your source code (lua and C) with LuaDocumentor command line tool.(perhaps one day LuaDocumentor will be able to generate the complete execution environment)
Note on globals: All the globals variable you will defined in global.lua will be considered as preloaded global variables, this means they will be always available in LDT autocompletion.


docs/ is a folder containing html documentation files. index.html is the file opened by LDT when user ask for EE documentation. (see LuaDocumentor)

*.rockspec enable to specify information about an EE, it is strongly inspired by the Rockspec format. So far, following fields have been added to match LDT needs:

  • api
  • documentation
  • flags

You may have noticed that api.file is set to 'api.zip' and documentation.dir to 'docs'. Do not change those values in the *.rockspec you write, it will have no effect.
As I am writing, all parameters are hard coded, except:

  • package
  • version

It is temporary, we will soon handle all *.rockspec settings. This why you must write valid *.rockspec to be compliant with up coming versions of LDT.

Since 1.1:

  • templates/ (optional)
    • default/

If a Lua Project is created using an Execution Environment with the Create a default template ready to run option checked, it will be filled with files and folders under templates/default/. In the future, it will be possible to select different templates defined in the templates/ folder. For now, only the default/ sub folder is supported. By default, the buildpath of your project will only contain the folder src, but it can be customized in the manifest.

Since 1.3:

  • grammar/ (optional)

The grammar of lua on which the execution environment is built. This information is used by LDT to select the right grammar automatically at project creation.

A sample of EE manifest

 
package = "lua"
version = "5.1"
grammar = "lua-5.1"
flags = { ee = true }
description = {
  summary = "Lua 5.1 Execution Environment",
  detailed = [[ Lua 5.1 Execution Environment Support]],
  licence = "MIT",
  homepage= "http://www.lua.org/manual/5.1/manual.html"
}
api = {
  file = "api.zip"
}
documentation = {
  dir="docs"
}
templates = {
  default = {
    buildpath = {"mysrc","mysecondsrc"},
    openfile = "mysrc/myfile.lua"
}

Note on templates: The templates node is optional. If not set, a default one will be used with a src folder in source path and a default main.lua file.
The buildpath node is a list of folder project relative paths to be included in the buildpath of the created project. To add the whole project in the buildpath add / in the buildpath list. An error will be throw if the buildpath list contains a subfolder path to a previous path in the list (e.g. you can't have a list like that: {"src/", "src/myfolder"}).
The openfile node is a project relative path to the file to open when the project creation is finish ( by default src/main.lua).

Back to the top