summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-28 14:07:50 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-09-12 09:40:37 +0000
commitf05be959e06925b88fd701b2d432902f418c38e3 (patch)
treefd7d0af29ec15ccdfc9f70e57fcf325ea11226fb /src
parent108a38edd86d9de3ef0ce78cb005041662ed279e (diff)
downloadbuildstream-f05be959e06925b88fd701b2d432902f418c38e3.tar.gz
_context.py: Add 'dependencies' option to 'build' user config
This option sets the default value for the `--deps` option of `bst build`.
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/_context.py11
-rw-r--r--src/buildstream/_frontend/cli.py5
-rw-r--r--src/buildstream/data/userconfig.yaml8
3 files changed, 22 insertions, 2 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index ecdf6f97b..aab09b6d4 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -129,6 +129,9 @@ class Context():
# Maximum jobs per build
self.build_max_jobs = None
+ # Control which dependencies to build
+ self.build_dependencies = None
+
# Size of the artifact cache in bytes
self.config_cache_quota = None
@@ -347,9 +350,15 @@ class Context():
# Load build config
build = defaults.get_mapping('build')
- build.validate_keys(['max-jobs'])
+ build.validate_keys(['max-jobs', 'dependencies'])
self.build_max_jobs = build.get_int('max-jobs')
+ self.build_dependencies = build.get_str('dependencies')
+ if self.build_dependencies not in ['plan', 'all']:
+ provenance = build.get_scalar('dependencies').get_provenance()
+ raise LoadError("{}: Invalid value for 'dependencies'. Choose 'plan' or 'all'."
+ .format(provenance), LoadErrorReason.INVALID_DATA)
+
# Load per-projects overrides
self._project_overrides = defaults.get_mapping('projects', default={})
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 1fdbbdc58..3344c5c79 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -374,7 +374,7 @@ 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('--deps', '-d', default='plan', show_default=True,
+@click.option('--deps', '-d', default=None,
type=click.Choice(['plan', 'all']),
help='The dependencies to build')
@click.option('--track', 'track_', multiple=True,
@@ -423,6 +423,9 @@ def build(app, elements, deps, track_, track_save, track_all, track_except, trac
with app.initialized(session_name="Build"):
ignore_junction_targets = False
+ if deps is None:
+ deps = app.context.build_dependencies
+
if not elements:
elements = app.project.get_default_targets()
# Junction elements cannot be built, exclude them from default targets
diff --git a/src/buildstream/data/userconfig.yaml b/src/buildstream/data/userconfig.yaml
index a73c1ce44..dc31c10ce 100644
--- a/src/buildstream/data/userconfig.yaml
+++ b/src/buildstream/data/userconfig.yaml
@@ -90,6 +90,14 @@ build:
#
max-jobs: 0
+ #
+ # Control which dependencies to build:
+ #
+ # plan - Only dependencies required for the build plan
+ # all - All dependencies
+ #
+ dependencies: plan
+
#
# Logging