[DEBUG] correct the compilation with wrong dependency include ==> remove target optimisation

This commit is contained in:
Edouard DUPIN 2016-03-17 21:11:17 +01:00
parent 1ec07b9446
commit 87a4106101
2 changed files with 138 additions and 147 deletions

View File

@ -11,6 +11,7 @@
# for path inspection:
import sys
import os
import copy
import lutin
import lutin.debug as debug
import lutin.arg as arguments
@ -154,6 +155,15 @@ def usage(full=False):
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
exit(0)
def check_boolean(value):
if value == "" \
or value == "1" \
or value == "true" \
or value == "True" \
or value == True:
return True
return False
# preparse the argument to get the verbose element for debug mode
def parseGenericArg(argument, active):
debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active))
@ -201,66 +211,42 @@ def parseGenericArg(argument, active):
return True
elif argument.get_option_name() == "color":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
debug.enable_color()
else:
debug.disable_color()
return True
elif argument.get_option_name() == "force-build":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_mode(True)
else:
env.set_force_mode(False)
return True
elif argument.get_option_name() == "pretty":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
env.set_print_pretty_mode(True)
else:
env.set_print_pretty_mode(False)
return True
elif argument.get_option_name() == "force-optimisation":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_optimisation(True)
else:
env.set_force_optimisation(False)
return True
elif argument.get_option_name() == "force-strip":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_strip_mode(True)
else:
env.set_force_strip_mode(False)
return True
elif argument.get_option_name() == "warning":
if active==True:
if argument.get_arg() == "" \
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
if check_boolean(argument.get_arg()) == True:
env.set_warning_mode(True)
else:
env.set_warning_mode(False)
@ -326,8 +312,6 @@ config = {
"gcov":False,
"compilator-version":""
}
# load the default target :
my_target = None
actionDone=False
# parse all argument
for argument in localArgument:
@ -349,8 +333,6 @@ for argument in localArgument:
if config["compilator"] != argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg())
config["compilator"] = argument.get_arg()
#remove previous target
my_target = None
elif argument.get_option_name() == "target":
# No check input ==> this will be verify automaticly chen the target will be loaded
if targetName != argument.get_arg():
@ -367,23 +349,38 @@ for argument in localArgument:
"gcov":False,
"compilator-version":""
}
#remove previous target
my_target = None
elif argument.get_option_name() == "mode":
if config["mode"] != argument.get_arg():
config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + config["mode"])
#remove previous target
my_target = None
else:
argument_value = argument.get_arg()
debug.debug("something request : '" + argument_value + "'")
if argument.get_option_name() != "":
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
usage()
break;
name2 = argument_value.replace("@", "?")
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
if len(action_list) == 0:
action_list = "build"
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'")
multiple_module_list = []
if module_name[-1] == "*":
base_name = module_name[:-1]
for mod in module.list_all_module():
if mod[:len(base_name)] == base_name:
debug.verbose("need do it for: " + mod);
multiple_module_list.append(mod)
else:
#load the target if needed :
if my_target == None:
my_target = target.load_target(targetName, config)
my_target.build(argument.get_arg())
multiple_module_list.append(module_name)
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'")
for module_name in multiple_module_list:
#Load target with specific configuration:
my_target = target.load_target(targetName, copy.deepcopy(config))
my_target.build(module_name, actions=action_list)
actionDone=True
# if no action done : we do "all" ...

View File

@ -465,7 +465,17 @@ class Target:
mod.ext_project_add_module(self, projectMng, addedModule)
return
def build(self, name, packagesName=None, optionnal=False):
def build(self, name, packagesName=None, optionnal=False, actions=[]):
if len(name.split("?")) != 1\
or len(name.split("@")) != 1:
debug.error("need update")
if actions == "":
actions = ["build"]
if actions == []:
actions = ["build"]
if type(actions) == str:
actions = [action]
if name == "gcov":
debug.info("gcov all")
debug.error("must set the gcov parsing on a specific library or binary ==> not supported now for all")
@ -492,114 +502,98 @@ class Target:
for mod in self.module_list:
mod.clean(self)
else:
# get the action an the module ....
name2 = name.replace("@", "?")
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
if len(action_list) == 0:
action_list = ["build"]
debug.verbose("requested : " + module_name + " ? actions:" + str(action_list))
multiple_module_list = []
if module_name[-1] == "*":
base_name = module_name[:-1]
for mod in module.list_all_module():
if mod[:len(base_name)] == base_name:
debug.verbose("need do it for: " + mod);
multiple_module_list.append(mod)
else:
multiple_module_list.append(module_name)
for module_name in multiple_module_list:
for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
ret = None;
if action_name == "install":
try:
self.install_package(module_name)
except AttributeError:
debug.error("target have no 'install_package' instruction")
elif action_name == "uninstall":
try:
self.un_install_package(module_name)
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
if len(action_name) > 3:
# we have option:
action_name2 = action_name.replace("\:", "1234COLUMN4321")
option_list = action_name2.split(":")
if len(option_list) == 0:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list_tmp = option_list[1:]
option_list = []
for elem in option_list_tmp:
option_list.append(elem.replace("1234COLUMN4321", ":"))
else:
module_name = name
action_list = actions
for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
ret = None;
if action_name == "install":
try:
self.install_package(module_name)
except AttributeError:
debug.error("target have no 'install_package' instruction")
elif action_name == "uninstall":
try:
self.un_install_package(module_name)
except AttributeError:
debug.error("target have no 'un_install_package' instruction")
elif action_name[:3] == "run":
if len(action_name) > 3:
# we have option:
action_name2 = action_name.replace("\:", "1234COLUMN4321")
option_list = action_name2.split(":")
if len(option_list) == 0:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
#try:
self.run(module_name, option_list)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False]
else:
for mod in self.module_list:
if mod.name == module_name:
if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display(self)
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list = option_list[1:]
else:
option_list_tmp = option_list[1:]
option_list = []
for elem in option_list_tmp:
option_list.append(elem.replace("1234COLUMN4321", ":"))
else:
option_list = []
#try:
self.run(module_name, option_list)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
try:
self.show_log(module_name)
except AttributeError:
debug.error("target have no 'show_log' instruction")
else:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False]
else:
for mod in self.module_list:
if mod.name == module_name:
if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'")
if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display(self)
break
elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'")
if len(action_name) > 5:
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
ret = mod.clean(self)
break
elif action_name[:4] == "gcov":
debug.debug("gcov on module '" + module_name + "'")
if len(action_name) > 4:
# we have option:
option_list = action_name.split(":")
if len(option_list) == 0:
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, None), True]
else:
ret = mod.build(self, None)
break
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
option_list = option_list[1:]
else:
option_list = []
if "output" in option_list:
ret = mod.gcov(self, generate_output=True)
else:
ret = mod.gcov(self, generate_output=False)
break
elif action_name[:5] == "build":
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
if optionnal == True:
ret = [mod.build(self, None), True]
else:
ret = mod.build(self, None)
break
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
if len(action_list) == 1:
return ret