Beispiel #1
0
    def buildStaticObjects( self, session, buildDir = None ):
        #LOG
        ctx_log.ctxlogBeginCodeModule( self.getName() )

        infoMessage("Building module '%s'"%(self.getName()), 2)

        buildParams = ctx_base.CTXBuildParams()
        buildParams.add( self.buildParams )

        # TODO: external dependencies must be revisited.
        xdepends = assureList( self.resolveExternalDeps() )
        if len(xdepends) != 0:
	    # assume that external dependencies never change, otherwise we get forced rebuilds whenever we've got external dependencies
	    ## contexo detects changes in the file xdepends elsewere
            #self.forceRebuild()
            buildParams.incPaths.extend( xdepends )

        #
        # Handle output directory settings
        #

        outputDir = self.getOutputDir()
        if buildDir != None:
            outputDir = os.path.join( outputDir, buildDir )
            if not os.path.exists( outputDir ):
                os.makedirs( outputDir )

        #
        # Build sources for this module.
        #
        srcFiles = self.getSourceAbsolutePaths()
        if self.buildUnitTests:
            srcFiles.extend( self.getTestSourceAbsolutePaths() )
    
        subBCSrcFiles = self.getSubBCSources()

        objlist = list()
        for src in srcFiles:
            bc = self.bc

            for srcList in subBCSrcFiles.values():
                if src in srcList:
                    for subBCSrc in srcList:
                        subBCName = os.path.basename(os.path.dirname(subBCSrc))
                        bc = self.subBC[subBCName]
            obj = session.buildStaticObject( os.path.normpath( src ), os.path.normpath( outputDir ), bc, self.rebuildAll )
            objlist.append( obj )
 
        for prebuiltObjectFile in self.prebuiltObjFiles:
            obj = session.copyPrebuiltObject( os.path.normpath( prebuiltObjectFile), outputDir)
            objlist.append( obj)
        #LOG
        for obj in objlist:
            ctx_log.ctxlogAddObjectFile( obj.filename, os.path.basename(obj.source) )

        #LOG
        ctx_log.ctxlogEndCodeModule()

        return objlist
Beispiel #2
0
    def buildStaticObjects( self, session, buildDir = None ):
        #LOG
        ctx_log.ctxlogBeginCodeModule( self.getName() )

        infoMessage("Building module '%s'"%(self.getName()), 2)

        buildParams = ctx_base.CTXBuildParams()
        buildParams.add( self.buildParams )

        # TODO: external dependencies must be revisited.
        xdepends = assureList( self.resolveExternalDeps() )
        if len(xdepends) != 0:
            self.forceRebuild()
            buildParams.incPaths.extend( xdepends )

        #
        # Handle output directory settings
        #

        outputDir = self.getOutputDir()
        if buildDir != None:
            outputDir = os.path.join( outputDir, buildDir )
            if not os.path.exists( outputDir ):
                os.makedirs( outputDir )

        #
        # Build sources for this module.
        #

        srcFiles = self.getSourceAbsolutePaths()
        if self.buildUnitTests:
            srcFiles.extend( self.getTestSourceAbsolutePaths() )

        objlist = []
        for src in srcFiles:
            obj = session.buildStaticObject( os.path.normpath( src ), os.path.normpath( outputDir ), buildParams, self.rebuildAll )
            objlist.append( obj )

        #LOG
        for obj in objlist:
            ctx_log.ctxlogAddObjectFile( obj.filename, os.path.basename(obj.source) )

        #LOG
        ctx_log.ctxlogEndCodeModule()

        return objlist