Synopsis

ceylon compile [--cacherep=<url>] [--cwd=<dir>] [--define=<key>=<value>...] [--encoding=<encoding>] [--javac=<option>...] [--maven-overrides=<url>] [--no-default-repositories] [--offline] [--out=<url>] [--pass=<secret>] [--rep=<url>...] [--resource=<dirs>...] [--source=<dirs>...] [--src=<dirs>...] [--sysrep=<url>] [--user=<name>] [--verbose[=<flags>]] [--] [<moduleOrFile...>]

Description

The default module repositories are modules and http://modules.ceylon-lang.org/repo/1, while the default source directory is source and the default resource directory is resource. The default output module repository is modules.

The <moduleOrFile> arguments can be either module names (without versions) or file paths specifying the Ceylon or Java source code to compile.

When <moduleOrFile> specifies a module the compiler searches for compilation units and resource files belonging to the specified modules in the specified source and resource directories. For each specified module, the compiler generates a module archive, source archive, and their checksum files in the specified output module repository.

When <moduleOrFile> specifies a source file only that file is compiled and the module archive is created or updated with the .class files produced. The source file path is treated as relative to the current directory (it still needs to be located either in the default source folder or in any folder defined by the configuration file or --source options!).

When <moduleOrFile> specifies a resource file only that file is added to the module archive. The resource file path is treated as relative to the current directory (it still needs to be located either in the default resource folder or in any folder defined by the configuration file or --resource options!).

All program elements imported by a compilation unit must belong to the same module as the compilation unit, or must belong to a module that is explicitly imported in the module descriptor.

The compiler searches for dependencies in the following locations:

  • module archives in the specified repositories,
  • source archives in the specified repositories, and
  • module directories in the specified source directories.

Options

--cacherep=url

Specifies the folder to use for caching downloaded modules. (default: ~/.ceylon/cache)

--cwd=dir

Specifies the current working directory for this tool. (default: the directory where the tool is run from)

--define=key>=<value, -D key>=<value

Set a system property

--encoding=encoding

Sets the encoding used for reading source files(default: platform-specific).

--javac=option

Passes an option to the underlying java compiler.

--maven-overrides=url

Specifies the xml file to use to load Maven artifact overrides.

--no-default-repositories

Indicates that the default repositories should not be used.

--offline

Enables offline mode that will prevent connections to remote repositories.

--out=url

Specifies the output module repository (which must be publishable). (default: ./modules)

--pass=secret

Sets the password for use with an authenticated output repository(no default).

--rep=url

Specifies a module repository containing dependencies. Can be specified multiple times. (default: modules, ~/.ceylon/repo, http://modules.ceylon-lang.org/repo/1)

--resource=dirs

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)

--source=dirs

An alias for --src (default: ./source)

--src=dirs

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)

--sysrep=url

Specifies the system repository containing essential modules. (default: $CEYLON_HOME/repo)

--user=name

Sets the user name for use with an authenticated output repository(no default).

--verbose[=flags]

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.

Configuration file

The compile tool accepts the following options from the Ceylon configuration file: defaults.offline, defaults.encoding, compiler.source, compiler.resource and repositories (the equivalent options on the command line always have precedence).

About resources

Duplicate resources (resources with the exact same name and path found in several resource folders at a time) are handled on a first come first serve basis where the order is defined by the order of the --resource options on the command line or the order of the compiler.resource options in the configuration file.

Specifying javac options

It is possible to pass options to the javac compiler by prefixing them with --javac= and separating the javac option from its argument (if any) using another =. For example:

  • The option --javac=-target=1.6 is equivalent to javac's -target 1.6 and,
  • the option --javac=-g:none is equivalent to javac's -g:none

Execute ceylon compile --javac=-help for a list of the standard javac options, and ceylon compile --javac=-X for a list of the non-standard javac options.

Important note: There is no guarantee that any particular javac option or combination of options will work, or continue to work in future releases.