Valentin David pushed to branch bst-1.2 at BuildStream / buildstream
Commits:
-
2b5c63d0
by Valentin David at 2018-08-13T09:34:59Z
-
650c4d8d
by Valentin David at 2018-08-13T11:03:12Z
2 changed files:
Changes:
... | ... | @@ -267,8 +267,11 @@ class Stream(): |
267 | 267 |
except_targets=None,
|
268 | 268 |
cross_junctions=False):
|
269 | 269 |
|
270 |
+ # We pass no target to build. Only to track. Passing build targets
|
|
271 |
+ # would fully load project configuration which might not be
|
|
272 |
+ # possible before tracking is done.
|
|
270 | 273 |
_, elements = \
|
271 |
- self._load(targets, targets,
|
|
274 |
+ self._load([], targets,
|
|
272 | 275 |
selection=selection, track_selection=selection,
|
273 | 276 |
except_targets=except_targets,
|
274 | 277 |
track_except_targets=except_targets,
|
... | ... | @@ -817,6 +820,12 @@ class Stream(): |
817 | 820 |
#
|
818 | 821 |
# A convenience method for loading element lists
|
819 | 822 |
#
|
823 |
+ # If `targets` is not empty used project configuration will be
|
|
824 |
+ # fully loaded. If `targets` is empty, tracking will still be
|
|
825 |
+ # resolved for elements in `track_targets`, but no build pipeline
|
|
826 |
+ # will be resolved. This is behavior is import for track() to
|
|
827 |
+ # not trigger full loading of project configuration.
|
|
828 |
+ #
|
|
820 | 829 |
# Args:
|
821 | 830 |
# targets (list of str): Main targets to load
|
822 | 831 |
# track_targets (list of str): Tracking targets
|
... | ... | @@ -864,7 +873,7 @@ class Stream(): |
864 | 873 |
#
|
865 | 874 |
# This can happen with `bst build --track`
|
866 | 875 |
#
|
867 |
- if not self._pipeline.targets_include(elements, track_elements):
|
|
876 |
+ if targets and not self._pipeline.targets_include(elements, track_elements):
|
|
868 | 877 |
raise StreamError("Specified tracking targets that are not "
|
869 | 878 |
"within the scope of primary targets")
|
870 | 879 |
|
... | ... | @@ -900,6 +909,10 @@ class Stream(): |
900 | 909 |
for element in track_selected:
|
901 | 910 |
element._schedule_tracking()
|
902 | 911 |
|
912 |
+ if not targets:
|
|
913 |
+ self._pipeline.resolve_elements(track_selected)
|
|
914 |
+ return [], track_selected
|
|
915 |
+ |
|
903 | 916 |
# ArtifactCache.setup_remotes expects all projects to be fully loaded
|
904 | 917 |
for project in self._context.get_projects():
|
905 | 918 |
project.ensure_fully_loaded()
|
... | ... | @@ -612,3 +612,25 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): |
612 | 612 |
# Assert that we are now buildable because the source is
|
613 | 613 |
# now cached.
|
614 | 614 |
assert cli.get_element_state(project, element_name) == 'buildable'
|
615 |
+ |
|
616 |
+ |
|
617 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
618 |
+@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
|
|
619 |
+@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
|
|
620 |
+def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
|
|
621 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
622 |
+ element_path = os.path.join(project, 'elements')
|
|
623 |
+ subproject_path = os.path.join(project, 'files', 'sub-project')
|
|
624 |
+ sub_element_path = os.path.join(subproject_path, 'elements')
|
|
625 |
+ junction_path = os.path.join(element_path, 'junction.bst')
|
|
626 |
+ |
|
627 |
+ configure_project(project, {
|
|
628 |
+ 'ref-storage': ref_storage,
|
|
629 |
+ '(@)': ['junction.bst:test.yml']
|
|
630 |
+ })
|
|
631 |
+ |
|
632 |
+ generate_junction(str(tmpdir.join('junction_repo')),
|
|
633 |
+ subproject_path, junction_path, store_ref=False)
|
|
634 |
+ |
|
635 |
+ result = cli.run(project=project, args=['track', 'junction.bst'])
|
|
636 |
+ result.assert_success()
|