diff options
author | Tom Mewett <tom.mewett@codethink.co.uk> | 2019-08-22 15:07:39 +0100 |
---|---|---|
committer | Tom Mewett <tom.mewett@codethink.co.uk> | 2019-08-28 12:24:21 +0100 |
commit | 1c20e1ba605c4a93a0e883cf28808bc36fd206b5 (patch) | |
tree | e97753c08b6ba07d4996f84bd7148917da9de3c8 | |
parent | 50f5125942df34d7fd66237c3791d82ef2bdb964 (diff) | |
download | buildstream-tmewett/build-deps-cli.tar.gz |
frontend: Remove build --all flag in favour of --deps all/plantmewett/build-deps-cli
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/buildstream/_frontend/cli.py | 15 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 12 | ||||
-rw-r--r-- | tests/frontend/completions.py | 3 | ||||
-rw-r--r-- | tests/frontend/pull.py | 2 |
5 files changed, 21 insertions, 15 deletions
@@ -2,6 +2,10 @@ buildstream 1.3.1 ================= + o BREAKING CHANGE: The `bst build` command no longer accepts the `--all` option. It + now accepts `--deps` with a choice of 'plan' (default) and 'all', for + equivalent behaviour. + o Added `bst artifact show` subcommand which shows the cached status of an artifact. If project/user remotes are available, they are checked for the target elements (and their deps, if specified). Artifacts available diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py index d02dd4258..661e39575 100644 --- a/src/buildstream/_frontend/cli.py +++ b/src/buildstream/_frontend/cli.py @@ -371,8 +371,9 @@ def init(app, project_name, format_version, element_path, force, target_director # Build Command # ################################################################## @cli.command(short_help="Build elements in a pipeline") -@click.option('--all', 'all_', default=False, is_flag=True, - help="Build elements that would not be needed for the current build plan") +@click.option('--deps', '-d', default='plan', + type=click.Choice(['plan', 'all']), + help='The dependencies to build (default: plan)') @click.option('--track', 'track_', multiple=True, type=click.Path(readable=False), help="Specify elements to track during the build. Can be used " @@ -391,7 +392,7 @@ def init(app, project_name, format_version, element_path, force, target_director @click.argument('elements', nargs=-1, type=click.Path(readable=False)) @click.pass_obj -def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions, remote): +def build(app, elements, deps, track_, track_save, track_all, track_except, track_cross_junctions, remote): """Build elements in a pipeline Specifying no elements will result in building the default targets @@ -400,6 +401,12 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac When this command is executed from a workspace directory, the default is to build the workspace element. + + Specify `--deps` to control which dependencies to build: + + \b + plan: Only dependencies required for the build plan + all: All dependencies """ if (track_except or track_cross_junctions) and not (track_ or track_all): @@ -422,11 +429,11 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac track_ = elements app.stream.build(elements, + selection=deps, track_targets=track_, track_except=track_except, track_cross_junctions=track_cross_junctions, ignore_junction_targets=ignore_junction_targets, - build_all=all_, remote=remote) diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 11f428aaf..554debaae 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -234,30 +234,24 @@ class Stream(): # # Args: # targets (list of str): Targets to build + # selection (PipelineSelection): The selection mode for the specified targets # track_targets (list of str): Specified targets for tracking # track_except (list of str): Specified targets to except from tracking # track_cross_junctions (bool): Whether tracking should cross junction boundaries # ignore_junction_targets (bool): Whether junction targets should be filtered out - # build_all (bool): Whether to build all elements, or only those - # which are required to build the target. # remote (str): The URL of a specific remote server to push to, or None # # If `remote` specified as None, then regular configuration will be used # to determine where to push artifacts to. # def build(self, targets, *, + selection=PipelineSelection.PLAN, track_targets=None, track_except=None, track_cross_junctions=False, ignore_junction_targets=False, - build_all=False, remote=None): - if build_all: - selection = PipelineSelection.ALL - else: - selection = PipelineSelection.PLAN - use_config = True if remote: use_config = False @@ -286,7 +280,7 @@ class Stream(): # fetch blobs of targets if options set if self._context.pull_artifact_files: - scope = Scope.ALL if build_all else Scope.RUN + scope = Scope.ALL if selection == PipelineSelection.ALL else Scope.RUN for element in self.targets: element._set_artifact_files_required(scope=scope) diff --git a/tests/frontend/completions.py b/tests/frontend/completions.py index a254d9082..c88d0e0b9 100644 --- a/tests/frontend/completions.py +++ b/tests/frontend/completions.py @@ -146,7 +146,8 @@ def test_commands(cli, cmd, word_idx, expected): ('bst --l', 1, ['--log-file ']), # Test that options of subcommands also complete - ('bst --no-colors build -', 3, ['--all ', '--track ', '--track-all ', + ('bst --no-colors build -', 3, ['--deps ', '-d ', + '--track ', '--track-all ', '--track-except ', '--track-cross-junctions ', '-J ', '--track-save ', diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py index a87a311d2..fd49ff1ef 100644 --- a/tests/frontend/pull.py +++ b/tests/frontend/pull.py @@ -304,7 +304,7 @@ def test_push_pull_track_non_strict(cli, tmpdir, datafiles): # However, pulling has to be deferred until the dependencies have been # tracked as the strict cache key needs to be calculated before querying # the caches. - result = cli.run(project=project, args=['build', '--track-all', '--all', 'target.bst']) + result = cli.run(project=project, args=['build', '--track-all', '--deps', 'all', 'target.bst']) result.assert_success() assert set(result.get_pulled_elements()) == all_elements |