Using Neptune
- Projects
- Targets
- Commands
- Ant Tasks
- Ant Data Types
- A demo project
- Ant Sub-elements
- Ant Custom task/type
- Neptune API Documentation
- Neptune-related Jaskell Reference
- Jaskell API Documentation
- Using Jaskell
Writing a Simple Buildfile
Neptune's buildfiles are written in The Jaskell scripting language.
Each buildfile contains an expression that evaluates to a project, and at least one (default) target. Targets invoke certain commands.
Projects
A project has the following attributes:
Attribute |
Description |
Required |
name |
the name of the project. |
No |
default |
the default target to use when no target is supplied. |
No |
basedir |
the base directory from which all path calculations are done. If omitted, the parent directory of the buildfile will be used. |
No |
description |
The description of the project. |
No |
other custom attributes |
Any other custom attribute. |
No |
Each project defines one or more targets. A target is a named command you want to be executed. When starting Neptune, you can select which target(s) you want to have executed. When no target is given, the project's default is used.
Targets
Targets are named commands. They can be invoked by name from the command line.
Commands
A command is an object that can be executed.
Command can be an ant task, an object that implements jfun.neptune.Command, or a combination of commands.
Properties
All system properties available when Neptune is started are stored in the "properties" tuple. For example:
is the name of the operating system.
For a list of system properties see the Javadoc of System.getProperties.
A demo project
For the following Ant buildfile:
Equivalent Neptune buildfile is:
To prevent code duplication, we used "jaskell.prelude.map" function.
is equivalent to
Ant Tasks
Ant tasks are one kind of commands.
They are put in the "ant" tuple, such as "ant.delete", "ant.javac", etc.
Properties are initialized using a tuple. Sub-elements are attached using the "with" method. For example, the following ant task:
is equivalent to:
Ant tasks are also in the "ant.tasks" tuple.
Ant Data Types
Ant types can be found in the "ant.types" tuple. For example, "ant.types.fileset", "ant.types.patternset" etc.
Ant Sub-elements
Sub-elements of an Ant task/type are attached by the "with" method.
Sub-elements are attached by type or by name.
When a sub-element is not a recognized Ant type, the "ant.element" function can be used to attach it by name. For example, the following Ant script:
can be translated to Neptune script as:
Ant Custom task/type
Neptune allows loading Java classes as ant task or any other ant data type.
For the following "taskdef" in Ant:
Neptune script is:
Different from taskdef, the "ant.declare" function can be used to load custom data type as well with the exact same syntax.
