def process(self): print print '* The dumpConfig tool (part of the XCDL framework) *' print "* Dump the configuration trees *" print if self.verbosity > 1: print 'Verbosity level {0}'.format(self.verbosity) print repoFolderAbsolutePathList = [] if self.configFilePath != None: (configTreesList,repoFolderAbsolutePathList) = self.parseConfigurationFile(self.configFilePath, -1) self.packagesAbsolutePathList.extend(repoFolderAbsolutePathList) print repositoriesList = self.parseRepositories(self.packagesAbsolutePathList, -1) print self.dumpTree(repositoriesList, False) if self.configFilePath != None: print self.dumpConfiguration(configTreesList) if self.desiredConfigurationId != None: print configNode = self.loadConfiguration(configTreesList, self.desiredConfigurationId, -1) print print 'Build preprocessor symbols dictionary...' count = self.processSymbolsDict(repositoriesList) print '- {0} symbol(s) processed.'.format(count) print print 'Process initial \'isEnabled\' properties' self.processInitialIsEnabled(repositoriesList) print print 'Process \'requires\' properties' self.processRequiresProperties(repositoriesList, configNode, False) CommonApplication.clearErrorCount() self.processRequiresProperties(repositoriesList, configNode, False) count = CommonApplication.getErrorCount() if count > 0: print '{0} error(s) encountered'.format(count) print self.dumpTree(repositoriesList, True) print self.dumpPreprocessorDefinitions(repositoriesList) print self.dumpSourceFiles(repositoriesList) return
def processAndCreate(self, repositoriesList, configNode, outputSubFolder, toolchainNode): if self.verbosity > 0: print configNode = self.loadBuildConfiguration(configNode, 0) # enable configuration nodes too, for a more uniform processing # (of CopyFiles, for example) configNode.setIsEnabledWithCountRecursive() if self.verbosity > 0: print print 'Build preprocessor symbols dictionary...' count = self.processSymbolsDict(repositoriesList) if self.verbosity > 0: print '- {0} symbol(s) processed.'.format(count) if self.verbosity > 0: print print 'Evaluate the initial \'isEnabled\' expressions, if any...' self.processInitialIsEnabled(repositoriesList) if self.verbosity > 0: print print 'Process the \'requirements\' properties...' self.processRequiresProperties(repositoriesList, configNode, False) # and one more time, to report remaining errors CommonApplication.clearErrorCount() self.processRequiresProperties(repositoriesList, configNode, True) count = CommonApplication.getErrorCount() if count > 0: raise ErrorWithDescription('Errors encountered or requirement not satisfied, cannot continue') if self.verbosity > 1: print self.dumpTree(repositoriesList, True) if not os.path.isdir(self.outputFolder): os.makedirs(self.outputFolder) # print outputSubFolder CommonApplication.clearErrorCount() if self.verbosity > 0: print print 'Generate header files...' self.generatePreprocessorDefinitions(repositoriesList, self.outputFolder, outputSubFolder) if self.verbosity > 0: print print 'Copy custom files...' self.copyCustomFiles(repositoriesList, configNode, self.outputFolder, outputSubFolder) if self.verbosity > 0: print print 'Using toolchain \'{0}\'.'.format(toolchainNode.getName()) if self.verbosity > 0: print print 'Generate GNU Make files...' # 'makefile' must be the last file written self.generateAllMakeFiles(repositoriesList, configNode, toolchainNode, self.outputFolder, outputSubFolder) count = CommonApplication.getErrorCount() if count > 0: raise ErrorWithoutDescription() return toolchainNode
def process(self): if self.verbosity > 0: print print '* The configMakefiles tool (part of the XCDL framework) *' print '* Create the build folders with distributed GNU Make files *' print if self.verbosity > 1: print 'Verbosity level {0}'.format(self.verbosity) print self.validate() (configTreesList, repoFolderAbsolutePathList) = self.parseConfigurationFile( self.configFilePath, 0) self.packagesAbsolutePathList.extend(repoFolderAbsolutePathList) if self.verbosity > 1: print self.dumpConfiguration(configTreesList) if self.verbosity > 0: print repositoriesList = self.parseRepositories( self.packagesAbsolutePathList, 0) if self.verbosity > 1: print self.dumpTree(repositoriesList, False) if self.verbosity > 0: print configNode = self.loadConfiguration(configTreesList, self.desiredConfigurationId, 0) if self.verbosity > 0: print print 'Build preprocessor symbols dictionary...' count = self.processSymbolsDict(repositoriesList) if self.verbosity > 0: print '- {0} symbol(s) processed.'.format(count) if self.verbosity > 0: print print 'Evaluate the initial \'isEnabled\' expressions, if any...' self.processInitialIsEnabled(repositoriesList) if self.verbosity > 0: print print 'Process the \'requirements\' properties...' self.processRequiresProperties(repositoriesList, configNode, False) # and one more time, to report remaining errors CommonApplication.clearErrorCount() self.processRequiresProperties(repositoriesList, configNode, True) count = CommonApplication.getErrorCount() if count == 1: raise ErrorWithDescription('1 requirement not satisfied, quitting') elif count > 1: raise ErrorWithDescription( '{0} requirements not satisfied, quitting'.format(count)) if self.verbosity > 1: print self.dumpTree(repositoriesList, True) if not os.path.isdir(self.outputFolder): os.makedirs(self.outputFolder) outputSubFolder = configNode.getBuildFolderRecursiveWithSubstitutions() if self.doLinearise: outputSubFolder = outputSubFolder.replace(os.sep, '_') #print outputSubFolder if self.verbosity > 0: print print 'Generate header files...' self.generatePreprocessorDefinitions( repositoriesList, self.outputFolder, outputSubFolder) (toolchainNode, _) = self.validateToolchain(configNode) if self.verbosity > 0: print print 'Using toolchain \'{0}\'.'.format(toolchainNode.getName()) if self.verbosity > 0: print print 'Generate GNU Make files...' self.generateAllMakeFiles(repositoriesList, configNode, toolchainNode, self.outputFolder, outputSubFolder) return