Ejemplo n.º 1
0
def handle_action(args):
	Core.preprocess_arguments(args)

	# populate args.architecture with sane values
	args.architecture = filter_architectures(
		args.architecture,
		Core.supported_architectures,
		TargetPlatform.instance.default_architectures()
	)

	# Now that we have a list of architectures -- verify the target
	# platform can use that.
	for arch in args.architecture:
		if not TargetPlatform.compiler.supports_build_architecture(
					Language.CPP, arch
				):
			raise Exception(
				"TargetPlatform does not support architecture: %s!" % arch
			)


	global_params = Attributes()



	if args.command in ["generate", "build", "clean"]:
		# required for running command-line utils
		executor = Executor()

		# This first step accomplishes the following:
		# - loops through all product data in buildfile and generates dependencies
		# - use/generate BuildCache by associated products and dependencies with buildfiles
		gather_product_data(
			args,
			args.architecture,
			args.configuration,
			os.path.abspath(args.build_file),
			args.products if getattr(args, "products", None) else None,
			global_params,
			executor,
			[]
		)

		# Using the buildcache we generated (or loaded) above,
		# execute the command on products in the correct order.
		BuildCache.execute_command(executor, args.command, execute_command)

		# save file manager data
		FileManager.instance.save()
	elif args.command in ["distclean"]:
		FileManager.instance.distclean()