[DEV] add warning file generation
This commit is contained in:
parent
eeb070e014
commit
93693ed0f0
43
bin/lutin
43
bin/lutin
@ -27,6 +27,7 @@ myArgs.add(arguments.ArgDefine("f", "force", desc="Force the rebuild without che
|
||||
myArgs.add(arguments.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
||||
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
||||
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
|
||||
|
||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
||||
@ -70,12 +71,12 @@ def usage():
|
||||
|
||||
# preparse the argument to get the verbose element for debug mode
|
||||
def parseGenericArg(argument, active):
|
||||
if argument.get_option_nName() == "help":
|
||||
if argument.get_option_name() == "help":
|
||||
#display help
|
||||
if active==False:
|
||||
usage()
|
||||
return True
|
||||
if argument.get_option_nName() == "list-module":
|
||||
if argument.get_option_name() == "list-module":
|
||||
if active==False:
|
||||
listOfModule = module.list_all_module()
|
||||
retValue = ""
|
||||
@ -86,7 +87,7 @@ def parseGenericArg(argument, active):
|
||||
print(retValue)
|
||||
exit(0)
|
||||
return True
|
||||
if argument.get_option_nName() == "list-target":
|
||||
if argument.get_option_name() == "list-target":
|
||||
if active==False:
|
||||
listOfTarget = target.list_all_target()
|
||||
retValue = ""
|
||||
@ -97,30 +98,34 @@ def parseGenericArg(argument, active):
|
||||
print(retValue)
|
||||
exit(0)
|
||||
return True
|
||||
elif argument.get_option_nName()=="jobs":
|
||||
elif argument.get_option_name()=="jobs":
|
||||
if active==True:
|
||||
multiprocess.set_core_number(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_nName() == "verbose":
|
||||
elif argument.get_option_name() == "verbose":
|
||||
if active==True:
|
||||
debug.set_level(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_nName() == "color":
|
||||
elif argument.get_option_name() == "color":
|
||||
if active==True:
|
||||
debug.enable_color()
|
||||
return True
|
||||
elif argument.get_option_nName() == "force":
|
||||
elif argument.get_option_name() == "force":
|
||||
if active==True:
|
||||
env.set_force_mode(True)
|
||||
return True
|
||||
elif argument.get_option_nName() == "pretty":
|
||||
elif argument.get_option_name() == "pretty":
|
||||
if active==True:
|
||||
env.set_print_pretty_mode(True)
|
||||
return True
|
||||
elif argument.get_option_nName() == "force-strip":
|
||||
elif argument.get_option_name() == "force-strip":
|
||||
if active==True:
|
||||
env.set_force_strip_mode(True)
|
||||
return True
|
||||
elif argument.get_option_name() == "warning":
|
||||
if active==True:
|
||||
env.set_warning_mode(True)
|
||||
return True
|
||||
return False
|
||||
|
||||
# parse default unique argument:
|
||||
@ -153,25 +158,25 @@ actionDone=False
|
||||
for argument in localArgument:
|
||||
if parseGenericArg(argument, False) == True:
|
||||
continue
|
||||
elif argument.get_option_nName() == "compilator-version":
|
||||
elif argument.get_option_name() == "compilator-version":
|
||||
config["compilator-version"] = argument.get_arg()
|
||||
elif argument.get_option_nName() == "package":
|
||||
elif argument.get_option_name() == "package":
|
||||
config["generate-package"]=False
|
||||
elif argument.get_option_nName() == "simulation":
|
||||
elif argument.get_option_name() == "simulation":
|
||||
config["simulation"]=True
|
||||
elif argument.get_option_nName() == "gcov":
|
||||
elif argument.get_option_name() == "gcov":
|
||||
config["gcov"]=True
|
||||
elif argument.get_option_nName() == "bus":
|
||||
elif argument.get_option_name() == "bus":
|
||||
config["bus-size"]=argument.get_arg()
|
||||
elif argument.get_option_nName() == "arch":
|
||||
elif argument.get_option_name() == "arch":
|
||||
config["arch"]=argument.get_arg()
|
||||
elif argument.get_option_nName() == "compilator":
|
||||
elif argument.get_option_name() == "compilator":
|
||||
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_nName() == "target":
|
||||
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():
|
||||
targetName = argument.get_arg()
|
||||
@ -189,14 +194,14 @@ for argument in localArgument:
|
||||
}
|
||||
#remove previous target
|
||||
my_target = None
|
||||
elif argument.get_option_nName() == "mode":
|
||||
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:
|
||||
if argument.get_option_nName() != "":
|
||||
if argument.get_option_name() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
||||
usage()
|
||||
else:
|
||||
|
92
lutin/arg.py
92
lutin/arg.py
@ -12,22 +12,22 @@ from . import debug
|
||||
|
||||
class ArgElement:
|
||||
def __init__(self, option, value=""):
|
||||
self.m_option = option;
|
||||
self.m_arg = value;
|
||||
self.option = option;
|
||||
self.arg = value;
|
||||
|
||||
def get_option_nName(self):
|
||||
return self.m_option
|
||||
def get_option_name(self):
|
||||
return self.option
|
||||
|
||||
def get_arg(self):
|
||||
return self.m_arg
|
||||
return self.arg
|
||||
|
||||
def display(self):
|
||||
if len(self.m_arg)==0:
|
||||
debug.info("option : " + self.m_option)
|
||||
elif len(self.m_option)==0:
|
||||
debug.info("element : " + self.m_arg)
|
||||
if len(self.arg)==0:
|
||||
debug.info("option : " + self.option)
|
||||
elif len(self.option)==0:
|
||||
debug.info("element : " + self.arg)
|
||||
else:
|
||||
debug.info("option : " + self.m_option + ":" + self.m_arg)
|
||||
debug.info("option : " + self.option + ":" + self.arg)
|
||||
|
||||
|
||||
class ArgDefine:
|
||||
@ -37,62 +37,62 @@ class ArgDefine:
|
||||
list=[], # ["val", "description"]
|
||||
desc="",
|
||||
haveParam=False):
|
||||
self.m_optionSmall = smallOption;
|
||||
self.m_optionBig = bigOption;
|
||||
self.m_list = list;
|
||||
if len(self.m_list)!=0:
|
||||
self.m_haveParam = True
|
||||
self.option_small = smallOption;
|
||||
self.option_big = bigOption;
|
||||
self.list = list;
|
||||
if len(self.list)!=0:
|
||||
self.have_param = True
|
||||
else:
|
||||
if True==haveParam:
|
||||
self.m_haveParam = True
|
||||
self.have_param = True
|
||||
else:
|
||||
self.m_haveParam = False
|
||||
self.m_description = desc;
|
||||
self.have_param = False
|
||||
self.description = desc;
|
||||
|
||||
def get_option_small(self):
|
||||
return self.m_optionSmall
|
||||
return self.option_small
|
||||
|
||||
def get_option_big(self):
|
||||
return self.m_optionBig
|
||||
return self.option_big
|
||||
|
||||
def need_parameters(self):
|
||||
return self.m_haveParam
|
||||
return self.have_param
|
||||
|
||||
def get_porperties(self):
|
||||
return ""
|
||||
|
||||
def check_availlable(self, argument):
|
||||
if len(self.m_list)==0:
|
||||
if len(self.list)==0:
|
||||
return True
|
||||
for element,desc in self.m_list:
|
||||
for element,desc in self.list:
|
||||
if element == argument:
|
||||
return True
|
||||
return False
|
||||
|
||||
def display(self):
|
||||
color = debug.get_color_set()
|
||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
||||
print(" " + color['red'] + "-" + self.m_optionSmall + "" + color['default'] + " / " + color['red'] + "--" + self.m_optionBig + color['default'])
|
||||
elif self.m_optionSmall != "":
|
||||
print(" " + color['red'] + "-" + self.m_optionSmall + color['default'])
|
||||
elif self.m_optionBig != "":
|
||||
print(" " + color['red'] + "--" + self.m_optionBig + color['default'])
|
||||
if self.option_small != "" and self.option_big != "":
|
||||
print(" " + color['red'] + "-" + self.option_small + "" + color['default'] + " / " + color['red'] + "--" + self.option_big + color['default'])
|
||||
elif self.option_small != "":
|
||||
print(" " + color['red'] + "-" + self.option_small + color['default'])
|
||||
elif self.option_big != "":
|
||||
print(" " + color['red'] + "--" + self.option_big + color['default'])
|
||||
else:
|
||||
print(" ???? ==> internal error ...")
|
||||
if self.m_description != "":
|
||||
print(" " + self.m_description)
|
||||
if len(self.m_list)!=0:
|
||||
if self.description != "":
|
||||
print(" " + self.description)
|
||||
if len(self.list)!=0:
|
||||
hasDescriptiveElement=False
|
||||
for val,desc in self.m_list:
|
||||
for val,desc in self.list:
|
||||
if desc!="":
|
||||
hasDescriptiveElement=True
|
||||
break;
|
||||
if hasDescriptiveElement==True:
|
||||
for val,desc in self.m_list:
|
||||
for val,desc in self.list:
|
||||
print(" " + val + " : " + desc)
|
||||
else:
|
||||
tmpElementPrint = ""
|
||||
for val,desc in self.m_list:
|
||||
for val,desc in self.list:
|
||||
if len(tmpElementPrint)!=0:
|
||||
tmpElementPrint += " / "
|
||||
tmpElementPrint += val
|
||||
@ -106,8 +106,8 @@ class ArgSection:
|
||||
def __init__(self,
|
||||
sectionName="",
|
||||
desc=""):
|
||||
self.m_section = sectionName;
|
||||
self.m_description = desc;
|
||||
self.section = sectionName;
|
||||
self.description = desc;
|
||||
|
||||
def get_option_small(self):
|
||||
return ""
|
||||
@ -117,11 +117,11 @@ class ArgSection:
|
||||
|
||||
def get_porperties(self):
|
||||
color = debug.get_color_set()
|
||||
return " [" + color['blue'] + self.m_section + color['default'] + "]"
|
||||
return " [" + color['blue'] + self.section + color['default'] + "]"
|
||||
|
||||
def display(self):
|
||||
color = debug.get_color_set()
|
||||
print(" [" + color['blue'] + self.m_section + color['default'] + "] : " + self.m_description)
|
||||
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
|
||||
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
@ -129,13 +129,13 @@ class ArgSection:
|
||||
|
||||
class LutinArg:
|
||||
def __init__(self):
|
||||
self.m_listProperties = []
|
||||
self.listProperties = []
|
||||
|
||||
def add(self, argument):
|
||||
self.m_listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||
self.listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||
|
||||
def add_section(self, sectionName, sectionDesc):
|
||||
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||
self.listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||
|
||||
def parse(self):
|
||||
listArgument = [] # composed of list element
|
||||
@ -158,7 +158,7 @@ class LutinArg:
|
||||
argumentFound=False;
|
||||
if option[:2]=="--":
|
||||
# big argument
|
||||
for prop in self.m_listProperties:
|
||||
for prop in self.listProperties:
|
||||
if prop.get_option_big()=="":
|
||||
continue
|
||||
if prop.get_option_big() == option[2:]:
|
||||
@ -200,7 +200,7 @@ class LutinArg:
|
||||
debug.error("UNKNOW argument : '" + argument + "'")
|
||||
elif option[:1]=="-":
|
||||
# small argument
|
||||
for prop in self.m_listProperties:
|
||||
for prop in self.listProperties:
|
||||
if prop.get_option_small()=="":
|
||||
continue
|
||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||
@ -254,8 +254,8 @@ class LutinArg:
|
||||
def display(self):
|
||||
print("usage:")
|
||||
listOfPropertiesArg = "";
|
||||
for element in self.m_listProperties :
|
||||
for element in self.listProperties :
|
||||
listOfPropertiesArg += element.get_porperties()
|
||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||
for element in self.m_listProperties :
|
||||
for element in self.listProperties :
|
||||
element.display()
|
65
lutin/env.py
65
lutin/env.py
@ -12,32 +12,45 @@ from . import debug
|
||||
|
||||
|
||||
|
||||
forceMode=False
|
||||
force_mode=False
|
||||
|
||||
def set_force_mode(val):
|
||||
global forceMode
|
||||
global force_mode
|
||||
if val==1:
|
||||
forceMode = 1
|
||||
force_mode = 1
|
||||
else:
|
||||
forceMode = 0
|
||||
force_mode = 0
|
||||
|
||||
def get_force_mode():
|
||||
global forceMode
|
||||
return forceMode
|
||||
global force_mode
|
||||
return force_mode
|
||||
|
||||
|
||||
printPrettyMode=False
|
||||
print_pretty_mode=False
|
||||
|
||||
def set_print_pretty_mode(val):
|
||||
global printPrettyMode
|
||||
global print_pretty_mode
|
||||
if val == True:
|
||||
printPrettyMode = True
|
||||
print_pretty_mode = True
|
||||
else:
|
||||
printPrettyMode = False
|
||||
print_pretty_mode = False
|
||||
|
||||
def get_print_pretty_mode():
|
||||
global printPrettyMode
|
||||
return printPrettyMode
|
||||
global print_pretty_mode
|
||||
return print_pretty_mode
|
||||
|
||||
store_warning=False
|
||||
def set_warning_mode(val):
|
||||
global store_warning
|
||||
if val == True:
|
||||
store_warning = True
|
||||
else:
|
||||
store_warning = False
|
||||
|
||||
def get_warning_mode():
|
||||
global store_warning
|
||||
return store_warning
|
||||
|
||||
|
||||
def end_with(name, list):
|
||||
for appl in list:
|
||||
@ -47,14 +60,14 @@ def end_with(name, list):
|
||||
return False
|
||||
|
||||
|
||||
def print_pretty(myString, force=False):
|
||||
global printPrettyMode
|
||||
if printPrettyMode == True \
|
||||
def print_pretty(my_string, force=False):
|
||||
global print_pretty_mode
|
||||
if print_pretty_mode == True \
|
||||
or force == True:
|
||||
if myString[len(myString)-1] == ' ':
|
||||
tmpcmdLine = myString[:len(myString)-1]
|
||||
if my_string[len(my_string)-1] == ' ':
|
||||
tmpcmdLine = my_string[:len(my_string)-1]
|
||||
else:
|
||||
tmpcmdLine = myString
|
||||
tmpcmdLine = my_string
|
||||
cmdApplication = tmpcmdLine.split(' ')[0]
|
||||
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||
@ -103,18 +116,18 @@ def print_pretty(myString, force=False):
|
||||
|
||||
return tmpcmdLine
|
||||
else:
|
||||
return myString
|
||||
return my_string
|
||||
|
||||
forceStripMode=False
|
||||
force_strip_mode=False
|
||||
|
||||
def set_force_strip_mode(val):
|
||||
global forceStripMode
|
||||
if val==True:
|
||||
forceStripMode = True
|
||||
global force_strip_mode
|
||||
if val == True:
|
||||
force_strip_mode = True
|
||||
else:
|
||||
forceStripMode = False
|
||||
force_strip_mode = False
|
||||
|
||||
def get_force_strip_mode():
|
||||
global forceStripMode
|
||||
return forceStripMode
|
||||
global force_strip_mode
|
||||
return force_strip_mode
|
||||
|
||||
|
@ -31,7 +31,7 @@ class HeritageList:
|
||||
self.src=[]
|
||||
self.path={}
|
||||
|
||||
self.listHeritage=[]
|
||||
self.list_heritage=[]
|
||||
if heritage != None:
|
||||
self.add_heritage(heritage)
|
||||
|
||||
@ -39,22 +39,22 @@ class HeritageList:
|
||||
if type(heritage) == type(None) \
|
||||
or heritage.name == "":
|
||||
return
|
||||
for element in self.listHeritage:
|
||||
for element in self.list_heritage:
|
||||
if element.name == heritage.name:
|
||||
return
|
||||
self.listHeritage.append(heritage)
|
||||
self.list_heritage.append(heritage)
|
||||
self.regenerate_tree()
|
||||
|
||||
def add_heritage_list(self, heritage_list):
|
||||
if type(heritage_list) == type(None):
|
||||
return
|
||||
for herit in heritage_list.listHeritage:
|
||||
for herit in heritage_list.list_heritage:
|
||||
find = False
|
||||
for element in self.listHeritage:
|
||||
for element in self.list_heritage:
|
||||
if element.name == herit.name:
|
||||
find = True
|
||||
if find == False:
|
||||
self.listHeritage.append(herit)
|
||||
self.list_heritage.append(herit)
|
||||
self.regenerate_tree()
|
||||
|
||||
def regenerate_tree(self):
|
||||
@ -63,34 +63,34 @@ class HeritageList:
|
||||
self.src=[]
|
||||
self.path={}
|
||||
# reorder heritage list :
|
||||
listHeritage = self.listHeritage
|
||||
self.listHeritage = []
|
||||
listHeritage = self.list_heritage
|
||||
self.list_heritage = []
|
||||
# first step : add all lib with no dependency:
|
||||
for herit in listHeritage:
|
||||
if len(herit.depends) == 0:
|
||||
self.listHeritage.append(herit)
|
||||
self.list_heritage.append(herit)
|
||||
listHeritage.remove(herit)
|
||||
while len(listHeritage) > 0:
|
||||
currentHeritageSize = len(listHeritage)
|
||||
debug.verbose("list heritage = " + str([[x.name, x.depends] for x in listHeritage]))
|
||||
# Add element only when all dependence are resolved
|
||||
for herit in listHeritage:
|
||||
listDependsName = [y.name for y in self.listHeritage]
|
||||
listDependsName = [y.name for y in self.list_heritage]
|
||||
if all(x in listDependsName for x in herit.depends) == True:
|
||||
listHeritage.remove(herit)
|
||||
self.listHeritage.append(herit)
|
||||
self.list_heritage.append(herit)
|
||||
if currentHeritageSize == len(listHeritage):
|
||||
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
|
||||
for herit in listHeritage:
|
||||
self.listHeritage.append(herit)
|
||||
self.list_heritage.append(herit)
|
||||
listHeritage = []
|
||||
debug.warning("new heritage list:")
|
||||
for element in self.listHeritage:
|
||||
for element in self.list_heritage:
|
||||
debug.warning(" " + element.name + " " + str(element.depends))
|
||||
debug.verbose("new heritage list:")
|
||||
for element in self.listHeritage:
|
||||
for element in self.list_heritage:
|
||||
debug.verbose(" " + element.name + " " + str(element.depends))
|
||||
for element in reversed(self.listHeritage):
|
||||
for element in reversed(self.list_heritage):
|
||||
for flags in element.flags:
|
||||
if flags in ["c-version", "c++-version"]:
|
||||
continue
|
||||
|
140
lutin/module.py
140
lutin/module.py
@ -57,7 +57,7 @@ class Module:
|
||||
# sources list:
|
||||
self.src = []
|
||||
# copy files and folders:
|
||||
self.imageToCopy = []
|
||||
self.image_to_copy = []
|
||||
self.files = []
|
||||
self.folders = []
|
||||
self.isbuild = False
|
||||
@ -127,7 +127,7 @@ class Module:
|
||||
## @brief Commands for copying files
|
||||
##
|
||||
def image_to_staging(self, binary_name, target):
|
||||
for source, destination, sizeX, sizeY in self.imageToCopy:
|
||||
for source, destination, sizeX, sizeY in self.image_to_copy:
|
||||
extension = source[source.rfind('.'):]
|
||||
if extension != ".png" \
|
||||
and extension != ".jpg" \
|
||||
@ -329,7 +329,7 @@ class Module:
|
||||
fileExt = file.split(".")[-1]
|
||||
try:
|
||||
tmp_builder = builder.get_builder(fileExt);
|
||||
resFile = tmp_builder.compile(file,
|
||||
res_file = tmp_builder.compile(file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
@ -337,12 +337,12 @@ class Module:
|
||||
path = self.path,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
if resFile["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(resFile["file"])
|
||||
elif resFile["action"] == "path":
|
||||
self.add_path(resFile["path"], type='c')
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
self.add_path(res_file["path"], type='c')
|
||||
else:
|
||||
debug.error("an not do action for : " + str(resFile))
|
||||
debug.error("an not do action for : " + str(res_file))
|
||||
except ValueError:
|
||||
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
||||
# now build the other :
|
||||
@ -352,7 +352,7 @@ class Module:
|
||||
fileExt = file.split(".")[-1]
|
||||
try:
|
||||
tmp_builder = builder.get_builder(fileExt);
|
||||
resFile = tmp_builder.compile(file,
|
||||
res_file = tmp_builder.compile(file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
@ -360,12 +360,12 @@ class Module:
|
||||
path = self.path,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
if resFile["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(resFile["file"])
|
||||
elif resFile["action"] == "path":
|
||||
self.add_path(resFile["path"], type='c')
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
self.add_path(res_file["path"], type='c')
|
||||
else:
|
||||
debug.error("an not do action for : " + str(resFile))
|
||||
debug.error("an not do action for : " + str(res_file))
|
||||
except ValueError:
|
||||
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
||||
# when multiprocess availlable, we need to synchronize here ...
|
||||
@ -380,37 +380,37 @@ class Module:
|
||||
tmp_builder = builder.get_builder_with_output("a");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
if len(list_file) > 0:
|
||||
resFile = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(resFile)
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.a'")
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("jar");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
if len(list_file) > 0:
|
||||
resFile = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(resFile)
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||
elif self.type=='BINARY':
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("bin");
|
||||
resFile = tmp_builder.link(list_sub_file_needed_to_build,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.bin'")
|
||||
# generate tree for this special binary
|
||||
@ -423,37 +423,37 @@ class Module:
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("so");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
resFile = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = "lib" + self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(resFile)
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = "lib" + self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.so'")
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("jar");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
if len(list_file) > 0:
|
||||
resFile = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(resFile)
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||
else:
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("bin");
|
||||
resFile = tmp_builder.link(list_sub_file_needed_to_build,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_folder = self.origin_folder)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: 'binary'")
|
||||
target.clean_module_tree()
|
||||
@ -477,7 +477,7 @@ class Module:
|
||||
# call here to build the module
|
||||
def build_tree(self, target, package_name):
|
||||
# ckeck if not previously build
|
||||
if target.is_module_buildTree(self.name)==True:
|
||||
if target.is_module_build_tree(self.name)==True:
|
||||
return
|
||||
debug.verbose("build tree of " + self.name)
|
||||
# add all the elements (first added only one keep ==> permit to everload sublib element)
|
||||
@ -519,14 +519,14 @@ class Module:
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internalList2(self, listout, module, list, order=False):
|
||||
def append_to_internal_list2(self, listout, module, list, order=False):
|
||||
# add list in the Map
|
||||
if module not in listout:
|
||||
listout[module] = []
|
||||
# add elements...
|
||||
self.append_to_internalList(listout[module], list, order)
|
||||
self.append_to_internal_list(listout[module], list, order)
|
||||
|
||||
def append_to_internalList(self, listout, list, order=False):
|
||||
def append_to_internal_list(self, listout, list, order=False):
|
||||
if type(list) == type(str()):
|
||||
self.append_and_check(listout, list, order)
|
||||
else:
|
||||
@ -535,23 +535,23 @@ class Module:
|
||||
self.append_and_check(listout, elem, order)
|
||||
|
||||
def add_module_depend(self, list):
|
||||
self.append_to_internalList(self.depends, list, True)
|
||||
self.append_to_internal_list(self.depends, list, True)
|
||||
|
||||
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
|
||||
def add_export_path(self, list, type='c'):
|
||||
self.append_to_internalList2(self.path["export"], type, list)
|
||||
self.append_to_internal_list2(self.path["export"], type, list)
|
||||
|
||||
def add_path(self, list, type='c'):
|
||||
self.append_to_internalList2(self.path["local"], type, list)
|
||||
self.append_to_internal_list2(self.path["local"], type, list)
|
||||
|
||||
def add_export_flag(self, type, list):
|
||||
self.append_to_internalList2(self.flags["export"], type, list)
|
||||
self.append_to_internal_list2(self.flags["export"], type, list)
|
||||
|
||||
# add the link flag at the module
|
||||
def compile_flags(self, type, list):
|
||||
self.append_to_internalList2(self.flags["local"], type, list)
|
||||
self.append_to_internal_list2(self.flags["local"], type, list)
|
||||
|
||||
def compile_version_XX(self, version, same_as_api=True, gnu=False):
|
||||
cpp_version_list = [1999, 2003, 2011, 2014]
|
||||
@ -584,10 +584,10 @@ class Module:
|
||||
debug.warning("Can not propagate the gnu extention of the C vesion for API");
|
||||
|
||||
def add_src_file(self, list):
|
||||
self.append_to_internalList(self.src, list, True)
|
||||
self.append_to_internal_list(self.src, list, True)
|
||||
|
||||
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
||||
self.imageToCopy.append([source, destination, sizeX, sizeY])
|
||||
self.image_to_copy.append([source, destination, sizeX, sizeY])
|
||||
|
||||
def copy_file(self, source, destination=''):
|
||||
self.files.append([source, destination])
|
||||
@ -734,21 +734,21 @@ class Module:
|
||||
|
||||
|
||||
moduleList=[]
|
||||
__startModuleName="lutin_"
|
||||
__start_module_name="lutin_"
|
||||
|
||||
def import_path(path):
|
||||
global moduleList
|
||||
matches = []
|
||||
debug.debug('MODULE: Start find sub File : "%s"' %path)
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
tmpList = fnmatch.filter(filenames, __startModuleName + "*.py")
|
||||
tmpList = fnmatch.filter(filenames, __start_module_name + "*.py")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
debug.debug('Module: Find a file : "%s"' %os.path.join(root, filename))
|
||||
#matches.append(os.path.join(root, filename))
|
||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||
moduleName = filename.replace('.py', '')
|
||||
moduleName = moduleName.replace(__startModuleName, '')
|
||||
moduleName = moduleName.replace(__start_module_name, '')
|
||||
debug.debug("MODULE: Integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
||||
moduleList.append([moduleName,os.path.join(root, filename)])
|
||||
|
||||
@ -764,8 +764,8 @@ def load_module(target, name):
|
||||
for mod in moduleList:
|
||||
if mod[0] == name:
|
||||
sys.path.append(os.path.dirname(mod[1]))
|
||||
debug.verbose("import module : '" + __startModuleName + name + "'")
|
||||
theModule = __import__(__startModuleName + name)
|
||||
debug.verbose("import module : '" + __start_module_name + name + "'")
|
||||
theModule = __import__(__start_module_name + name)
|
||||
#try:
|
||||
tmpElement = theModule.create(target)
|
||||
#except:
|
||||
|
@ -42,24 +42,50 @@ isinit = False # the thread are initialized
|
||||
errorOccured = False # a thread have an error
|
||||
processorAvaillable = 1 # number of CPU core availlable
|
||||
|
||||
def store_command(cmdLine, file):
|
||||
def store_command(cmd_line, file):
|
||||
# write cmd line only after to prevent errors ...
|
||||
if file != "" \
|
||||
and file != None:
|
||||
# Create directory:
|
||||
tools.create_directory_of_file(file)
|
||||
# Store the command Line:
|
||||
file2 = open(file, "w")
|
||||
file2.write(cmdLine)
|
||||
file2.flush()
|
||||
file2.close()
|
||||
if file != "" \
|
||||
or file != None:
|
||||
return;
|
||||
debug.verbose("create cmd file: " + file)
|
||||
# Create directory:
|
||||
tools.create_directory_of_file(file)
|
||||
# Store the command Line:
|
||||
file2 = open(file, "w")
|
||||
file2.write(cmd_line)
|
||||
file2.flush()
|
||||
file2.close()
|
||||
|
||||
def store_warning(file, output, err):
|
||||
# write warning line only after to prevent errors ...
|
||||
if file == "" \
|
||||
or file == None:
|
||||
return;
|
||||
if env.get_warning_mode() == False:
|
||||
debug.verbose("remove warning file: " + file)
|
||||
# remove file if exist...
|
||||
tools.remove_file(file);
|
||||
return;
|
||||
debug.verbose("create warning file: " + file)
|
||||
# Create directory:
|
||||
tools.create_directory_of_file(file)
|
||||
# Store the command Line:
|
||||
file2 = open(file, "w")
|
||||
file2.write("===== output =====\n")
|
||||
file2.write(output)
|
||||
file2.write("\n\n")
|
||||
file2.write("===== error =====\n")
|
||||
file2.write(err)
|
||||
file2.write("\n\n")
|
||||
file2.flush()
|
||||
file2.close()
|
||||
|
||||
##
|
||||
## @brief Execute the command and ruturn generate data
|
||||
##
|
||||
def run_command_direct(cmdLine):
|
||||
def run_command_direct(cmd_line):
|
||||
# prepare command line:
|
||||
args = shlex.split(cmdLine)
|
||||
args = shlex.split(cmd_line)
|
||||
debug.verbose("cmd = " + str(args))
|
||||
try:
|
||||
# create the subprocess
|
||||
@ -82,12 +108,12 @@ def run_command_direct(cmdLine):
|
||||
return False
|
||||
|
||||
|
||||
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file=""):
|
||||
global errorOccured
|
||||
global exitFlag
|
||||
global currentIdExecution
|
||||
# prepare command line:
|
||||
args = shlex.split(cmdLine)
|
||||
args = shlex.split(cmd_line)
|
||||
debug.verbose("cmd = " + str(args))
|
||||
try:
|
||||
# create the subprocess
|
||||
@ -101,12 +127,14 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
if sys.version_info >= (3, 0):
|
||||
output = output.decode("utf-8")
|
||||
err = err.decode("utf-8")
|
||||
# store error if needed:
|
||||
store_warning(store_output_file, output, err)
|
||||
# Check error :
|
||||
if p.returncode == 0:
|
||||
debug.debug(env.print_pretty(cmdLine))
|
||||
debug.debug(env.print_pretty(cmd_line))
|
||||
queueLock.acquire()
|
||||
# TODO : Print the output all the time .... ==> to show warnings ...
|
||||
if buildId >= 0 and (output != "" or err != ""):
|
||||
if build_id >= 0 and (output != "" or err != ""):
|
||||
debug.warning("output in subprocess compiling: '" + file + "'")
|
||||
if output != "":
|
||||
debug.print_compilator(output)
|
||||
@ -117,8 +145,8 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
errorOccured = True
|
||||
exitFlag = True
|
||||
# if No ID : Not in a multiprocess mode ==> just stop here
|
||||
if buildId < 0:
|
||||
debug.debug(env.print_pretty(cmdLine), force=True)
|
||||
if build_id < 0:
|
||||
debug.debug(env.print_pretty(cmd_line), force=True)
|
||||
debug.print_compilator(output)
|
||||
debug.print_compilator(err)
|
||||
if p.returncode == 2:
|
||||
@ -129,12 +157,12 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
# in multiprocess interface
|
||||
queueLock.acquire()
|
||||
# if an other write an error before, check if the current process is started before ==> then is the first error
|
||||
if errorExecution["id"] >= buildId:
|
||||
if errorExecution["id"] >= build_id:
|
||||
# nothing to do ...
|
||||
queueLock.release()
|
||||
return;
|
||||
errorExecution["id"] = buildId
|
||||
errorExecution["cmd"] = cmdLine
|
||||
errorExecution["id"] = build_id
|
||||
errorExecution["cmd"] = cmd_line
|
||||
errorExecution["return"] = p.returncode
|
||||
errorExecution["err"] = err,
|
||||
errorExecution["out"] = output,
|
||||
@ -143,14 +171,14 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
return
|
||||
debug.verbose("done 3")
|
||||
# write cmd line only after to prevent errors ...
|
||||
store_command(cmdLine, storeCmdLine)
|
||||
store_command(cmd_line, store_cmd_line)
|
||||
|
||||
|
||||
|
||||
class myThread(threading.Thread):
|
||||
def __init__(self, threadID, lock, queue):
|
||||
threading.Thread.__init__(self)
|
||||
self.threadID = threadID
|
||||
self.thread_id = threadID
|
||||
self.name = "Thread " + str(threadID)
|
||||
self.queue = queue
|
||||
self.lock = lock
|
||||
@ -172,8 +200,8 @@ class myThread(threading.Thread):
|
||||
comment = data[2]
|
||||
cmdLine = data[1]
|
||||
cmdStoreFile = data[3]
|
||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, cmdStoreFile, buildId=data[4], file=comment[3])
|
||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, cmdStoreFile, build_id=data[4], file=comment[3], store_output_file=data[5])
|
||||
else:
|
||||
debug.warning("unknow request command : " + data[0])
|
||||
else:
|
||||
@ -228,18 +256,18 @@ def un_init():
|
||||
|
||||
|
||||
|
||||
def run_in_pool(cmdLine, comment, storeCmdLine=""):
|
||||
def run_in_pool(cmd_line, comment, store_cmd_line="", store_output_file=""):
|
||||
global currentIdExecution
|
||||
if processorAvaillable <= 1:
|
||||
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, storeCmdLine, file=comment[3])
|
||||
run_command(cmd_line, store_cmd_line, file=comment[3], store_output_file=store_output_file)
|
||||
return
|
||||
# multithreaded mode
|
||||
init()
|
||||
# Fill the queue
|
||||
queueLock.acquire()
|
||||
debug.verbose("add : in pool cmdLine")
|
||||
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine, currentIdExecution])
|
||||
workQueue.put(["cmdLine", cmd_line, comment, store_cmd_line, currentIdExecution, store_output_file])
|
||||
currentIdExecution +=1;
|
||||
queueLock.release()
|
||||
|
||||
|
@ -98,7 +98,7 @@ def createModuleFromSystem(target, dict):
|
||||
# Dictionnaire of Target name
|
||||
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
||||
systemList={}
|
||||
__startSystemName="lutinSystem_"
|
||||
__start_system_name="lutinSystem_"
|
||||
|
||||
|
||||
def import_path(path):
|
||||
@ -106,13 +106,13 @@ def import_path(path):
|
||||
matches = []
|
||||
debug.debug('Start find sub File : "%s"' %path)
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
tmpList = fnmatch.filter(filenames, __startSystemName + "*.py")
|
||||
tmpList = fnmatch.filter(filenames, __start_system_name + "*.py")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
|
||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||
systemName = filename.replace('.py', '')
|
||||
systemName = systemName.replace(__startSystemName, '')
|
||||
systemName = systemName.replace(__start_system_name, '')
|
||||
targetType, systemName = systemName.split('_')
|
||||
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
|
||||
if targetType in systemList:
|
||||
@ -151,7 +151,7 @@ def exist(lib_name, target_name, target) :
|
||||
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
||||
sys.path.append(os.path.dirname(data["path"]))
|
||||
debug.verbose("import system : '" + data["name"] + "'")
|
||||
theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
|
||||
theSystem = __import__(__start_system_name + target_name + "_" + data["name"])
|
||||
#create the system module
|
||||
try:
|
||||
debug.info("call : " + data["name"])
|
||||
|
@ -26,9 +26,9 @@ class Target:
|
||||
self.config = config
|
||||
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
self.selectArch = config["arch"]; # TODO : Remove THIS ...
|
||||
self.select_arch = config["arch"]; # TODO : Remove THIS ...
|
||||
#bus size selection (auto/32/64)
|
||||
self.selectBus = config["bus-size"]; # TODO : Remove THIS ...
|
||||
self.select_bus = config["bus-size"]; # TODO : Remove THIS ...
|
||||
|
||||
if config["bus-size"] == "auto":
|
||||
debug.error("system error ==> must generate the default 'bus-size' config")
|
||||
@ -44,7 +44,7 @@ class Target:
|
||||
# todo : remove this :
|
||||
self.sumulator = config["simulation"]
|
||||
self.name=name
|
||||
self.endGeneratePackage = config["generate-package"]
|
||||
self.end_generate_package = config["generate-package"]
|
||||
debug.info("=================================");
|
||||
debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
|
||||
debug.info("=================================");
|
||||
@ -56,8 +56,8 @@ class Target:
|
||||
###############################################################################
|
||||
self.global_include_cc=[]
|
||||
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
|
||||
'-D__TARGET_ARCH__'+self.selectArch,
|
||||
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
|
||||
'-D__TARGET_ARCH__'+self.select_arch,
|
||||
'-D__TARGET_ADDR__'+self.select_bus + 'BITS',
|
||||
'-D_REENTRANT']
|
||||
|
||||
self.global_flags_xx=[]
|
||||
@ -74,7 +74,8 @@ class Target:
|
||||
|
||||
self.global_sysroot=""
|
||||
|
||||
self.suffix_cmdLine='.cmd'
|
||||
self.suffix_cmd_line='.cmd'
|
||||
self.suffix_warning='.warning'
|
||||
self.suffix_dependence='.d'
|
||||
self.suffix_obj='.o'
|
||||
self.suffix_lib_static='.a'
|
||||
@ -105,11 +106,11 @@ class Target:
|
||||
self.folder_lib="/usr/lib"
|
||||
self.folder_data="/usr/share"
|
||||
self.folder_doc="/usr/share/doc"
|
||||
self.buildDone=[]
|
||||
self.buildTreeDone=[]
|
||||
self.moduleList=[]
|
||||
self.build_done=[]
|
||||
self.build_tree_done=[]
|
||||
self.module_list=[]
|
||||
# output staging files list :
|
||||
self.listFinalFile=[]
|
||||
self.list_final_file=[]
|
||||
|
||||
self.sysroot=""
|
||||
|
||||
@ -176,24 +177,24 @@ class Target:
|
||||
return self.config["mode"]
|
||||
|
||||
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
|
||||
for source, dst, x, y, cmdFile2 in self.listFinalFile:
|
||||
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
||||
if dst == outputFile :
|
||||
debug.verbose("already added : " + outputFile)
|
||||
return
|
||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'")
|
||||
self.listFinalFile.append([inputFile,outputFile, sizeX, sizeY, cmdFile])
|
||||
self.list_final_file.append([inputFile,outputFile, sizeX, sizeY, cmdFile])
|
||||
|
||||
def add_file_staging(self, inputFile, outputFile, cmdFile=None):
|
||||
for source, dst, x, y, cmdFile2 in self.listFinalFile:
|
||||
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
||||
if dst == outputFile :
|
||||
debug.verbose("already added : " + outputFile)
|
||||
return
|
||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
||||
self.listFinalFile.append([inputFile, outputFile, -1, -1, cmdFile])
|
||||
self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile])
|
||||
|
||||
def copy_to_staging(self, binaryName):
|
||||
baseFolder = self.get_staging_folder_data(binaryName)
|
||||
for source, dst, x, y, cmdFile in self.listFinalFile:
|
||||
for source, dst, x, y, cmdFile in self.list_final_file:
|
||||
if cmdFile != None \
|
||||
and cmdFile != "":
|
||||
debug.verbose("cmd file " + cmdFile)
|
||||
@ -206,8 +207,8 @@ class Target:
|
||||
|
||||
|
||||
def clean_module_tree(self):
|
||||
self.buildTreeDone = []
|
||||
self.listFinalFile = []
|
||||
self.build_tree_done = []
|
||||
self.list_final_file = []
|
||||
|
||||
|
||||
# TODO : Remove this hack ... ==> really bad ... but usefull
|
||||
@ -224,8 +225,11 @@ class Target:
|
||||
def get_full_name_cmd(self, moduleName, basePath, file):
|
||||
if file[0] == '/':
|
||||
if tools.os.path.isfile(file):
|
||||
return file + self.suffix_cmdLine
|
||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine
|
||||
return file + self.suffix_cmd_line
|
||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmd_line
|
||||
|
||||
def get_full_name_warning(self, moduleName, basePath, file):
|
||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_warning;
|
||||
|
||||
def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False):
|
||||
# special patch for java file:
|
||||
@ -259,24 +263,28 @@ class Target:
|
||||
list.append(file)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmd_line)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_warning)
|
||||
elif (type=="lib-shared"):
|
||||
list.append(file)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmd_line)
|
||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_warning)
|
||||
elif (type=="lib-static"):
|
||||
list.append(file)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmd_line)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_warning)
|
||||
elif (type=="jar"):
|
||||
list.append(file)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmd_line)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_warning)
|
||||
elif (type=="image"):
|
||||
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmd_line)
|
||||
else:
|
||||
debug.error("unknow type : " + type)
|
||||
return list
|
||||
@ -297,25 +305,25 @@ class Target:
|
||||
return tools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName
|
||||
|
||||
def is_module_build(self, my_module):
|
||||
for mod in self.buildDone:
|
||||
for mod in self.build_done:
|
||||
if mod == my_module:
|
||||
return True
|
||||
self.buildDone.append(my_module)
|
||||
self.build_done.append(my_module)
|
||||
return False
|
||||
|
||||
def is_module_buildTree(self, my_module):
|
||||
for mod in self.buildTreeDone:
|
||||
def is_module_build_tree(self, my_module):
|
||||
for mod in self.build_tree_done:
|
||||
if mod == my_module:
|
||||
return True
|
||||
self.buildTreeDone.append(my_module)
|
||||
self.build_tree_done.append(my_module)
|
||||
return False
|
||||
|
||||
def add_module(self, newModule):
|
||||
debug.debug("Add nodule for Taget : " + newModule.name)
|
||||
self.moduleList.append(newModule)
|
||||
self.module_list.append(newModule)
|
||||
|
||||
def get_module(self, name):
|
||||
for mod in self.buildDone:
|
||||
for mod in self.build_done:
|
||||
if mod.name == name:
|
||||
return mod
|
||||
debug.error("the module '" + str(name) + "'does not exist/already build")
|
||||
@ -324,28 +332,28 @@ class Target:
|
||||
# return inherit packages ...
|
||||
"""
|
||||
def build(self, name, packagesName):
|
||||
for module in self.moduleList:
|
||||
for module in self.module_list:
|
||||
if module.name == name:
|
||||
return module.build(self, packagesName)
|
||||
debug.error("request to build an un-existant module name : '" + name + "'")
|
||||
"""
|
||||
|
||||
def build_tree(self, name, packagesName):
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
mod.build_tree(self, packagesName)
|
||||
return
|
||||
debug.error("request to build tree on un-existant module name : '" + name + "'")
|
||||
|
||||
def clean(self, name):
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
mod.clean(self)
|
||||
return
|
||||
debug.error("request to clean an un-existant module name : '" + name + "'")
|
||||
|
||||
def load_if_needed(self, name, optionnal=False):
|
||||
for elem in self.moduleList:
|
||||
for elem in self.module_list:
|
||||
if elem.name == name:
|
||||
return True
|
||||
# TODO : Check internal module and system module ...
|
||||
@ -368,7 +376,7 @@ class Target:
|
||||
self.load_if_needed(modName)
|
||||
|
||||
def project_add_module(self, name, projectMng, addedModule):
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
mod.ext_project_add_module(self, projectMng, addedModule)
|
||||
return
|
||||
@ -380,13 +388,13 @@ class Target:
|
||||
if name == "dump":
|
||||
debug.info("dump all")
|
||||
self.load_all()
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
mod.display(self)
|
||||
return
|
||||
if name == "all":
|
||||
debug.info("build all")
|
||||
self.load_all()
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
if self.name=="Android":
|
||||
if mod.type == "PACKAGE":
|
||||
mod.build(self, None)
|
||||
@ -397,7 +405,7 @@ class Target:
|
||||
elif name == "clean":
|
||||
debug.info("clean all")
|
||||
self.load_all()
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
mod.clean(self)
|
||||
else:
|
||||
# get the action an the module ....
|
||||
@ -425,7 +433,7 @@ class Target:
|
||||
and optionnal == True:
|
||||
return [heritage.HeritageList(), False]
|
||||
# clean requested
|
||||
for mod in self.moduleList:
|
||||
for mod in self.module_list:
|
||||
if mod.name == moduleName:
|
||||
if actionName == "dump":
|
||||
debug.info("dump module '" + moduleName + "'")
|
||||
|
@ -41,7 +41,7 @@ def get_output_type():
|
||||
## @brief Commands for running gcc to link an executable.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "bin")
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "bin")
|
||||
#create comdLine :
|
||||
cmd = [
|
||||
target.xx
|
||||
@ -90,7 +90,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("Executable", name, "==>", file_dst)
|
||||
|
||||
multiprocess.run_command(cmdLine)
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
if target.config["mode"] == "release"\
|
||||
or env.get_force_strip_mode() == True:
|
||||
# get the file size of the non strip file
|
||||
@ -99,7 +99,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
cmdLineStrip=tools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
multiprocess.run_command(cmdLineStrip)
|
||||
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||
# get the stip size of the binary
|
||||
stripSize = tools.file_size(file_dst)
|
||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||
|
@ -45,6 +45,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
@ -91,7 +92,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
tools.create_directory_of_file(file_dst)
|
||||
comment = ["c", name, "<==", file]
|
||||
# process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.xx,
|
||||
@ -91,14 +91,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
cmd.append(file_src)
|
||||
# Create cmd line
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
|
||||
# check the dependency for this file :
|
||||
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||
return {"action":"add", "file":file_dst}
|
||||
tools.create_directory_of_file(file_dst)
|
||||
comment = ["c++", name, "<==", file]
|
||||
#process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
||||
def get_version_compilation_flags(flags, dependency_flags):
|
||||
|
@ -39,7 +39,7 @@ def get_output_type():
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "jar")
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "jar")
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.jar,
|
||||
@ -63,7 +63,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
"""
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("jar", name, "==>", file_dst)
|
||||
multiprocess.run_command(cmdLine)
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
# write cmd line only after to prevent errors ...
|
||||
multiprocess.store_command(cmdLine, file_cmd)
|
||||
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||
|
@ -41,8 +41,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
|
||||
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.java,
|
||||
@ -89,6 +88,6 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
tools.create_directory_of_file(file_dst)
|
||||
comment = ["java", name, "<==", file]
|
||||
#process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
||||
|
@ -41,8 +41,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
|
||||
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.javah,
|
||||
@ -66,7 +65,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
#tools.create_directory_of_file(file_dst)
|
||||
comment = ["javah", class_to_build.replace(".", "_") + ".h", "<==", class_to_build]
|
||||
#process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
debug.verbose("file= " + file_dst)
|
||||
#return file_dst
|
||||
return {"action":"path", "path":target.get_build_folder(name) + target.folder_generate_code}
|
||||
|
@ -39,7 +39,7 @@ def get_output_type():
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.xx,
|
||||
@ -82,7 +82,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
return tmpList[1]
|
||||
tools.create_directory_of_file(file_dst)
|
||||
debug.print_element("SharedLib", name, "==>", file_dst)
|
||||
multiprocess.run_command(cmdLine)
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
# strip the output file:
|
||||
if target.config["mode"] == "release" \
|
||||
or env.get_force_strip_mode() == True:
|
||||
@ -92,7 +92,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
cmdLineStrip=tools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
multiprocess.run_command(cmdLineStrip)
|
||||
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||
# get the stip size of the binary
|
||||
stripSize = tools.file_size(file_dst)
|
||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||
|
@ -39,7 +39,7 @@ def get_output_type():
|
||||
## @brief Commands for running ar.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_folder):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||
cmd = [
|
||||
target.ar
|
||||
@ -70,13 +70,13 @@ def link(file, binary, target, depancy, name, basic_folder):
|
||||
# explicitly remove the destination to prevent error ...
|
||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||
os.remove(file_dst)
|
||||
multiprocess.run_command(cmdLine)
|
||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||
#$(Q)$(TARGET_RANLIB) $@
|
||||
if target.ranlib != "":
|
||||
cmdLineRanLib=tools.list_to_str([
|
||||
target.ranlib,
|
||||
file_dst ])
|
||||
multiprocess.run_command(cmdLineRanLib)
|
||||
multiprocess.run_command(cmdLineRanLib, store_output_file=file_warning)
|
||||
# write cmd line only after to prevent errors ...
|
||||
multiprocess.store_command(cmdLine, file_cmd)
|
||||
return file_dst
|
||||
|
@ -46,6 +46,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.cc,
|
||||
@ -98,6 +99,6 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
tools.create_directory_of_file(file_dst)
|
||||
comment = ["m", name, "<==", file]
|
||||
#process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
||||
|
@ -46,6 +46,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||
# create the command line befor requesting start:
|
||||
cmd = [
|
||||
target.xx,
|
||||
@ -98,5 +99,5 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
||||
tools.create_directory_of_file(file_dst)
|
||||
comment = ["m++", name, "<==", file]
|
||||
#process element
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
Loading…
x
Reference in New Issue
Block a user