<ceylon-compile> Ant task

Usage

Note: You must declare the tasks with a <typedef>.

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 src="src" out="build" verbose="true">
    <module name="com.example.foo"/>
  </ceylon-compile>
</target>

Description

Compiles Ceylon and Java source code and directly produces module and source archives in a module repository.

The <ceylon-compile> ant task wraps the ceylon compile command.

Attributes

Attribute Description Required
cacheRep

Equivalent to the --cacherep command line option. Specifies the folder to use for caching downloaded modules. (default: ~/.ceylon/cache)

No
config

Equivalent to the --config command line option. Specifies the configuration file to use for this tool. (default: ./.ceylon/config)

No
cwd

Equivalent to the --cwd command line option. Specifies the current working directory for this tool. (default: the directory where the tool is run from)

No
encoding

Equivalent to the --encoding command line option. Sets the encoding used for reading source files(default: platform-specific).

No
errorProperty

The ant property to set to true in the event of an error

No
executable

The location of the ceylon executable script.

No
failOnError

Whether an error in executing this task should fail the ant build

No
fork

Whether the task should be run in a separate VM (default: false)

No
generateModuleInfo

Equivalent to the --generate-module-info command line option. Generate Java 9 (Jigsaw) module-info.class module descriptor in the generated Ceylon archive.

No
inheritAll

Whether a task should inherit environment and properties. Only applies when forked == true.

No
noDefaultRepositories

Equivalent to the --no-default-repositories command line option. Indicates that the default repositories should not be used.

No
noMtimeCheck

When true a file modification time check will be performed to avoid processing sources unnecessarily (default: true).

No
noOsgi

Equivalent to the --no-osgi command line option. Indicates that the generated car file should not contain OSGi module declarations.

No
noPom

Equivalent to the --no-pom command line option. Indicates that the generated car file should not contain Maven POM module declarations.

No
offline

Equivalent to the --offline command line option. Enables offline mode that will prevent connections to remote repositories.

No
osgiProvidedBundles

Equivalent to the --osgi-provided-bundles command line option. Comma-separated list of module names. The listed modules are expected to be OSGI bundles provided by the framework, and will be omitted from the generated MANIFEST 'Required-Bundle' OSGI header.

No
out

Equivalent to the --out command line option. Specifies the output module repository (which must be publishable). (default: ./modules)

No
overrides

Equivalent to the --overrides command line option. Specifies the XML file to use to load module overrides. See http://ceylon-lang.org/documentation/current/reference/repository/maven/ for information. Experimental.

No
pack200

Equivalent to the --pack200 command line option. Try to make the generated car file smaller by repacking it using pack200.

No
pass

Equivalent to the --pass command line option. Sets the password for use with an authenticated output repository (no default).

No
resource

Equivalent to the --resource command line option. Path to directory containing resource files. Can be specified multiple times; you can also specify several paths separated by your operating system's PATH separator. (default: ./resource)

No
resultProperty

The ant property to set to the Ceylon program exit code

No
stacktraces

Equivalent to the --stacktraces command line option. If an error propagates to the top level tool, print its stack trace.

No
sysRep

Equivalent to the --sysrep command line option. Specifies the system repository containing essential modules. (default: $CEYLON_HOME/repo)

No
user

Equivalent to the --user command line option. Sets the user name for use with an authenticated output repository (no default).

No
verbose

Equivalent to the --verbose command line option. Produce verbose output. If no flags are given then be verbose about everything, otherwise just be verbose about the flags which are present. Allowed flags include: all, loader, ast, code, cmr, benchmark.

No

Nested elements

<define>

A <define> element is used to set system properties for the ant task being executed. Equivalent to the --define command line option. Set a system property

The value for the system property can either be passed as a value attribute:

<define key="org.example.helloworld.greeting" value="Hi"/>

or it can be the text between the begin and end tags:

<define key="org.example.helloworld.greeting">Hi</define>

Alternatively, it is posible to dispense with the attributes and use the syntax

<define>org.example.helloworld.greeting=Hi</define>
Element Description Required
key

The property to be defined

No
value

The value of the define

No

<files>

A <fileset> containing Ceylon and Java files to be compiled (incremental compilation)

<javacOption>

Equivalent to the --javac command line option. Passes an option to the underlying java compiler.

For example:

<javac key="-encoding">UTF-8</javac>

or

<javac key="-encoding" value="UTF-8"/>>
Element Description Required
key

The name of the javac option

Yes
value

The value of the javac option. Required when the corresponding javac option requires an argument

No

<module>

A module to be compiled

A <module> element must specify a name, and may specify a version. If the relevant ceylon task don't require a version it will be ignored.

Element Description Required
name

The module name.

Yes
version

The module version. Whether this is required depends on the task

No

<moduleSet>

Modules to be compiled

A <moduleset> containing a number of <sourcemodule>s and/or <module> subelements. It can be defined at the top level and then used by reference using the refid attribute, so you don't have to repeat the same list of modules all the time.

Element Description Required
refid

A reference to a <moduleset> defined elsewhere.

No

<rep>

A module repository containing dependencies. Can be specified multiple times. Defaults to <rep url="./modules"/>.

Element Description Required
url

The URL or path of the module repository.

Yes, unless a `refid` is given
refid

A reference to a <rep> defined outside this task.

No

<reposet>

A set of module repositories containing dependencies. Can be specified multiple times. Default to modules.

A <reposet> element contains a number of <repo> and/or <reposet> elements. It can be defined at the top level, and then used by reference using the refid attribute so you don't have to repeat the same list of repositories all the time.

Element Description Required
refid

A reference to a <reposet> defined elsewhere.

No

<resource>

Equivalent to the --resource command line option. Path to directory containing resource files. Can be specified multiple times; you can also specify several paths separated by your operating system's PATH separator. (default: ./resource)

Element Description Required
value

The source path.

No

<source>

A <source> path, specifying a source path, for example:

<source>my/src/directory</source>

or

<source value="/src/directory"/>

Equivalent to the --src command line option. Path to directory containing source files. Can be specified multiple times; you can also specify several paths separated by your operating system's PATH separator. (default: ./source)

Element Description Required
value

The source path.

No

<sourceModules>

Modules to be compiled

Includes all the ceylon modules in a given source directory, as specified by the dir attribute. This saves you having to explicitly list all the modules to be compiled, you can instead just compile all the modules in a given directory.

Element Description Required
dir

The directory containing module source files

No

<src>

Synonymous with <source>

Element Description Required
value

The source path.

No

<suppressWarning>

Equivalent to the --suppress-warning command line option. Suppress the reporting of the given warnings. If no warnings are given then suppresss the reporting of all warnings, otherwise just suppresss those which are present. Allowed flags include: filenameNonAscii, filenameCaselessCollision, deprecation, compilerAnnotation, doclink, expressionTypeNothing, unusedDeclaration, unusedImport, ceylonNamespace, javaNamespace, suppressedAlready, suppressesNothing, unknownWarning, ambiguousAnnotation, similarModule, importsOtherJdk, javaAnnotationElement.

Suppresses compiler warnings. Warnings can be suppressed by type, for example

<suppressWarning>filenameNonAscii</suppressWarning>

or eqiuvalently

<suppressWarning value="filenameNonAscii">

or all warnings can be suppressed by not naming any specific warnings:

<suppressWarning/>
Element Description Required
value

The name of the warning(s) to be suppressed.

No

See also