mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-04 03:54:16 +08:00
waf: Refactor libbsd.py to support per module generation.
This change allows us to control the modules we want to build. Update #3351
This commit is contained in:
parent
f7a09b5985
commit
d797c5dcd2
27
builder.py
27
builder.py
@ -484,13 +484,18 @@ class File(object):
|
||||
# Module - logical group of related files we can perform actions on
|
||||
#
|
||||
class Module(object):
|
||||
def __init__(self, name):
|
||||
def __init__(self, manager, name, enabled = True):
|
||||
self.manager = manager
|
||||
self.name = name
|
||||
self.enabled = enabled
|
||||
self.conditionalOn = "none"
|
||||
self.files = []
|
||||
self.cpuDependentSourceFiles = {}
|
||||
self.dependencies = []
|
||||
|
||||
def isEnabled(self):
|
||||
return self.enabled
|
||||
|
||||
def initCPUDependencies(self, cpu):
|
||||
if cpu not in self.cpuDependentSourceFiles:
|
||||
self.cpuDependentSourceFiles[cpu] = []
|
||||
@ -639,8 +644,15 @@ class ModuleManager(object):
|
||||
raise KeyError('module %s not found' % (key))
|
||||
return self.modules[key]
|
||||
|
||||
def getModules(self):
|
||||
return sorted(self.modules.keys())
|
||||
def getAllModules(self):
|
||||
if 'modules' in self.configuration:
|
||||
return self.configuration['modules']
|
||||
return []
|
||||
|
||||
def getEnabledModules(self):
|
||||
if 'modules-enabled' in self.configuration:
|
||||
return self.configuration['modules-enabled']
|
||||
return []
|
||||
|
||||
def addModule(self, module):
|
||||
self.modules[module.name] = module
|
||||
@ -656,3 +668,12 @@ class ModuleManager(object):
|
||||
|
||||
def getConfiguration(self):
|
||||
return self.configuration
|
||||
|
||||
def setModuleConfigiuration(self):
|
||||
mods = sorted(self.modules.keys())
|
||||
self.configuration['modules'] = mods
|
||||
self.configuration['modules-enabled'] = [m for m in mods if self.modules[m].isEnabled()]
|
||||
|
||||
def generateBuild(self):
|
||||
for m in self.getEnabledModules():
|
||||
self.modules[m].generate()
|
||||
|
@ -143,7 +143,8 @@ if isEarlyExit == True:
|
||||
|
||||
try:
|
||||
build = builder.ModuleManager()
|
||||
libbsd.loadModules(build)
|
||||
libbsd.load(build)
|
||||
build.generateBuild()
|
||||
build.processSource(isForward)
|
||||
builder.changedFileSummary(statsReport)
|
||||
except IOError as ioe:
|
||||
|
@ -280,9 +280,11 @@ class Builder(builder.ModuleManager):
|
||||
d['includes'] += frag[-1]
|
||||
d['includes'] = list(set(d['includes']))
|
||||
|
||||
self.generateBuild()
|
||||
|
||||
self.data = {}
|
||||
|
||||
for mn in self.getModules():
|
||||
for mn in self.getEnabledModules():
|
||||
m = self[mn]
|
||||
if m.conditionalOn == "none":
|
||||
for f in m.files:
|
||||
|
Loading…
x
Reference in New Issue
Block a user