sbsv2/raptor/python/raptor.py
branchwip
changeset 342 f0e42ff3359f
parent 268 692d9a4eefc4
child 372 e6d6373c0c3a
child 451 153129bf777e
equal deleted inserted replaced
341:4fd571a5fb6a 342:f0e42ff3359f
     1 #
     1 #
     2 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 # Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 # All rights reserved.
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     4 # This component and the accompanying materials are made available
     5 # under the terms of the License "Eclipse Public License v1.0"
     5 # under the terms of the License "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
   236 		     # to be able to simulate the overall recursive unfurling of a build.
   236 		     # to be able to simulate the overall recursive unfurling of a build.
   237 
   237 
   238 class Component(ModelNode):
   238 class Component(ModelNode):
   239 	"""A group of projects or, in symbian-speak, a bld.inf.
   239 	"""A group of projects or, in symbian-speak, a bld.inf.
   240 	"""
   240 	"""
   241 	def __init__(self, filename):
   241 	def __init__(self, filename, layername="", componentname=""):
   242 		super(Component,self).__init__(filename)
   242 		super(Component,self).__init__(filename)
   243 		# Assume that components are specified in bld.inf files for now
   243 		# Assume that components are specified in bld.inf files for now
   244 		# One day that tyranny might end.
   244 		# One day that tyranny might end.
   245 		self.bldinf = None # Slot for a bldinf object if we spot one later
   245 		self.bldinf = None # Slot for a bldinf object if we spot one later
   246 		self.bldinf_filename = generic_path.Path.Absolute(filename)
   246 		self.bldinf_filename = generic_path.Path.Absolute(filename)
   247 
   247 
   248 		self.id = str(self.bldinf_filename)
   248 		self.id = str(self.bldinf_filename)
   249 		self.exportspecs = []
   249 		self.exportspecs = []
   250 		self.depfiles = []
   250 		self.depfiles = []
   251 		self.unfurled = False # We can parse this
   251 		self.unfurled = False # We can parse this
       
   252 		
       
   253 		# Extra metadata optionally supplied with system definition file gathered components
       
   254 		self.layername = layername
       
   255 		self.componentname = componentname
   252 
   256 
   253 	def AddMMP(self, filename):
   257 	def AddMMP(self, filename):
   254 		self.children.add(Project(filename))
   258 		self.children.add(Project(filename))
   255 
   259 
   256 
   260 
   257 class Layer(ModelNode):
   261 class Layer(ModelNode):
   258 	""" 	Some components that should be built togther
   262 	""" Some components that should be built togther
   259 		e.g. a Layer in the system definition.
   263 		e.g. a Layer in the system definition.
       
   264 		
       
   265 		Components that come from system definition files can
       
   266 		have extra surrounding metadata that we need to pass
       
   267 		on for use in log output.
   260 	"""
   268 	"""
   261 	def __init__(self, name, componentlist=[]):
   269 	def __init__(self, name, componentlist=[]):
   262 		super(Layer,self).__init__(name)
   270 		super(Layer,self).__init__(name)
   263 		self.name = name
   271 		self.name = name
   264 
   272 
   265 		for c in componentlist:
   273 		for c in componentlist:
   266 			self.children.add(Component(c))
   274 			if isinstance(c, raptor_xml.SystemModelComponent):
       
   275 				# this component came from a system_definition.xml
       
   276 				self.children.add(Component(c, c.GetContainerName("layer"), c.GetContainerName("component")))
       
   277 			else:
       
   278 				# this is a plain old bld.inf file from the command-line
       
   279 				self.children.add(Component(c))
   267 
   280 
   268 	def unfurl(self, build):
   281 	def unfurl(self, build):
   269 		"""Discover the children of this layer. This involves parsing the component MetaData (bld.infs, mmps).
   282 		"""Discover the children of this layer. This involves parsing the component MetaData (bld.infs, mmps).
   270 		Takes a raptor object as a parameter (build), together with a list of Configurations.
   283 		Takes a raptor object as a parameter (build), together with a list of Configurations.
   271 
   284 
   326 		if build.quiet == True:
   339 		if build.quiet == True:
   327 			cli_options += " -q"
   340 			cli_options += " -q"
   328 
   341 
   329 		if build.timing == True:
   342 		if build.timing == True:
   330 			cli_options += " --timing"
   343 			cli_options += " --timing"
       
   344 
       
   345 		if build.noDependInclude == True:
       
   346 			cli_options += " --no-depend-include"
       
   347 
       
   348 		if build.noDependGenerate == True:
       
   349 			cli_options += " --no-depend-generate"
   331 
   350 
   332 
   351 
   333 		nc = len(self.children)
   352 		nc = len(self.children)
   334 		number_blocks = build.jobs
   353 		number_blocks = build.jobs
   335 		block_size = (nc / number_blocks) + 1
   354 		block_size = (nc / number_blocks) + 1
   499 		self.debugOutput = False
   518 		self.debugOutput = False
   500 		self.doExportOnly = False
   519 		self.doExportOnly = False
   501 		self.doExport = True
   520 		self.doExport = True
   502 		self.noBuild = False
   521 		self.noBuild = False
   503 		self.noDependInclude = False
   522 		self.noDependInclude = False
       
   523 		self.noDependGenerate = False
   504 		self.projects = set()
   524 		self.projects = set()
   505 
   525 
   506 		self.cache = raptor_cache.Cache(self)
   526 		self.cache = raptor_cache.Cache(self)
   507 		self.override = {env: str(self.home)}
   527 		self.override = {env: str(self.home)}
   508 		self.targets = []
   528 		self.targets = []
   615 		self.noBuild = TrueOrFalse
   635 		self.noBuild = TrueOrFalse
   616 		return True
   636 		return True
   617 
   637 
   618 	def SetNoDependInclude(self, TrueOrFalse):
   638 	def SetNoDependInclude(self, TrueOrFalse):
   619 		self.noDependInclude = TrueOrFalse
   639 		self.noDependInclude = TrueOrFalse
       
   640 		return True
       
   641 
       
   642 	def SetNoDependGenerate(self, TrueOrFalse):
       
   643 		self.noDependGenerate = TrueOrFalse
   620 		return True
   644 		return True
   621 
   645 
   622 	def SetKeepGoing(self, TrueOrFalse):
   646 	def SetKeepGoing(self, TrueOrFalse):
   623 		self.keepGoing = TrueOrFalse
   647 		self.keepGoing = TrueOrFalse
   624 		return True
   648 		return True