Documentation TaskDoc JavaDoc


The include() task can be used to include other build targets in the current build execution.


The following parameters are used by the task:

Target, unnamedOptional name of the build target to invoke. If not specified, a default one is chosen.
PathOptional path to the build file that contains the invoked target. The file of the current build script is considered when not specified.
WorkingDirectoryOptional path to the working directory for the build target. The parent directory of the target build file is used when not specified.
otherOptional other parameters to pass to the invoked build target. The parameters may have any arbitrary names.

Both the Target and Path parameters are optional, but at least one of them must be specified.
If the Path parameter is missing, the target build file is considered to be the same as the one calling the include() task.
If the Target parameter is missing, a default build target will be chosen based on the structure of the target build file:

  • If there is only a single build target in the file, that one is chosen.
  • If the target file contains a build target named build, that one is used.
  • If there are no build targets in the target file or failed to determine based on the above rules, an exception is thrown.

Keep in mind that if there are no explicit build targets, but there are global expressions in your file, then an implicit build target will be defined for you.

Note that build directory related parameter is intentionally left out. All included targets will be invoked with having the execution build directory as their build directories.

Task result

The result of the build target invocation. The output parameters of the invoked target is accessible using the [subscript] operator.


The following example contains two files (, and

build {
	# includes the compile target in
	#   with the "src" value as Directory parameter
	include(compile, Directory: src)
	# ... some other build steps
	in Directory,
) {
	# compiles some sources in the parameter directory
	#   with the library from on path
		# include the build target in
		#   and access the Library output parameter
		LibraryPath: include(Path:[Library]

	# input parameter with default value
	in Sources = libsrc,
	# output parameter of the compiled library
	out Library,
) {
	$Library = example.compile.library($Sources)

In the above example we can see that the compilation of a library and the user of that library have been decoupled into different build files. They include each other when the result of the given result is needed.