jolt 0.9.76__py3-none-any.whl → 0.9.429__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jolt/__init__.py +88 -7
- jolt/__main__.py +9 -1
- jolt/bin/fstree-darwin-x86_64 +0 -0
- jolt/bin/fstree-linux-x86_64 +0 -0
- jolt/cache.py +839 -367
- jolt/chroot.py +156 -0
- jolt/cli.py +362 -143
- jolt/common_pb2.py +63 -0
- jolt/common_pb2_grpc.py +4 -0
- jolt/config.py +99 -42
- jolt/error.py +19 -4
- jolt/expires.py +2 -2
- jolt/filesystem.py +8 -6
- jolt/graph.py +705 -117
- jolt/hooks.py +63 -1
- jolt/influence.py +129 -6
- jolt/loader.py +369 -121
- jolt/log.py +225 -63
- jolt/manifest.py +28 -38
- jolt/options.py +35 -10
- jolt/pkgs/abseil.py +42 -0
- jolt/pkgs/asio.py +25 -0
- jolt/pkgs/autoconf.py +41 -0
- jolt/pkgs/automake.py +41 -0
- jolt/pkgs/b2.py +31 -0
- jolt/pkgs/boost.py +111 -0
- jolt/pkgs/boringssl.py +32 -0
- jolt/pkgs/busybox.py +39 -0
- jolt/pkgs/bzip2.py +43 -0
- jolt/pkgs/cares.py +29 -0
- jolt/pkgs/catch2.py +36 -0
- jolt/pkgs/cbindgen.py +17 -0
- jolt/pkgs/cista.py +19 -0
- jolt/pkgs/clang.py +44 -0
- jolt/pkgs/cli11.py +23 -0
- jolt/pkgs/cmake.py +48 -0
- jolt/pkgs/cpython.py +196 -0
- jolt/pkgs/crun.py +29 -0
- jolt/pkgs/curl.py +38 -0
- jolt/pkgs/dbus.py +18 -0
- jolt/pkgs/double_conversion.py +24 -0
- jolt/pkgs/fastfloat.py +21 -0
- jolt/pkgs/ffmpeg.py +28 -0
- jolt/pkgs/flatbuffers.py +29 -0
- jolt/pkgs/fmt.py +27 -0
- jolt/pkgs/fstree.py +20 -0
- jolt/pkgs/gflags.py +18 -0
- jolt/pkgs/glib.py +18 -0
- jolt/pkgs/glog.py +25 -0
- jolt/pkgs/glslang.py +21 -0
- jolt/pkgs/golang.py +16 -11
- jolt/pkgs/googlebenchmark.py +18 -0
- jolt/pkgs/googletest.py +46 -0
- jolt/pkgs/gperf.py +15 -0
- jolt/pkgs/grpc.py +73 -0
- jolt/pkgs/hdf5.py +19 -0
- jolt/pkgs/help2man.py +14 -0
- jolt/pkgs/inja.py +28 -0
- jolt/pkgs/jsoncpp.py +31 -0
- jolt/pkgs/libarchive.py +43 -0
- jolt/pkgs/libcap.py +44 -0
- jolt/pkgs/libdrm.py +44 -0
- jolt/pkgs/libedit.py +42 -0
- jolt/pkgs/libevent.py +31 -0
- jolt/pkgs/libexpat.py +27 -0
- jolt/pkgs/libfastjson.py +21 -0
- jolt/pkgs/libffi.py +16 -0
- jolt/pkgs/libglvnd.py +30 -0
- jolt/pkgs/libogg.py +28 -0
- jolt/pkgs/libpciaccess.py +18 -0
- jolt/pkgs/libseccomp.py +21 -0
- jolt/pkgs/libtirpc.py +24 -0
- jolt/pkgs/libtool.py +42 -0
- jolt/pkgs/libunwind.py +35 -0
- jolt/pkgs/libva.py +18 -0
- jolt/pkgs/libvorbis.py +33 -0
- jolt/pkgs/libxml2.py +35 -0
- jolt/pkgs/libxslt.py +17 -0
- jolt/pkgs/libyajl.py +16 -0
- jolt/pkgs/llvm.py +81 -0
- jolt/pkgs/lua.py +54 -0
- jolt/pkgs/lz4.py +26 -0
- jolt/pkgs/m4.py +14 -0
- jolt/pkgs/make.py +17 -0
- jolt/pkgs/mesa.py +81 -0
- jolt/pkgs/meson.py +17 -0
- jolt/pkgs/mstch.py +28 -0
- jolt/pkgs/mysql.py +60 -0
- jolt/pkgs/nasm.py +49 -0
- jolt/pkgs/ncurses.py +30 -0
- jolt/pkgs/ng_log.py +25 -0
- jolt/pkgs/ninja.py +45 -0
- jolt/pkgs/nlohmann_json.py +25 -0
- jolt/pkgs/nodejs.py +19 -11
- jolt/pkgs/opencv.py +24 -0
- jolt/pkgs/openjdk.py +26 -0
- jolt/pkgs/openssl.py +103 -0
- jolt/pkgs/paho.py +76 -0
- jolt/pkgs/patchelf.py +16 -0
- jolt/pkgs/perl.py +42 -0
- jolt/pkgs/pkgconfig.py +64 -0
- jolt/pkgs/poco.py +39 -0
- jolt/pkgs/protobuf.py +77 -0
- jolt/pkgs/pugixml.py +27 -0
- jolt/pkgs/python.py +19 -0
- jolt/pkgs/qt.py +35 -0
- jolt/pkgs/rapidjson.py +26 -0
- jolt/pkgs/rapidyaml.py +28 -0
- jolt/pkgs/re2.py +30 -0
- jolt/pkgs/re2c.py +17 -0
- jolt/pkgs/readline.py +15 -0
- jolt/pkgs/rust.py +41 -0
- jolt/pkgs/sdl.py +28 -0
- jolt/pkgs/simdjson.py +27 -0
- jolt/pkgs/soci.py +46 -0
- jolt/pkgs/spdlog.py +29 -0
- jolt/pkgs/spirv_llvm.py +21 -0
- jolt/pkgs/spirv_tools.py +24 -0
- jolt/pkgs/sqlite.py +83 -0
- jolt/pkgs/ssl.py +12 -0
- jolt/pkgs/texinfo.py +15 -0
- jolt/pkgs/tomlplusplus.py +22 -0
- jolt/pkgs/wayland.py +26 -0
- jolt/pkgs/x11.py +58 -0
- jolt/pkgs/xerces_c.py +20 -0
- jolt/pkgs/xorg.py +360 -0
- jolt/pkgs/xz.py +29 -0
- jolt/pkgs/yamlcpp.py +30 -0
- jolt/pkgs/zeromq.py +47 -0
- jolt/pkgs/zlib.py +69 -0
- jolt/pkgs/zstd.py +33 -0
- jolt/plugins/alias.py +3 -0
- jolt/plugins/allure.py +5 -2
- jolt/plugins/autotools.py +66 -0
- jolt/plugins/cache.py +133 -0
- jolt/plugins/cmake.py +74 -6
- jolt/plugins/conan.py +238 -0
- jolt/plugins/cxx.py +698 -0
- jolt/plugins/cxxinfo.py +7 -0
- jolt/plugins/dashboard.py +1 -1
- jolt/plugins/docker.py +91 -23
- jolt/plugins/email.py +5 -2
- jolt/plugins/email.xslt +144 -101
- jolt/plugins/environ.py +11 -0
- jolt/plugins/fetch.py +141 -0
- jolt/plugins/gdb.py +44 -21
- jolt/plugins/gerrit.py +1 -14
- jolt/plugins/git.py +316 -101
- jolt/plugins/googletest.py +522 -1
- jolt/plugins/http.py +36 -38
- jolt/plugins/libtool.py +63 -0
- jolt/plugins/linux.py +990 -0
- jolt/plugins/logstash.py +4 -4
- jolt/plugins/meson.py +61 -0
- jolt/plugins/ninja-compdb.py +107 -31
- jolt/plugins/ninja.py +929 -134
- jolt/plugins/paths.py +11 -1
- jolt/plugins/pkgconfig.py +219 -0
- jolt/plugins/podman.py +148 -91
- jolt/plugins/python.py +137 -0
- jolt/plugins/remote_execution/__init__.py +0 -0
- jolt/plugins/remote_execution/administration_pb2.py +46 -0
- jolt/plugins/remote_execution/administration_pb2_grpc.py +170 -0
- jolt/plugins/remote_execution/log_pb2.py +32 -0
- jolt/plugins/remote_execution/log_pb2_grpc.py +68 -0
- jolt/plugins/remote_execution/scheduler_pb2.py +41 -0
- jolt/plugins/remote_execution/scheduler_pb2_grpc.py +141 -0
- jolt/plugins/remote_execution/worker_pb2.py +38 -0
- jolt/plugins/remote_execution/worker_pb2_grpc.py +112 -0
- jolt/plugins/report.py +12 -2
- jolt/plugins/rust.py +25 -0
- jolt/plugins/scheduler.py +710 -0
- jolt/plugins/selfdeploy/setup.py +9 -4
- jolt/plugins/selfdeploy.py +138 -88
- jolt/plugins/strings.py +35 -22
- jolt/plugins/symlinks.py +26 -11
- jolt/plugins/telemetry.py +5 -2
- jolt/plugins/timeline.py +13 -3
- jolt/plugins/volume.py +46 -48
- jolt/scheduler.py +591 -191
- jolt/tasks.py +1783 -245
- jolt/templates/export.sh.template +12 -6
- jolt/templates/timeline.html.template +44 -47
- jolt/timer.py +22 -0
- jolt/tools.py +749 -302
- jolt/utils.py +245 -18
- jolt/version.py +1 -1
- jolt/version_utils.py +2 -2
- jolt/xmldom.py +12 -2
- {jolt-0.9.76.dist-info → jolt-0.9.429.dist-info}/METADATA +98 -38
- jolt-0.9.429.dist-info/RECORD +207 -0
- {jolt-0.9.76.dist-info → jolt-0.9.429.dist-info}/WHEEL +1 -1
- jolt/plugins/amqp.py +0 -834
- jolt/plugins/debian.py +0 -338
- jolt/plugins/ftp.py +0 -181
- jolt/plugins/ninja-cache.py +0 -64
- jolt/plugins/ninjacli.py +0 -271
- jolt/plugins/repo.py +0 -253
- jolt-0.9.76.dist-info/RECORD +0 -79
- {jolt-0.9.76.dist-info → jolt-0.9.429.dist-info}/entry_points.txt +0 -0
- {jolt-0.9.76.dist-info → jolt-0.9.429.dist-info}/top_level.txt +0 -0
jolt/plugins/cache.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from requests.exceptions import ConnectTimeout, RequestException
|
|
2
|
+
from urllib.parse import urlparse, urlunparse
|
|
3
|
+
|
|
4
|
+
from jolt import utils
|
|
5
|
+
from jolt import cache
|
|
6
|
+
from jolt import log
|
|
7
|
+
from jolt import config
|
|
8
|
+
from jolt import filesystem as fs
|
|
9
|
+
from jolt import tools
|
|
10
|
+
from jolt.error import raise_error_if, JoltError
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
NAME = "cache"
|
|
14
|
+
NAME_LOG = "Cache Service"
|
|
15
|
+
TIMEOUT = (3.5, 27)
|
|
16
|
+
TIMEOUT_HEAD = (27, 27)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Cache(cache.StorageProvider):
|
|
20
|
+
def __init__(self, cache):
|
|
21
|
+
super().__init__()
|
|
22
|
+
self._cache = cache
|
|
23
|
+
self._uri = config.get(NAME, "uri", "http://cache")
|
|
24
|
+
self._uri = self._uri.rstrip("/")
|
|
25
|
+
raise_error_if(not self._uri, "Cache Service URI not configured")
|
|
26
|
+
self._file_uri = self._uri + "/files"
|
|
27
|
+
self._upload = config.getboolean(NAME, "upload", True)
|
|
28
|
+
self._download = config.getboolean(NAME, "download", True)
|
|
29
|
+
self._disabled = False
|
|
30
|
+
|
|
31
|
+
def _get_path(self, artifact):
|
|
32
|
+
return artifact.tools.expand(
|
|
33
|
+
"{name}/{file}",
|
|
34
|
+
name=artifact.task.name,
|
|
35
|
+
file=fs.path.basename(artifact.get_archive_path()))
|
|
36
|
+
|
|
37
|
+
def _get_url(self, artifact):
|
|
38
|
+
return artifact.tools.expand(
|
|
39
|
+
"{uri}/{name}/{file}",
|
|
40
|
+
uri=self._file_uri,
|
|
41
|
+
name=artifact.task.name,
|
|
42
|
+
file=fs.path.basename(artifact.get_archive_path()))
|
|
43
|
+
|
|
44
|
+
@utils.retried.on_exception((RequestException, JoltError))
|
|
45
|
+
def download(self, artifact, force=False):
|
|
46
|
+
if self._disabled:
|
|
47
|
+
return False
|
|
48
|
+
if not self._download and not force:
|
|
49
|
+
return False
|
|
50
|
+
url = self._get_url(artifact)
|
|
51
|
+
return artifact.tools.download(
|
|
52
|
+
url,
|
|
53
|
+
artifact.get_archive_path(),
|
|
54
|
+
exceptions=False,
|
|
55
|
+
timeout=TIMEOUT)
|
|
56
|
+
|
|
57
|
+
def download_enabled(self):
|
|
58
|
+
return not self._disabled and self._download
|
|
59
|
+
|
|
60
|
+
@utils.retried.on_exception((RequestException))
|
|
61
|
+
def upload(self, artifact, force=False):
|
|
62
|
+
if self._disabled:
|
|
63
|
+
return True
|
|
64
|
+
if not self._upload and not force:
|
|
65
|
+
return True
|
|
66
|
+
url = self._get_url(artifact)
|
|
67
|
+
archive = artifact.get_archive()
|
|
68
|
+
return artifact.tools.upload(
|
|
69
|
+
archive, url,
|
|
70
|
+
exceptions=False,
|
|
71
|
+
timeout=TIMEOUT)
|
|
72
|
+
|
|
73
|
+
def upload_enabled(self):
|
|
74
|
+
return not self._disabled and self._upload
|
|
75
|
+
|
|
76
|
+
@utils.retried.on_exception((RequestException))
|
|
77
|
+
def availability(self, artifacts):
|
|
78
|
+
if self._disabled:
|
|
79
|
+
return [], artifacts
|
|
80
|
+
|
|
81
|
+
file_map = {self._get_path(artifact): artifact for artifact in artifacts}
|
|
82
|
+
try:
|
|
83
|
+
data = {"files": list(file_map.keys())}
|
|
84
|
+
response = tools.http_session.post(self._file_uri, json=data, stream=True, timeout=TIMEOUT_HEAD)
|
|
85
|
+
except ConnectTimeout:
|
|
86
|
+
self._disabled = True
|
|
87
|
+
log.warning(NAME_LOG + " failed to establish server connection, disabled")
|
|
88
|
+
return [], []
|
|
89
|
+
|
|
90
|
+
if response.status_code != 200:
|
|
91
|
+
log.debug(NAME_LOG + " POST ({}): {}", response.status_code, self._file_uri)
|
|
92
|
+
return [], artifacts
|
|
93
|
+
|
|
94
|
+
present = []
|
|
95
|
+
missing = []
|
|
96
|
+
data = response.json()
|
|
97
|
+
|
|
98
|
+
for file in data.get("present", []):
|
|
99
|
+
present.append(file_map[file])
|
|
100
|
+
|
|
101
|
+
for file in data.get("missing", []):
|
|
102
|
+
missing.append(file_map[file])
|
|
103
|
+
|
|
104
|
+
return present, missing
|
|
105
|
+
|
|
106
|
+
@utils.retried.on_exception((RequestException))
|
|
107
|
+
def location(self, artifact):
|
|
108
|
+
if self._disabled:
|
|
109
|
+
return False
|
|
110
|
+
|
|
111
|
+
url = self._get_url(artifact)
|
|
112
|
+
try:
|
|
113
|
+
response = tools.http_session.head(url, stream=True, timeout=TIMEOUT_HEAD)
|
|
114
|
+
|
|
115
|
+
except ConnectTimeout:
|
|
116
|
+
self._disabled = True
|
|
117
|
+
log.warning(NAME_LOG + " failed to establish server connection, disabled")
|
|
118
|
+
return False
|
|
119
|
+
|
|
120
|
+
if response.status_code != 200:
|
|
121
|
+
log.debug(NAME_LOG + " HEAD ({}): {}", response.status_code, url)
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
url = urlunparse(urlparse(url))
|
|
125
|
+
return url
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@cache.RegisterStorage
|
|
129
|
+
class HttpFactory(cache.StorageProviderFactory):
|
|
130
|
+
@staticmethod
|
|
131
|
+
def create(cache):
|
|
132
|
+
log.verbose(NAME_LOG + " Loaded")
|
|
133
|
+
return Cache(cache)
|
jolt/plugins/cmake.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from jolt import attributes
|
|
1
2
|
from jolt import influence
|
|
2
3
|
from jolt import Task
|
|
3
4
|
from jolt import utils
|
|
@@ -6,31 +7,98 @@ from jolt.error import raise_task_error_if
|
|
|
6
7
|
import os
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
def options(attrib):
|
|
11
|
+
"""
|
|
12
|
+
Decorates a CMake task with an alternative ``options`` attribute.
|
|
13
|
+
|
|
14
|
+
The new attribute will be concatenated with the regular
|
|
15
|
+
``options`` attribute.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
attrib (str): Name of alternative attribute.
|
|
19
|
+
Keywords are expanded.
|
|
20
|
+
"""
|
|
21
|
+
return utils.concat_attributes("options", attrib)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def requires(version=None):
|
|
25
|
+
""" Decorator to add CMake requirements to a task. """
|
|
26
|
+
|
|
27
|
+
import jolt.pkgs.cmake
|
|
28
|
+
|
|
29
|
+
def decorate(cls):
|
|
30
|
+
cls = attributes.requires("requires_cmake")(cls)
|
|
31
|
+
cls.requires_cmake = ["cmake" + (f":version={version}" if version else "")]
|
|
32
|
+
return cls
|
|
33
|
+
|
|
34
|
+
return decorate
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def use_ninja():
|
|
38
|
+
"""
|
|
39
|
+
Decorator to add Ninja dependencies to CMake task.
|
|
40
|
+
|
|
41
|
+
It also selects Ninja as the CMake generator and builder.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
import jolt.pkgs.ninja
|
|
45
|
+
|
|
46
|
+
def decorate(cls):
|
|
47
|
+
cls = attributes.requires("requires_ninja")(cls)
|
|
48
|
+
cls.generator = "Ninja"
|
|
49
|
+
cls.requires_ninja = ["ninja"]
|
|
50
|
+
return cls
|
|
51
|
+
|
|
52
|
+
return decorate
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@attributes.common_metadata()
|
|
56
|
+
@options("options")
|
|
9
57
|
class CMake(Task):
|
|
10
58
|
""" Builds and publishes a CMake project """
|
|
11
|
-
|
|
12
59
|
abstract = True
|
|
13
60
|
|
|
14
61
|
cmakelists = "CMakeLists.txt"
|
|
15
62
|
""" Path to CMakeLists.txt or directory containing CMakelists.txt """
|
|
16
63
|
|
|
64
|
+
config = "Release"
|
|
65
|
+
""" The default build configuration to use """
|
|
66
|
+
|
|
17
67
|
generator = None
|
|
68
|
+
""" The build file generator that CMake should use """
|
|
18
69
|
|
|
19
70
|
incremental = True
|
|
71
|
+
""" Keep build directories between Jolt invocations """
|
|
20
72
|
|
|
21
73
|
options = []
|
|
22
74
|
""" List of options and their values (``option[:type]=value``) """
|
|
23
75
|
|
|
76
|
+
srcdir = None
|
|
77
|
+
""" Source directory. If not specified, the task working directory is used. """
|
|
78
|
+
|
|
79
|
+
install = ["install"]
|
|
80
|
+
""" List of install build targets. If empty, the default install target is used. """
|
|
81
|
+
|
|
82
|
+
def clean(self, tools):
|
|
83
|
+
cmake = tools.cmake(incremental=self.incremental)
|
|
84
|
+
cmake.clean()
|
|
85
|
+
|
|
24
86
|
def run(self, deps, tools):
|
|
87
|
+
self.deps = deps
|
|
25
88
|
raise_task_error_if(not self.cmakelists, self, "cmakelists attribute has not been defined")
|
|
26
89
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
90
|
+
config = tools.expand(str(self.config))
|
|
91
|
+
options = self._options()
|
|
92
|
+
options += ["CMAKE_BUILD_TYPE=" + config]
|
|
93
|
+
|
|
94
|
+
with tools.cwd(self.srcdir or self.joltdir):
|
|
95
|
+
cmake = tools.cmake(deps, incremental=self.incremental)
|
|
96
|
+
cmake.configure(tools.expand(self.cmakelists), *["-D" + tools.expand(option) for option in options], generator=self.generator)
|
|
97
|
+
for target in self.install or ["install"]:
|
|
98
|
+
cmake.install(config=config, target=target)
|
|
31
99
|
|
|
32
100
|
def publish(self, artifact, tools):
|
|
33
|
-
cmake = tools.cmake()
|
|
101
|
+
cmake = tools.cmake(incremental=self.incremental)
|
|
34
102
|
cmake.publish(artifact)
|
|
35
103
|
|
|
36
104
|
|
jolt/plugins/conan.py
CHANGED
|
@@ -3,6 +3,7 @@ from os import path
|
|
|
3
3
|
|
|
4
4
|
from jolt import Task
|
|
5
5
|
from jolt import influence
|
|
6
|
+
from jolt import utils
|
|
6
7
|
from jolt.error import raise_task_error_if
|
|
7
8
|
|
|
8
9
|
|
|
@@ -239,3 +240,240 @@ class Conan(Task):
|
|
|
239
240
|
artifact.cxxinfo.cflags.append(dep["cflags"])
|
|
240
241
|
artifact.cxxinfo.cxxflags.append(dep["cxxflags"])
|
|
241
242
|
artifact.cxxinfo.ldflags.append(dep["exelinkflags"])
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@influence.attribute("conanfile")
|
|
246
|
+
@influence.attribute("generators")
|
|
247
|
+
@influence.attribute("incremental")
|
|
248
|
+
@influence.attribute("options")
|
|
249
|
+
@influence.attribute("packages")
|
|
250
|
+
class Conan2(Task):
|
|
251
|
+
"""
|
|
252
|
+
Conan package installer task.
|
|
253
|
+
|
|
254
|
+
This task base class can be used to fetch, build and publish Conan packages
|
|
255
|
+
as Jolt artifacts. All package metadata is transfered from the Conan package
|
|
256
|
+
manifest to the Jolt artifact so that no manual configuration of include
|
|
257
|
+
paths, library paths, macros, etc is required.
|
|
258
|
+
|
|
259
|
+
An existing installation of Conan is required. Please visit https://conan.io/
|
|
260
|
+
for installation instructions and documentation.
|
|
261
|
+
|
|
262
|
+
A minimal task to download and publish the Boost C++ libraries can look like this:
|
|
263
|
+
|
|
264
|
+
.. code-block:: python
|
|
265
|
+
|
|
266
|
+
from jolt.plugins.conan import Conan
|
|
267
|
+
|
|
268
|
+
class Boost(Conan):
|
|
269
|
+
packages = ["boost/1.74.0"]
|
|
270
|
+
|
|
271
|
+
Boost may then be used from Ninja tasks by declaring a requirement:
|
|
272
|
+
|
|
273
|
+
.. code-block:: python
|
|
274
|
+
|
|
275
|
+
from jolt.plugins.ninja import CXXExecutable
|
|
276
|
+
|
|
277
|
+
class BoostApplication(CXXExecutable):
|
|
278
|
+
requires = ["boost"]
|
|
279
|
+
sources = ["main.cpp"]
|
|
280
|
+
|
|
281
|
+
The task supports using an existing conanfile.txt, but it is not required.
|
|
282
|
+
Packages are installed into and collected from Jolt build directories. The
|
|
283
|
+
user's regular Conan cache will not be affected.
|
|
284
|
+
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
abstract = True
|
|
288
|
+
|
|
289
|
+
conanfile = None
|
|
290
|
+
"""
|
|
291
|
+
An existing conanfile.txt file to use.
|
|
292
|
+
|
|
293
|
+
Instead of generating the conanfile.txt file on-demand, an external
|
|
294
|
+
file may be used. If this attribute is set, the ``generators``, ``options``
|
|
295
|
+
and ``packages`` attributes must not be set.
|
|
296
|
+
|
|
297
|
+
See Conan documentation for further details.
|
|
298
|
+
"""
|
|
299
|
+
|
|
300
|
+
packages = []
|
|
301
|
+
"""
|
|
302
|
+
A list of Conan package references to collect and publish.
|
|
303
|
+
|
|
304
|
+
The reference format is ``PkgName/<version>@user/channel``. See Conan
|
|
305
|
+
documentation for further details.
|
|
306
|
+
|
|
307
|
+
Any {keyword} arguments, or macros, found in the strings are automatically
|
|
308
|
+
expanded to the value of the associated task's parameters and properties.
|
|
309
|
+
|
|
310
|
+
Example:
|
|
311
|
+
|
|
312
|
+
.. code-block:: python
|
|
313
|
+
|
|
314
|
+
sdl_version = Parameter("2.0.12")
|
|
315
|
+
|
|
316
|
+
packages = [
|
|
317
|
+
"boost/1.74.0",
|
|
318
|
+
"sdl2/{sdl_version}@bincrafters/stable",
|
|
319
|
+
]
|
|
320
|
+
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
options = []
|
|
324
|
+
"""
|
|
325
|
+
A list of Conan package options to apply
|
|
326
|
+
|
|
327
|
+
The option format is ``PkgName:Option=Value``. See Conan
|
|
328
|
+
documentation for further details.
|
|
329
|
+
|
|
330
|
+
Any {keyword} arguments, or macros, found in the strings are automatically
|
|
331
|
+
expanded to the value of the associated task's parameters and properties.
|
|
332
|
+
|
|
333
|
+
Example:
|
|
334
|
+
|
|
335
|
+
.. code-block:: python
|
|
336
|
+
|
|
337
|
+
options = [
|
|
338
|
+
"boost:shared=True",
|
|
339
|
+
"zlib:shared=True",
|
|
340
|
+
]
|
|
341
|
+
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
settings = []
|
|
345
|
+
"""
|
|
346
|
+
A list of Conan settings to apply
|
|
347
|
+
|
|
348
|
+
The settings format is ``Option=Value``. See Conan
|
|
349
|
+
documentation for further details.
|
|
350
|
+
|
|
351
|
+
Any {keyword} arguments, or macros, found in the strings are automatically
|
|
352
|
+
expanded to the value of the associated task's parameters and properties.
|
|
353
|
+
|
|
354
|
+
Example:
|
|
355
|
+
|
|
356
|
+
.. code-block:: python
|
|
357
|
+
|
|
358
|
+
settings = [
|
|
359
|
+
"compiler.libcxx=libstdc++11",
|
|
360
|
+
]
|
|
361
|
+
|
|
362
|
+
"""
|
|
363
|
+
|
|
364
|
+
remotes = {}
|
|
365
|
+
"""
|
|
366
|
+
A dictionary with Conan remotes to use when fetching packages.
|
|
367
|
+
|
|
368
|
+
The dictionary key is the name of remote and its value is the URL.
|
|
369
|
+
|
|
370
|
+
Example:
|
|
371
|
+
|
|
372
|
+
.. code-block:: python
|
|
373
|
+
|
|
374
|
+
remotes = {
|
|
375
|
+
"bincrafters": "https://api.bintray.com/conan/bincrafters/public-conan"
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
"""
|
|
379
|
+
|
|
380
|
+
incremental = True
|
|
381
|
+
"""
|
|
382
|
+
Keep installed packages in the Conan cache between Jolt invokations.
|
|
383
|
+
|
|
384
|
+
If incremental build is disabled, the Jolt Conan cache is removed
|
|
385
|
+
before execution begins.
|
|
386
|
+
"""
|
|
387
|
+
|
|
388
|
+
def __init__(self, *args, **kwargs):
|
|
389
|
+
super().__init__(*args, **kwargs)
|
|
390
|
+
if self.conanfile:
|
|
391
|
+
self.influence.append(influence.FileInfluence(self.conanfile))
|
|
392
|
+
|
|
393
|
+
def _options(self):
|
|
394
|
+
return [] + self.options
|
|
395
|
+
|
|
396
|
+
def _settings(self):
|
|
397
|
+
return [] + self.settings
|
|
398
|
+
|
|
399
|
+
def _packages(self):
|
|
400
|
+
return [] + self.packages
|
|
401
|
+
|
|
402
|
+
def _remotes(self):
|
|
403
|
+
return self.remotes
|
|
404
|
+
|
|
405
|
+
def run(self, deps, tools):
|
|
406
|
+
raise_task_error_if(
|
|
407
|
+
not tools.which("conan"), self,
|
|
408
|
+
"Conan: Conan is not installed in the PATH")
|
|
409
|
+
raise_task_error_if(
|
|
410
|
+
self.conanfile and (self._packages() or self._options()), self,
|
|
411
|
+
"Conan: 'conanfile' attribute cannot be used with other attributes")
|
|
412
|
+
|
|
413
|
+
conanfile = tools.expand_path(self.conanfile) if self.conanfile else None
|
|
414
|
+
|
|
415
|
+
with tools.cwd(tools.builddir()):
|
|
416
|
+
if conanfile is None or not path.exists(conanfile):
|
|
417
|
+
conanfile = "conanfile.txt"
|
|
418
|
+
self.info("Creating conanfile.txt")
|
|
419
|
+
self.tools.write_file(conanfile, "[requires]\n")
|
|
420
|
+
for pkg in self._packages():
|
|
421
|
+
self.tools.append_file(conanfile, pkg + "\n")
|
|
422
|
+
|
|
423
|
+
with tools.environ(CONAN_USER_HOME=tools.builddir("conan", incremental=self.incremental)):
|
|
424
|
+
for remote, url in self._remotes().items():
|
|
425
|
+
self.info("Registering remote '{}'", remote)
|
|
426
|
+
tools.run("conan remote add -f {} {}", remote, url, output_on_error=True)
|
|
427
|
+
|
|
428
|
+
self.info("Installing packages into the Conan cache")
|
|
429
|
+
options = " ".join(["-o " + opt for opt in self._options()])
|
|
430
|
+
settings = " ".join(["-s " + opt for opt in self._settings()])
|
|
431
|
+
output = tools.run("conan install --build=missing --output-folder . -u --format=json {} {} {}", options, settings, conanfile, output_stdout=False)
|
|
432
|
+
|
|
433
|
+
self.info("Parsing manifest")
|
|
434
|
+
self._manifest = json.loads(output)
|
|
435
|
+
|
|
436
|
+
for dep in self._manifest["graph"]["nodes"].values():
|
|
437
|
+
if dep["package_folder"]:
|
|
438
|
+
self.info("Collecting '{}' files from: {}", dep["name"], dep["package_folder"])
|
|
439
|
+
tools.copy(dep["package_folder"], dep["name"])
|
|
440
|
+
|
|
441
|
+
def publish(self, artifact, tools):
|
|
442
|
+
self.info("Publishing package files")
|
|
443
|
+
with tools.cwd(tools.builddir()):
|
|
444
|
+
artifact.collect("*")
|
|
445
|
+
|
|
446
|
+
self.info("Publishing metadata")
|
|
447
|
+
for dep in self._manifest["graph"]["nodes"].values():
|
|
448
|
+
if not dep["package_folder"]:
|
|
449
|
+
continue
|
|
450
|
+
|
|
451
|
+
for node in dep["cpp_info"]:
|
|
452
|
+
for incpath in dep["cpp_info"][node]["includedirs"]:
|
|
453
|
+
artifact.cxxinfo.incpaths.append(path.join(dep["name"], path.relpath(incpath, dep["package_folder"])))
|
|
454
|
+
for libpath in dep["cpp_info"][node]["libdirs"]:
|
|
455
|
+
artifact.cxxinfo.libpaths.append(path.join(dep["name"], path.relpath(libpath, dep["package_folder"])))
|
|
456
|
+
for binpath in dep["cpp_info"][node]["bindirs"]:
|
|
457
|
+
artifact.environ.PATH.append(path.join(dep["name"], path.relpath(binpath, dep["package_folder"])))
|
|
458
|
+
if dep["cpp_info"][node]["libs"]:
|
|
459
|
+
artifact.cxxinfo.libraries.extend(dep["cpp_info"][node]["libs"])
|
|
460
|
+
if dep["cpp_info"][node]["system_libs"]:
|
|
461
|
+
artifact.cxxinfo.libraries.extend(dep["cpp_info"][node]["system_libs"])
|
|
462
|
+
if dep["cpp_info"][node]["defines"]:
|
|
463
|
+
artifact.cxxinfo.macros.extend(dep["cpp_info"][node]["defines"])
|
|
464
|
+
if dep["cpp_info"][node]["cflags"]:
|
|
465
|
+
artifact.cxxinfo.cflags.extend(dep["cpp_info"][node]["cflags"])
|
|
466
|
+
if dep["cpp_info"][node]["cxxflags"]:
|
|
467
|
+
artifact.cxxinfo.cxxflags.extend(dep["cpp_info"][node]["cxxflags"])
|
|
468
|
+
if dep["cpp_info"][node]["exelinkflags"]:
|
|
469
|
+
artifact.cxxinfo.ldflags.extend(dep["cpp_info"][node]["exelinkflags"])
|
|
470
|
+
|
|
471
|
+
# Make list of unique values
|
|
472
|
+
artifact.cxxinfo.incpaths = utils.unique_list(artifact.cxxinfo.incpaths)
|
|
473
|
+
artifact.cxxinfo.libpaths = utils.unique_list(artifact.cxxinfo.libpaths)
|
|
474
|
+
artifact.cxxinfo.libraries = utils.unique_list(artifact.cxxinfo.libraries)
|
|
475
|
+
artifact.cxxinfo.macros = utils.unique_list(artifact.cxxinfo.macros)
|
|
476
|
+
artifact.cxxinfo.cflags = utils.unique_list(artifact.cxxinfo.cflags)
|
|
477
|
+
artifact.cxxinfo.cxxflags = utils.unique_list(artifact.cxxinfo.cxxflags)
|
|
478
|
+
artifact.cxxinfo.ldflags = utils.unique_list(artifact.cxxinfo.ldflags)
|
|
479
|
+
artifact.environ.PATH = path.pathsep.join(utils.unique_list(str(artifact.environ.PATH).split(path.pathsep)))
|