Optimized kubos_link to only link actual dependencies.
@@ -15,6 +15,13 @@ class KubosLinker(object):
def __init__(self):
self.kb = KubosBuild()
+ def get_module_deps(self, app_dir):
+ module_json = json.load(open("%s/module.json" % app_dir))
+ if 'dependencies' in module_json:
+ return module_json['dependencies']
+ else:
+ return []
+
def link_sys(self, link_cmd):
for module in self.kb.modules(include_bin=False):
print '[module %s@%s]' % (module.yotta_name(), module.path)
@@ -26,7 +33,9 @@ class KubosLinker(object):
def link_app(self, app_dir, link_cmd):
print '[app %s]' % app_dir
+ app_modules = self.get_module_deps(app_dir)
for module in self.kb.modules(include_bin=False):
+ if module.yotta_name() in app_modules:
utils.cmd('kubos', link_cmd, module.yotta_name(), cwd=app_dir)
for target in self.kb.targets():
