Note: information on this page refers to Ceylon 1.1, not to the current release.
<ceylon-compile-js>
Ant task
Usage
Note: You must declare the tasks with a <typedef>
.
This task compiles Ceylon code to JavaScript, by means of the
ceylon-js
command-line tool.
The <ceylon-compile-js>
task is fairly similar to <ceylon-compile>
; the difference
lies mainly with some options that are specific to JavaScript code
generation.
To compile the module com.example.foo
whose source code is in the
src
directory to a module repository in the build
directory, with
verbose compiler messages:
<target name="compile" depends="ceylon-ant-taskdefs">
<ceylon-compile-js src="src" out="build" verbose="true">
<module name="com.example.foo"/>
</ceylon-compile-js>
</target>
Description
The <ceylon-compile-js>
ant task supports compilation of Ceylon source code
to .js
files in a Ceylon repository using the Ant build tool.
It provides similar features to the ceylon compile-js
command line tool.
Parameters
Note: In addition to the parameters in the table below,
a nested <module>
s and/or a <files>
element is
required.
Attribute | Description | Required |
---|---|---|
out |
The output module repository (which must be publishable). | No, default is modules |
user |
The user name to use when connecting to the output repository. Only used for HTTP output repositories. | No |
pass |
The password to use when connecting to the output repository. Only used for HTTP output repositories. | No |
src |
A source directory. | No, default is source |
encoding |
The character encoding used for source files | No, default is the OS default encoding |
verbose |
Whether the compiler should emit verbose logging information. The zero or more of the following flags can be passed separated by commas: 'all' or 'loader'. If you do not pass a flag 'all' will be assumed. | No |
wrapModule |
Whether the generated JavaScript should be wrapped in CommonJS module format. | No, default is true |
lexicalScopeStyle |
Whether the JavaScript code should be generated using prototype style. | No, default is true |
srcArchive |
Whether the compiler should generate the .src archive or not. This is useful when doing joint compilation to bytecode and JS, to avoid generating the .src archive twice. | No, default is true |
Nested elements
Note: Unlike ant's <javac>
task, <ceyloncjs>
does not support an implict
FileSet so you cannot
add <include>
/<exclude>
etc as direct subelements. You must use
<files>
explicitly.
<moduleset>
A reference to a <moduleset>
defined elsewhere in the
ant build file.
<module>
A module to compile. Can be specified multiple times.
Attribute | Description | Required |
---|---|---|
name |
The module name | Yes |
<files>
A FileSet of source files to pass to ceyloncjs.
<reposet>
A reference to a <reposet>
defined elsewhere in the
ant build file.
<rep>
A module repository containing dependencies. Can be specified multiple times. Defaults to modules
.
Attribute | Description | Required |
---|---|---|
url |
The URL of the module repository | Yes |
Output
The <ceylon-compile-js>
task outputs a JS file and a source archive for
each module named on the command line.