Target
Info
Used to create an target; can only be placed into the top-level block (file).
Usage:
target "name" {
# Target commands
}
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
name
|
str
|
The name of the target to define Expanded?: ❌ |
Known core data
Following data is provided by default:
$(sys.rootDir)
: root directory of the buildfile containing the target$(sys.outDir)
: output directory for the target$(sys.buildDir)
: build directory for the target$(sys.includeOnly)
: boolean value set totrue
if theres no files to be build and no build handlers. One such case where this is present would be if you write an target with the c/c++ language that only contains header files (an so-called header-only library).
Resolving uri’s
Each time a uri is to be resolved for an target, the following “protocols” / formats are allowed:
-
none specified: plain file path against the root directory of the buildfile.
-
build://
: relative path from the build directory of the target. -
out://
: relative path from the output directory of the target. -
src+alias://
: relative path to a (named) source; herealias
is the name / alias of the source, which would be declared with theas "alias"
syntax (see below).
Known core Subcommands
lang
Sets the language of an target. First argument must be an registered language; everything after it depends on the language selected. See the languages documentation for that.
Usage: lang "name"
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
name
|
str
|
The name of the language Expanded?: ✅ |
desc
Sets a description for the target. This is purely visual.
Usage: desc "Some description"
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
value
|
str
|
The description of the target Expanded?: ✅ |
type
Sets the type of the target. Required.
Example: type bin
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
type
|
sym
|
The type the of the target Allowed values:
|
1 |
kind
(optional)
|
sym
|
The library kind of the target. Allowed values depend on the language used. |
source
Adds a source to the project. This can either be a glob (like ./src/*.cpp
) or an directory, in which case the language you’ve set will determine the files included. The string can also be in the form of accessor://remote
to use an remote source. For more informations about accessors, see its documentation.
You can specify an alias for the source, by adding as "abc"
at the end, which is usefull for refering to longer source declarations like git repos.
use "./src"
use "./src/**/*.cpp"
use "git://myrepo.com/my/repo"
use "x" as "y"
Aliases: sources
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
source
|
str
|
Expanded?: ✅ |
1 |
as
(optional)
|
sym
|
Allowed values:
|
2 |
alias
(optional)
|
str
|
Expanded?: ❌ |
use
Adds a dependency to the current target. There are two kinds of dependencies: local and remote:
- local dependecies are simply dependencies to other targets. They are done by simply writing the name of it:
use "mylib"
- remote dependencies are whre nitto’s repository system comes in. They are build like an url:
accessor://remote
, like:mvn://some/maven/dependency
. For more informations about accessors, see its documentation.
Examples:
use "mylib"
use "mvn://some/maven/dependency"
There is however a optional second argument: static
. With it, you can express that the connection to the dependency should be static, which for example means to c/c++ to link statically.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
remote
|
str
|
Expanded?: ✅ |
1 |
static
(optional)
|
sym
|
Allowed values:
|
set_data
The set_data
command is used to manipulate the target’s datastore.
There are two ways to use this command:
- simple:
set_data <key> <value>
- complex:
set_data <type> <key> <operation> <values ...>
simple
When using this variant, keys set with this are only containing strings.
Example: set_data "my.key" "123456"
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
key
|
str
|
The key to set Expanded?: ✅ |
1 |
value
|
str
|
The value to set the key to Expanded?: ✅ |
complex
When using this variant, you can choose better what data to store and better manipulate it.
Type | Operation | Description |
---|---|---|
str_list |
clear |
Clears the list |
append |
Appends to the end of the list | |
path_str |
set |
Sets a path; allows for both build:// and out:// prefixed paths!
|
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
type
|
sym
|
The type of the key; see table above |
1 |
key
|
str
|
The key to set Expanded?: ✅ |
2 |
operation
|
sym
|
The operation to do; see table above |
3 |
val
|
str
|
The value to use as input for the operation Expanded?: ✅ |