about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorAntoine Martin <antoine97.martin@gmail.com>2020-10-13 17:58:56 +0200
committerAntoine Martin <antoine97.martin@gmail.com>2020-10-13 18:08:02 +0200
commitb8ae4c5e36d5ce36bf255dbaa66f64450b21efa5 (patch)
treefe2cfe37782a8b4430a895c5dc2ae6cd1733ffbc /src/bootstrap
parentab614b0f010e68b74b8f8a6ce26d53302fb4f14a (diff)
downloadrust-b8ae4c5e36d5ce36bf255dbaa66f64450b21efa5.tar.gz
rust-b8ae4c5e36d5ce36bf255dbaa66f64450b21efa5.zip
Handle included config in bootstrap.py
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 87b53df3c5f..ce37adeb28c 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -1004,6 +1004,16 @@ def bootstrap(help_triggered):
         with open(toml_path) as config:
             build.config_toml = config.read()
 
+    profile = build.get_toml('profile')
+    if profile is not None:
+        include_file = 'config.{}.toml'.format(profile)
+        include_dir = os.path.join(build.rust_root, 'src', 'bootstrap', 'defaults')
+        include_path = os.path.join(include_dir, include_file)
+        # HACK: This works because `build.get_toml()` returns the first match it finds for a
+        # specific key, so appending our defaults at the end allows the user to override them
+        with open(include_path) as included_toml:
+            build.config_toml += os.linesep + included_toml.read()
+
     config_verbose = build.get_toml('verbose', 'build')
     if config_verbose is not None:
         build.verbose = max(build.verbose, int(config_verbose))