• No results found

remotes = {}

A dictionary with Conan remotes to use when fetching packages.

The dictionary key is the name of remote and its value is the URL.

Example:

remotes = {

"bincrafters": "https://api.bintray.com/conan/bincrafters/public-conan"

}

7.15 Docker

7.15.1 DockerImage

class jolt.plugins.docker.DockerImage(*args, **kwargs) Builds a Docker image and publishes the resulting tarfile.

The image may optionally be compressed using bzip2, gzip or lzma compression.

Example:

from jolt.plugins.docker import DockerImage

class Busybox(DockerImage):

compression = "gz"

dockerfile = """

FROM busybox:latest CMD ["busybox"]

"""

tag = "busybox:latest"

compression = None

Optional image compression “bz2”, “gz”, or “xz”.

context = '.'

Path to build context, relative to joltdir (directory).

dockerfile = 'Dockerfile'

Path to the Dockerfile to build, or the full source code of such a file.

imagefile = None

Name of the image tarball. Defaults to the task’s canonical name.

tag = None

Optional image tag.

7.16 Ninja

7.16.1 CXXExecutable

class jolt.plugins.ninja.CXXExecutable(*args, **kwargs) Builds a C/C++ executable.

The task recognizes these source file types: .asm, .c, .cc, .cpp, .cxx, .h, .hh, .hpp, .hxx, .pch, .s, .S Other file types can be supported through additional rules, see the Rule class.

On Linux, GCC/Binutils is the default toolchain used. The default toolchain can be overridden by setting the environment variables AR, CC, CXX and LD. The prefered method is to assign these variables through the artifact of a special task that you depend on.

On Windows, Visual Studio is the default toolchain and it must be present in the PATH. Run Jolt from a developer command prompt.

Additionally, these environment variables can be used to customize toolchain behavior on any platform:

• ASFLAGS - compiler flags used for assembly code

• CFLAGS - compiler flags used for C code

• CXXFLAGS - compiler flags used for C++ code

• LDFLAGS - linker flags CXXProject.asflags = []

A list of compiler flags used when compiling assembler files.

CXXProject.binary = None

Name of the target binary (defaults to canonical task name) CXXProject.cflags = []

A list of compiler flags used when compiling C files.

CXXProject.cxxflags = []

A list of compiler flags used when compiling C++ files.

CXXProject.incpaths = []

List of preprocessor include paths CXXProject.incremental = True

Compile incrementally.

If incremental build is disabled, all intermediate files from a previous build will be removed before the execution begins.

CXXProject.ldflags = []

A list of linker flags to use.

CXXProject.libpaths = []

A list of library search paths used when linking.

CXXProject.libraries = []

A list of libraries to link with.

CXXProject.macros = []

List of preprocessor macros to set publishdir = 'bin/'

The artifact path where the binary is published.

CXXLibrary.publish(artifact, tools) Publishes the library.

By default, the library is collected into a directory as specified by the publishdir class attribute. Library path metadata for this directory as well as linking metadata is automatically exported. The relative path of the library within the artifact is also exported as a metadata string. It can be read by consumers by accessing artifact.strings.library.

Public headers listed in the headers class attribute are collected into a directory as specified by the publishapiclass attribute. Include path metadata for this directory is automatically exported.

CXXProject.run(deps, tools)

Generates a Ninja build file and invokes Ninja to build the project.

The build file and all intermediate files are written to a build directory within the workspace. By default, the directory persists between different invokations of Jolt to allow projects to be built incrementally. The behavior can be changed with the incremental class attribute.

CXXLibrary.selfsustained = False

Consume this library independently from its requirements.

When self-sustained, all static libraries listed as requirements are merged into the final library. Merging can also be achieved by listing libraries as source files.

See Task.selfsustained for general information.

CXXProject.shell(deps, tools) Invoked to start a debug shell.

The method prepares the environment with attributes exported by task requirement artifacts. The shell is entered by passing the -g flag to the build command.

For Ninja tasks, a special compile command is made available inside the shell. The command can be used to compile individual source files which is useful when troubleshooting compilation errors. Run compile -hfor help.

Task execution resumes normally when exiting the shell.

CXXProject.sources = []

A list of sources to compile.

Path names may contain simple shell-style wildcards such as ‘*’ and ‘?’. Note: files starting with a dot are not matched by these wildcards.

Example

sources = ["src/*.cpp"]

CXXProject.source_influence = True

Let the contents of source files influence the identity of the task artifact.

When True, a source file listed in the sources attribute will cause a rebuild of the task if modified.

Source influence can hurt performance since every files needs to be hashed. It is safe to set this flag to Falseif all source files reside in a git repository listed as a dependency with the requires attribute or if the task uses the git.influence decorator.

Always use source_influence if you are unsure whether it is needed or not.

7.16.2 CXXLibrary

class jolt.plugins.ninja.CXXLibrary(*args, **kwargs) Builds a C/C++ library.

The task recognizes these source file types: .asm, .c, .cc, .cpp, .cxx, .h, .hh, .hpp, .hxx, .pch, .s, .S Other file types can be supported through additional rules, see the Rule class.

On Linux, GCC/Binutils is the default toolchain used. The default toolchain can be overridden by setting the environment variables AR, CC, CXX and LD. The prefered method is to assign these variables through the artifact of a special task that you depend on.

On Windows, Visual Studio is the default toolchain and it must be present in the PATH. Run Jolt from a developer command prompt.

Additionally, these environment variables can be used to customize toolchain behavior on any platform:

• ASFLAGS - compiler flags used for assembly code

• CFLAGS - compiler flags used for C code

• CXXFLAGS - compiler flags used for C++ code

• LDFLAGS - linker flags CXXProject.asflags = []

A list of compiler flags used when compiling assembler files.

CXXProject.binary = None

Name of the target binary (defaults to canonical task name) CXXProject.cflags = []

A list of compiler flags used when compiling C files.

CXXProject.cxxflags = []

A list of compiler flags used when compiling C++ files.

headers = []

List of public headers to be published with the artifact CXXProject.incpaths = []

List of preprocessor include paths CXXProject.incremental = True

Compile incrementally.

If incremental build is disabled, all intermediate files from a previous build will be removed before the execution begins.

CXXProject.ldflags = []

A list of linker flags to use.

CXXProject.libpaths = []

A list of library search paths used when linking.

CXXProject.libraries = []

A list of libraries to link with.

CXXProject.macros = []

List of preprocessor macros to set CXXProject.run(deps, tools)

Generates a Ninja build file and invokes Ninja to build the project.

The build file and all intermediate files are written to a build directory within the workspace. By default, the directory persists between different invokations of Jolt to allow projects to be built incrementally. The behavior can be changed with the incremental class attribute.

publishapi = 'include/'

The artifact path where public headers are published.

publishdir = 'lib/'

The artifact path where the library is published.

publish(artifact, tools) Publishes the library.

By default, the library is collected into a directory as specified by the publishdir class attribute. Library path metadata for this directory as well as linking metadata is automatically exported. The relative path of the library within the artifact is also exported as a metadata string. It can be read by consumers by accessing artifact.strings.library.

Public headers listed in the headers class attribute are collected into a directory as specified by the publishapiclass attribute. Include path metadata for this directory is automatically exported.

selfsustained = False

Consume this library independently from its requirements.

When self-sustained, all static libraries listed as requirements are merged into the final library. Merging can also be achieved by listing libraries as source files.

See Task.selfsustained for general information.

CXXProject.shell(deps, tools) Invoked to start a debug shell.

The method prepares the environment with attributes exported by task requirement artifacts. The shell is entered by passing the -g flag to the build command.

For Ninja tasks, a special compile command is made available inside the shell. The command can be used to compile individual source files which is useful when troubleshooting compilation errors. Run compile -hfor help.

Task execution resumes normally when exiting the shell.

CXXProject.sources = []

A list of sources to compile.

Path names may contain simple shell-style wildcards such as ‘*’ and ‘?’. Note: files starting with a dot are not matched by these wildcards.

Example

sources = ["src/*.cpp"]

CXXProject.source_influence = True

Let the contents of source files influence the identity of the task artifact.

When True, a source file listed in the sources attribute will cause a rebuild of the task if modified.

Source influence can hurt performance since every files needs to be hashed. It is safe to set this flag to Falseif all source files reside in a git repository listed as a dependency with the requires attribute or if the task uses the git.influence decorator.

Always use source_influence if you are unsure whether it is needed or not.

7.16.3 Decorators

class jolt.plugins.ninja.attributes

static asflags(attrib, prepend=False)

Decorates a task with an alternative asflags attribute.

The new attribute will be concatenated with the regular asflags attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static cflags(attrib, prepend=False)

Decorates a task with an alternative cflags attribute.

The new attribute will be concatenated with the regular asflags attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static cxxflags(attrib, prepend=False)

Decorates a task with an alternative cxxflags attribute.

The new attribute will be concatenated with the regular cxxflags attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static incpaths(attrib, prepend=False)

Decorates a task with an alternative incpaths attribute.

The new attribute will be concatenated with the regular incpaths attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static ldflags(attrib, prepend=False)

Decorates a task with an alternative ldflags attribute.

The new attribute will be concatenated with the regular ldflags attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static libpaths(attrib, prepend=False)

Decorates a task with an alternative libpaths attribute.

The new attribute will be concatenated with the regular libpaths attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static libraries(attrib, prepend=False)

Decorates a task with an alternative libraries attribute.

The new attribute will be concatenated with the regular libraries attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static macros(attrib, prepend=False)

Decorates a task with an alternative macros attribute.

The new attribute will be concatenated with the regular macros attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

static sources(attrib, prepend=False)

Decorates a task with an alternative sources attribute.

The new attribute will be concatenated with the regular sources attribute.

Parameters

• attrib (str) – Name of alternative attribute. Keywords are expanded.

• prepend (boolean) – Prepend the value of the alternative attribute. Default: false (append).

7.16.4 Rule

class jolt.plugins.ninja.Rule(command=None, infiles=None, outfiles=None, depfile=None, deps=None, variables=None, implicit=None, order_only=None, aggregate=False)

A source transformation rule.

Rules are used to transform files from one type to another. An example is the rule that compiles a C/C++ file to an object file. Ninja tasks can be extended with additional rules beyond those already builtin and the builtin rules may also be overridden.

To define a new rule for a type of file, assign a Rule object to an arbitrary attribute of the compilation task being defined. Below is an example where a rule has been created to generate Qt moc source files from headers.

class MyQtProject(CXXExecutable):

moc_rule = Rule(

command="moc -o $out $in", infiles=[".h"],

outfiles=["{outdir}/{in_path}/{in_base}_moc.cpp"])

sources = ["myqtproject.h", "myqtproject.cpp"]

The moc rule will be run on all .h header files listed as sources, i.e. myqtproject.h. It takes the input header file and generates a corresponding moc source file, myqtproject_moc.cpp. The moc source file will then automatically be fed to the builtin compiler rule from which the output is an object file, myqtproject_moc.

o.

__init__(command=None, infiles=None, outfiles=None, depfile=None, deps=None, variables=None, implicit=None, order_only=None, aggregate=False)

Creates a new rule.

Parameters

• command (str, optional) – The command that will be execute by the rule. It can use any of the variables created below.

• infiles (str, optional) – A list of file extensions that the rule should apply to.

• outfiles (str, optional) – A list of files created by the rule. Regular keyword expansion is done on the strings but additional keywords are supported, see variables below.

• variables (str, optional) – A dictionary of variables that should be available to Ninja when running the command. By default, only $in and $out will be set, where $in is a single input file and $out is the output file(s). Regular keyword expansion is done on the value strings, seejolt.Tools.expand(). These additional keywords are supported:

– in_path - the path to the directory where the input file is located – in_base - the name of the input file, excluding file extension – in_ext - the input file extension

Example

Rule(command="echo $extension", variables={"extension": "{in_ext}

˓→"}, ...)

• aggregate (boolean, optional) – When this attribute is set, the Rule will aggre-gate all input files and transform them with a single command. This is useful, for example, when creating linking and archiving rules. In aggregating rules the $in Ninja variable ex-pands to all matched input files, while the outfiles / $out variable is expanded using the first input in the set, if the in_* keywords are used at all.

By default, a rule is applied once for each matched input file for improved parallelism.

Example

In this example, the rule concatenates all header files into a single precompiled header.

pch = Rule(

command="cat $in > $out", infiles=["*.h"],

outfiles=["{outdir}/all.pch"], aggregate=True)

Changelog

8.1 Version 0.9.10

• Significant startup performance improvements.

• A new config command has been added.

• A new HTTP plugin has been added. The older Artifactory plugin is now deprecated.

• When invoked without commands and arguments, Jolt now executes the default task if it exists.

j

jolt.influence,38

Symbols

__bool__()(jolt.BooleanParameter method),41 __getitem__()(jolt.BooleanParameter method),41 __getitem__()(jolt.Context method),36

__init__()(jolt.BooleanParameter method),41 __init__()(jolt.Parameter method),40,42 __init__()(jolt.plugins.ninja.Rule method),64 __str__()(jolt.BooleanParameter method),41 __str__()(jolt.Parameter method),40,43

A

acquire()(jolt.tasks.Resource method),43 Alias(class in jolt),33

always()(in module jolt.influence),38 append_file()(jolt.Tools method),47 archive()(jolt.Tools method),47 Artifact(class in jolt),33

asflags(jolt.plugins.ninja.CXXExecutable.CXXProject

attribute()(in module jolt.influence),38 attributes(class in jolt),36

attributes(class in jolt.plugins.ninja),62 autotools()(jolt.Tools method),47

BooleanParameter(class in jolt),41 builddir()(jolt.Tools method),47

Conan(class in jolt.plugins.conan),55

conanfile(jolt.plugins.conan.Conan attribute),56 Context(class in jolt),36

context (jolt.plugins.docker.DockerImage attribute),

CXXExecutable(class in jolt.plugins.ninja),58

cxxflags(jolt.plugins.ninja.CXXExecutable.CXXProject

CXXLibrary(class in jolt.plugins.ninja),60

D

daily()(in module jolt.influence),38

dockerfile (jolt.plugins.docker.DockerImage at-tribute),57

DockerImage(class in jolt.plugins.docker),57 Download(class in jolt.tasks),37

download()(jolt.Tools method),49

E

environ(jolt.Artifact attribute),35 environ()(in module jolt.influence),38 environ()(jolt.Tools method),49 files()(in module jolt.influence),38 final_path(jolt.Artifact attribute),35

G

generators(jolt.plugins.conan.Conan attribute),56 get_default()(jolt.BooleanParameter method),41 get_default()(jolt.Parameter method),40,43 get_value()(jolt.BooleanParameter method),42 get_value()(jolt.Parameter method),40,43 getcwd()(jolt.Tools method),51

getenv()(jolt.Tools method),51 glob()(jolt.Tools method),51

H

headers(jolt.plugins.ninja.CXXLibrary attribute),60 hourly()(in module jolt.influence),39

I

is_default()(jolt.Parameter method),40,43 is_false(jolt.BooleanParameter attribute),42 is_set()(jolt.BooleanParameter method),42 is_set()(jolt.Parameter method),40,43 is_true(jolt.BooleanParameter attribute),42 is_unset()(jolt.BooleanParameter method),42 is_unset()(jolt.Parameter method),40,43

items()(jolt.Context method),36

monthly()(in module jolt.influence),39

N

Parameter(class in jolt),40,42

path(jolt.Artifact attribute),35

publish()(jolt.plugins.ninja.CXXExecutable.CXXLibrary method),58

publish()(jolt.plugins.ninja.CXXLibrary method),61 publish()(jolt.tasks.Task method),45

publishapi(jolt.plugins.ninja.CXXLibrary attribute), requires()(jolt.attributes static method),36 Resource(class in jolt.tasks),43

rmtree()(jolt.Tools method),52 rsync()(jolt.Tools method),52 Rule(class in jolt.plugins.ninja),63

run() (jolt.plugins.ninja.CXXExecutable.CXXProject set_value()(jolt.Parameter method),40,43 setenv()(jolt.Tools method),54

system()(jolt.attributes static method),36

T

tag(jolt.plugins.docker.DockerImage attribute),57 Task(class in jolt.tasks),44

Test(class in jolt.tasks),46

thread_count()(jolt.Tools method),54 tmpdir()(jolt.Tools method),54

Tools(class in jolt),46

U

weekly()(in module jolt.influence),39 which()(jolt.Tools method),55 write_file()(jolt.Tools method),55

Y

yearly()(in module jolt.influence),39

Related documents