summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-04-26 10:04:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-07-25 11:42:18 +0200
commit07291dd47e580843e1baf34d9a9ac584431c9a1e (patch)
treecb3521a1a168828e3a204e6ae9bce7032b3ff6a6
parentd4c7a7cfc1f68007ee34733d534bdaf35423298b (diff)
build: Load items on demand during a buildqual-91
If the CSafeLoader is available, load only the necessary build items. This considerably speeds up the build setup time if the CSafeLoader is used.
-rwxr-xr-xwscript27
1 files changed, 25 insertions, 2 deletions
diff --git a/wscript b/wscript
index de634cc8d0..00d386a52a 100755
--- a/wscript
+++ b/wscript
@@ -1180,6 +1180,22 @@ try:
super(ItemCache, self).__init__()
self.spec_directories = []
+ def __missing__(self, uid):
+ name = uid + ".yml"
+ for path in self.spec_directories:
+ path2 = os.path.join(path, name[1:])
+ try:
+ with open(path2, "r") as f:
+ content = f.read()
+ except OSError:
+ pass
+ else:
+ data = load(content, SafeLoader)
+ item = ctors[data["build-type"]](uid, data)
+ self[uid] = item
+ return item
+ raise KeyError("No item file found for UID: {}".format(uid))
+
def set_spec_directories(self, spec_directories):
self.spec_directories = spec_directories
@@ -1209,6 +1225,9 @@ try:
for path in self.spec_directories:
self.load_from_yaml(path, path)
+
+ def load_on_demand(self, ctx):
+ pass
except ImportError:
#
# Fall back to the Python implementation provided by the project. This
@@ -1309,6 +1328,9 @@ except ImportError:
for path in self.spec_directories:
load_items_in_directory(ctx, path)
+ def load_on_demand(self, ctx):
+ self.load_all(ctx)
+
items = ItemCache()
@@ -1509,6 +1531,7 @@ def configure_variant(conf, cp, bsp_map, path_list, top_group, variant):
conf.env["BSP_BASE"] = bsp_base
conf.env["BSP_NAME"] = bsp_name
conf.env["BSP_FAMILY"] = family
+ conf.env["BSP_UID"] = bsp_item.uid
conf.env["DEST_OS"] = "rtems"
# For the enabled-by evaluation we have to use the base BSP defined by the
@@ -1643,13 +1666,13 @@ def build(bld):
],
)
items.set_spec_directories(bld.env.SPECS)
- items.load_all(bld)
+ items.load_on_demand(bld)
append_variant_builds(bld)
return
long_command_line_workaround(bld)
bic = BuildItemContext(bld.env.ARCH_INCLUDES.split(), [], [], [], [], [],
[])
- bsps[bld.env.ARCH][bld.env.BSP_BASE].build(bld, bic)
+ items[bld.env.BSP_UID].build(bld, bic)
items[bld.env.TOPGROUP_UID].build(bld, bic)