Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def executeOverDependencies(self, proj, target):
'''Execute a set of targets over the project dependencies'''
import build.buildGraph
self.debugPrint('Executing '+str(target)+' for '+proj.getUrl()+' and dependencies', 3, 'install')
for p in build.buildGraph.BuildGraph.depthFirstVisit(self.dependenceGraph, proj):
try:
maker = self.getMakeModule(p.getRoot()).PetscMake(sys.argv[1:], self.argDB)
except ImportError:
self.debugPrint(' No make module present in '+proj.getRoot(), 2, 'install')
continue
maker.mainBuild(target)
return
def getGenericCompileTarget(self, action):
'''All purposes are in Cxx, so only a Cxx compiler is necessary.'''
import build.compile.Cxx
inputTag = map(lambda a: self.language.lower()+' '+a, action)
outputTag = self.language.lower()+' '+action[0]+' '+self.language.lower()
tagger = build.fileState.GenericTag(self.sourceDB, outputTag, inputTag = inputTag, ext = 'cc', deferredExt = 'hh')
compiler = build.compile.Cxx.Compiler(self.sourceDB, self, inputTag = outputTag)
compiler.includeDirs.extend(self.includeDirs)
target = build.buildGraph.BuildGraph()
target.addVertex(tagger)
target.addEdges(tagger, outputs = [compiler])
return (target, compiler)
def getClientTarget(self, lang, fullTarget = 0, forceRebuild = 0):
'''Return a BuildGraph which will compile SIDL into the client specified'''
target = build.buildGraph.BuildGraph()
target.addVertex(self.addRepositoryDirs(build.compile.SIDL.Compiler(self.sourceDB, lang, self.project.getRoot(), 0, self.usingSIDL)))
if fullTarget:
target.prependGraph(build.buildGraph.BuildGraph([build.fileState.GenericTag(self.sourceDB, 'sidl', ext = 'sidl', force = forceRebuild)]))
target.appendGraph(build.buildGraph.BuildGraph([build.fileState.Update(self.sourceDB)]))
return target
def getClientTarget(self, lang, fullTarget = 0, forceRebuild = 0):
'''Return a BuildGraph which will compile SIDL into the client specified'''
target = build.buildGraph.BuildGraph()
target.addVertex(self.addRepositoryDirs(build.compile.SIDL.Compiler(self.sourceDB, lang, self.project.getRoot(), 0, self.usingSIDL)))
if fullTarget:
target.prependGraph(build.buildGraph.BuildGraph([build.fileState.GenericTag(self.sourceDB, 'sidl', ext = 'sidl', force = forceRebuild)]))
target.appendGraph(build.buildGraph.BuildGraph([build.fileState.Update(self.sourceDB)]))
return target
def getServerCompileTarget(self, package):
'''All purposes are in Cxx, so only a Cxx compiler is necessary for the skeleton and implementation.'''
inputTag = ['server '+package]
if len(self.usingSIDL.staticPackages):
inputTag.append('client')
(target, compiler) = self.getGenericCompileTarget(inputTag)
(iorTarget, iorCompiler) = self.getIORCompileTarget('server '+package)
compiler.includeDirs.append(project.ProjectPath(self.usingSIDL.getServerRootDir(self.language, package), self.project.getUrl()))
inputTags = [compiler.output.tag, iorCompiler.output.tag]
archiveTag = self.language.lower()+' server library directory'
sharedTag = self.language.lower()+' server shared library'
clientTag = self.language.lower()+' client shared library'
library = self.getServerLibrary(package)
linker = build.buildGraph.BuildGraph()
archiver = build.processor.DirectoryArchiver(self.sourceDB, self, 'cp', inputTags, archiveTag, isSetwise = 1, library = library)
consolidator = build.transform.Consolidator(archiveTag, archiveTag, 'old '+archiveTag)
sharedLinker = build.processor.SharedLinker(self.sourceDB, self, None, archiveTag, sharedTag, isSetwise = 1, library = library)
sharedLinker.extraLibraries.extend(self.extraLibraries)
libraryAdder = build.processor.LibraryAdder([clientTag, 'old '+clientTag], sharedLinker)
archiveFilter = build.transform.Filter(archiveTag)
linker.addVertex(archiver)
linker.addEdges(consolidator, [archiver])
linker.addEdges(libraryAdder, [consolidator])
linker.addEdges(sharedLinker, [libraryAdder])
linker.addEdges(archiveFilter, [sharedLinker])
linker.addEdges(build.transform.Remover(inputTags), [archiveFilter])
target.appendGraph(iorTarget)
target.appendGraph(linker)
return target
def setupDependencies(self):
'''Augment the project dependence graph with this project
- The project and dependencies MUST be activated prior to calling this method'''
if not 'projectDependenceGraph' in self.argDB:
import build.buildGraph
self.argDB['projectDependenceGraph'] = build.buildGraph.BuildGraph()
self.dependenceGraph = self.argDB['projectDependenceGraph']
self.dependenceGraph.addVertex(self.project)
self.dependenceGraph.clearEdges(self.project, outOnly = 1)
self.dependenceGraph.addEdges(self.project, outputs = map(self.getInstalledProject, self.executeTarget('getDependencies')))
self.argDB['projectDependenceGraph'] = self.dependenceGraph
return self.dependenceGraph
def getServerTargets(self, isStatic = 0):
'''Return a BuildGraph which will compile the servers specified
- This is a linear array since all source is independent'''
target = build.buildGraph.BuildGraph()
for lang in self.usingSIDL.serverLanguages+self.serverLanguages:
for package in self.packages:
if (isStatic and not package in self.usingSIDL.staticPackages) or (not isStatic and package in self.usingSIDL.staticPackages): continue
target.appendGraph(self.getServerTarget(lang, package))
return target
def getClientTargets(self):
'''Return a BuildGraph which will compile SIDL into the clients specified
- Currently this graph is just a list of unconnected vertices, which will be linked up in the final target'''
target = build.buildGraph.BuildGraph()
for lang in self.usingSIDL.clientLanguages:
target.addSubgraph(self.getClientTarget(lang))
return target