Class | Buildr::CompileTask |
In: |
lib/buildr/core/compile.rb
(CVS)
|
Parent: | Rake::Task |
Compile task.
Attempts to determine which compiler to use based on the project layout, for example, uses the Javac compiler if it finds any .java files in src/main/java. You can also select the compiler explicitly:
compile.using(:scalac)
Accepts multiple source directories that are invoked as prerequisites before compilation. You can pass a task as a source directory:
compile.from(apt)
Likewise, dependencies are invoked before compiling. All dependencies are evaluated as artifacts, so you can pass artifact specifications and even projects:
compile.with('module1.jar', 'log4j:log4j:jar:1.0', project('foo'))
Creates a file task for the target directory, so executing that task as a dependency will execute the compile task first.
Compiler options are inherited form a parent task, e.g. the foo:bar:compile task inherits its options from the foo:compile task. Even if foo is an empty project that does not compile any classes itself, you can use it to set compile options for all its sub-projects.
Normally, the project will take care of setting the source and target directory, and you only need to set options and dependencies. See Project#compile.
dependencies | [RW] | Compilation dependencies. |
options | [R] | Returns the compiler options. |
project | [R] | The project this task belongs to. |
sources | [RW] | Source directories. |
target | [R] | The target directory for the compiled code. |
usage | [R] | The usage, one of :main or :test. |
Adds source directories and files to compile, and returns self.
For example:
compile.from('src/java').into('classes').with('module1.jar')
Sets the target directory and returns self. This will also set the compile task as a prerequisite to a file task on the target directory.
For example:
compile(src_dir).into(target_dir).with(artifacts)
Both compile.invoke and file(target_dir).invoke will compile the source files.