Jonathan Maw pushed to branch 463-make-dependency-type-default-to-build at BuildStream / buildstream
Commits:
-
678982a9
by Jonathan Maw at 2018-08-10T12:57:16Z
-
98c29e2c
by Jonathan Maw at 2018-08-10T13:40:16Z
-
906b7025
by Jonathan Maw at 2018-08-10T13:52:12Z
10 changed files:
- buildstream/_versions.py
- doc/source/format_declaring.rst
- tests/loader/dependencies.py
- + tests/loader/dependencies/elements/builddep-list.bst
- tests/loader/dependencies/elements/firstdep.bst
- + tests/loader/dependencies/elements/list-combine.bst
- + tests/loader/dependencies/elements/list-overlap.bst
- + tests/loader/dependencies/elements/runtimedep-list.bst
- + tests/loader/dependencies/elements/seconddep.bst
- + tests/loader/dependencies/elements/thirddep.bst
Changes:
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 |
# This version is bumped whenever enhancements are made
|
24 | 24 |
# to the `project.conf` format or the core element format.
|
25 | 25 |
#
|
26 |
-BST_FORMAT_VERSION = 13
|
|
26 |
+BST_FORMAT_VERSION = 14
|
|
27 | 27 |
|
28 | 28 |
|
29 | 29 |
# The base BuildStream artifact version
|
... | ... | @@ -98,6 +98,68 @@ relative filename to the elements they depend on here. |
98 | 98 |
See :ref:`format_dependencies` for more information on the dependency model.
|
99 | 99 |
|
100 | 100 |
|
101 |
+.. _format_build_depends:
|
|
102 |
+ |
|
103 |
+Build-Depends
|
|
104 |
+~~~~~~~~~~~~~
|
|
105 |
+ |
|
106 |
+.. code:: yaml
|
|
107 |
+ |
|
108 |
+ # Specify some build-dependencies
|
|
109 |
+ build-depends:
|
|
110 |
+ - element1.bst
|
|
111 |
+ - element2.bst
|
|
112 |
+ |
|
113 |
+Build dependencies between elements can be specified with the ``build-depends`` attribute.
|
|
114 |
+The above code snippet is equivalent to:
|
|
115 |
+ |
|
116 |
+.. code:: yaml
|
|
117 |
+ |
|
118 |
+ # Specify some build-dependencies
|
|
119 |
+ depends:
|
|
120 |
+ - filename: element1.bst
|
|
121 |
+ type: build
|
|
122 |
+ - filename: element2.bst
|
|
123 |
+ type: build
|
|
124 |
+ |
|
125 |
+See :ref:`format_dependencies` for more information on the dependency model.
|
|
126 |
+ |
|
127 |
+.. note::
|
|
128 |
+ |
|
129 |
+ The ``build-depends`` configuration is available since :ref:`format version 14 <project_format_version>`
|
|
130 |
+ |
|
131 |
+ |
|
132 |
+.. _format_runtime_depends:
|
|
133 |
+ |
|
134 |
+Runtime-Depends
|
|
135 |
+~~~~~~~~~~~~~~~
|
|
136 |
+ |
|
137 |
+.. code:: yaml
|
|
138 |
+ |
|
139 |
+ # Specify some runtime-dependencies
|
|
140 |
+ runtime-depends:
|
|
141 |
+ - element1.bst
|
|
142 |
+ - element2.bst
|
|
143 |
+ |
|
144 |
+Runtime dependencies between elements can be specified with the ``runtime-depends`` attribute.
|
|
145 |
+The above code snippet is equivalent to:
|
|
146 |
+ |
|
147 |
+.. code:: yaml
|
|
148 |
+ |
|
149 |
+ # Specify some runtime-dependencies
|
|
150 |
+ depends:
|
|
151 |
+ - filename: element1.bst
|
|
152 |
+ type: runtime
|
|
153 |
+ - filename: element2.bst
|
|
154 |
+ type: runtime
|
|
155 |
+ |
|
156 |
+See :ref:`format_dependencies` for more information on the dependency model.
|
|
157 |
+ |
|
158 |
+.. note::
|
|
159 |
+ |
|
160 |
+ The ``runtime-depends`` configuration is available since :ref:`format version 14 <project_format_version>`
|
|
161 |
+ |
|
162 |
+ |
|
101 | 163 |
.. _format_sources:
|
102 | 164 |
|
103 | 165 |
Sources
|
... | ... | @@ -276,8 +338,8 @@ attributes are suitable. |
276 | 338 |
|
277 | 339 |
.. note::
|
278 | 340 |
|
279 |
- Note the order in which element dependencies are declared in the ``depends``
|
|
280 |
- list is not meaningful.
|
|
341 |
+ Note the order in which element dependencies are declared in the ``depends``,
|
|
342 |
+ ``build-depends`` and ``runtime-depends`` lists are not meaningful.
|
|
281 | 343 |
|
282 | 344 |
Dependency dictionary:
|
283 | 345 |
|
... | ... | @@ -299,6 +361,8 @@ Attributes: |
299 | 361 |
* ``type``
|
300 | 362 |
|
301 | 363 |
This attribute is used to express the :ref:`dependency type <format_dependencies_types>`.
|
364 |
+ This field is not permitted in :ref:`Build-Depends <format_build_depends>` or
|
|
365 |
+ :ref:`Runtime-Depends <format_runtime_depends>`.
|
|
302 | 366 |
|
303 | 367 |
* ``junction``
|
304 | 368 |
|
... | ... | @@ -3,6 +3,7 @@ import pytest |
3 | 3 |
|
4 | 4 |
from buildstream._exceptions import LoadError, LoadErrorReason
|
5 | 5 |
from buildstream._loader import Loader, MetaElement
|
6 |
+from tests.testutils import cli
|
|
6 | 7 |
from . import make_loader
|
7 | 8 |
|
8 | 9 |
DATA_DIR = os.path.join(
|
... | ... | @@ -27,7 +28,7 @@ def test_two_files(datafiles): |
27 | 28 |
assert(len(element.dependencies) == 1)
|
28 | 29 |
firstdep = element.dependencies[0]
|
29 | 30 |
assert(isinstance(firstdep, MetaElement))
|
30 |
- assert(firstdep.kind == 'thefirstdep')
|
|
31 |
+ assert(firstdep.kind == 'manual')
|
|
31 | 32 |
|
32 | 33 |
|
33 | 34 |
@pytest.mark.datafiles(DATA_DIR)
|
... | ... | @@ -47,7 +48,7 @@ def test_shared_dependency(datafiles): |
47 | 48 |
#
|
48 | 49 |
firstdep = element.dependencies[0]
|
49 | 50 |
assert(isinstance(firstdep, MetaElement))
|
50 |
- assert(firstdep.kind == 'thefirstdep')
|
|
51 |
+ assert(firstdep.kind == 'manual')
|
|
51 | 52 |
assert(len(firstdep.dependencies) == 0)
|
52 | 53 |
|
53 | 54 |
# The second specified dependency is 'shareddep'
|
... | ... | @@ -86,7 +87,7 @@ def test_dependency_dict(datafiles): |
86 | 87 |
assert(len(element.dependencies) == 1)
|
87 | 88 |
firstdep = element.dependencies[0]
|
88 | 89 |
assert(isinstance(firstdep, MetaElement))
|
89 |
- assert(firstdep.kind == 'thefirstdep')
|
|
90 |
+ assert(firstdep.kind == 'manual')
|
|
90 | 91 |
|
91 | 92 |
|
92 | 93 |
@pytest.mark.datafiles(DATA_DIR)
|
... | ... | @@ -186,3 +187,49 @@ def test_all_dependency(datafiles): |
186 | 187 |
assert(isinstance(firstdep, MetaElement))
|
187 | 188 |
firstbuilddep = element.build_dependencies[0]
|
188 | 189 |
assert(firstdep == firstbuilddep)
|
190 |
+ |
|
191 |
+ |
|
192 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
193 |
+def test_list_build_dependency(cli, datafiles):
|
|
194 |
+ project = str(datafiles)
|
|
195 |
+ |
|
196 |
+ # Check that the pipeline includes the build dependency
|
|
197 |
+ deps = cli.get_pipeline(project, ['elements/builddep-list.bst'], scope="build")
|
|
198 |
+ assert "elements/firstdep.bst" in deps
|
|
199 |
+ |
|
200 |
+ |
|
201 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
202 |
+def test_list_runtime_dependency(cli, datafiles):
|
|
203 |
+ project = str(datafiles)
|
|
204 |
+ |
|
205 |
+ # Check that the pipeline includes the runtime dependency
|
|
206 |
+ deps = cli.get_pipeline(project, ['elements/runtimedep-list.bst'], scope="run")
|
|
207 |
+ assert "elements/firstdep.bst" in deps
|
|
208 |
+ |
|
209 |
+ |
|
210 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
211 |
+def test_list_dependencies_combined(cli, datafiles):
|
|
212 |
+ project = str(datafiles)
|
|
213 |
+ |
|
214 |
+ # Check that runtime deps get combined
|
|
215 |
+ rundeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="run")
|
|
216 |
+ assert "elements/firstdep.bst" not in rundeps
|
|
217 |
+ assert "elements/seconddep.bst" in rundeps
|
|
218 |
+ assert "elements/thirddep.bst" in rundeps
|
|
219 |
+ |
|
220 |
+ # Check that build deps get combined
|
|
221 |
+ builddeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="build")
|
|
222 |
+ assert "elements/firstdep.bst" in builddeps
|
|
223 |
+ assert "elements/seconddep.bst" not in builddeps
|
|
224 |
+ assert "elements/thirddep.bst" in builddeps
|
|
225 |
+ |
|
226 |
+ |
|
227 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
228 |
+def test_list_overlap(cli, datafiles):
|
|
229 |
+ project = str(datafiles)
|
|
230 |
+ |
|
231 |
+ # Check that dependencies get merged
|
|
232 |
+ rundeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="run")
|
|
233 |
+ assert "elements/firstdep.bst" in rundeps
|
|
234 |
+ builddeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="build")
|
|
235 |
+ assert "elements/firstdep.bst" in builddeps
|
1 |
+kind: stack
|
|
2 |
+description: This element has a build-only dependency specified via build-depends
|
|
3 |
+build-depends:
|
|
4 |
+ - elements/firstdep.bst
|
1 |
-kind: thefirstdep
|
|
1 |
+kind: manual
|
|
2 | 2 |
description: This is the first dependency
|
1 |
+kind: stack
|
|
2 |
+description: This element depends on three elements in different ways
|
|
3 |
+build-depends:
|
|
4 |
+- elements/firstdep.bst
|
|
5 |
+runtime-depends:
|
|
6 |
+- elements/seconddep.bst
|
|
7 |
+depends:
|
|
8 |
+- elements/thirddep.bst
|
1 |
+kind: stack
|
|
2 |
+description: This element depends on two elements in different ways
|
|
3 |
+build-depends:
|
|
4 |
+- elements/firstdep.bst
|
|
5 |
+depends:
|
|
6 |
+- filename: elements/firstdep.bst
|
|
7 |
+ type: runtime
|
1 |
+kind: stack
|
|
2 |
+description: This element has a runtime-only dependency
|
|
3 |
+runtime-depends:
|
|
4 |
+ - elements/firstdep.bst
|
1 |
+kind: manual
|
|
2 |
+description: This is the second dependency
|
1 |
+kind: manual
|
|
2 |
+description: This is the third dependency
|