[DEV] add multiple repo documentation generation
This commit is contained in:
parent
02525c7843
commit
8659f3f133
4
lutin.py
4
lutin.py
@ -41,9 +41,11 @@ def usage():
|
|||||||
print " Clean all (same as previous)"
|
print " Clean all (same as previous)"
|
||||||
print " dump"
|
print " dump"
|
||||||
print " Dump all the module dependency and properties"
|
print " Dump all the module dependency and properties"
|
||||||
|
print " doc"
|
||||||
|
print " Create documentation of all module that is mark as availlable on it"
|
||||||
listOfAllModule = lutinModule.ListAllModuleWithDesc()
|
listOfAllModule = lutinModule.ListAllModuleWithDesc()
|
||||||
for mod in listOfAllModule:
|
for mod in listOfAllModule:
|
||||||
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump"
|
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump" + mod[0] + "-doc"
|
||||||
print " " + mod[1]
|
print " " + mod[1]
|
||||||
print " ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all"
|
print " ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all"
|
||||||
exit(0)
|
exit(0)
|
||||||
|
89
lutinDoc.py
89
lutinDoc.py
@ -17,10 +17,11 @@ class doc:
|
|||||||
def __init__(self, moduleName):
|
def __init__(self, moduleName):
|
||||||
self.moduleName = moduleName
|
self.moduleName = moduleName
|
||||||
self.listClass = dict()
|
self.listClass = dict()
|
||||||
|
self.listEnum = dict()
|
||||||
self.listVariable = dict()
|
self.listVariable = dict()
|
||||||
self.listFunction = dict()
|
self.listFunction = dict()
|
||||||
self.listNamepsaces = dict()
|
self.listNamepsaces = dict()
|
||||||
|
self.target = None
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Add a File at the parsing system
|
## @brief Add a File at the parsing system
|
||||||
@ -32,9 +33,11 @@ class doc:
|
|||||||
try:
|
try:
|
||||||
metaData = CppHeaderParser.CppHeader(filename)
|
metaData = CppHeaderParser.CppHeader(filename)
|
||||||
except CppHeaderParser.CppParseError, e:
|
except CppHeaderParser.CppParseError, e:
|
||||||
debug.error(" can not parse the file: '" + filename + "' error : " + e)
|
debug.warning(" can not parse the file: '" + filename + "' error : " + str(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
#debug.info(str(metaData.enums))
|
||||||
|
|
||||||
# add all classes :
|
# add all classes :
|
||||||
for element in metaData.classes:
|
for element in metaData.classes:
|
||||||
localClass = metaData.classes[element]
|
localClass = metaData.classes[element]
|
||||||
@ -47,6 +50,20 @@ class doc:
|
|||||||
else:
|
else:
|
||||||
self.listClass[className] = localClass
|
self.listClass[className] = localClass
|
||||||
|
|
||||||
|
# add all enums:
|
||||||
|
for localEnum in metaData.enums:
|
||||||
|
if localEnum['namespace'] == '':
|
||||||
|
enumName = localEnum['name']
|
||||||
|
else:
|
||||||
|
enumName = localEnum['namespace'] + "::" + localEnum['name']
|
||||||
|
enumName = enumName.replace("::::", "::")
|
||||||
|
if enumName in self.listEnum.keys():
|
||||||
|
debug.warning("Might merge enum : '" + enumName + "' file : " + filename)
|
||||||
|
else:
|
||||||
|
self.listEnum[enumName] = localEnum
|
||||||
|
|
||||||
|
# add all namaspace:
|
||||||
|
|
||||||
# add all namespaces:
|
# add all namespaces:
|
||||||
|
|
||||||
# add all global vars:
|
# add all global vars:
|
||||||
@ -60,7 +77,9 @@ class doc:
|
|||||||
## @param[in] destFolder Destination folder.
|
## @param[in] destFolder Destination folder.
|
||||||
## @param[in] mode (optinnal) generation output mode {html, markdown ...}
|
## @param[in] mode (optinnal) generation output mode {html, markdown ...}
|
||||||
##
|
##
|
||||||
def generate_documantation(self, destFolder, mode="html"):
|
def generate_documantation(self, target, destFolder, mode="html"):
|
||||||
|
# local store of the target
|
||||||
|
self.target = target
|
||||||
if mode == "html":
|
if mode == "html":
|
||||||
if lutinDocHtml.generate(self, destFolder) == False:
|
if lutinDocHtml.generate(self, destFolder) == False:
|
||||||
debug.warning("Generation Documentation :'" + mode + "' ==> return an error for " + self.moduleName)
|
debug.warning("Generation Documentation :'" + mode + "' ==> return an error for " + self.moduleName)
|
||||||
@ -69,7 +88,9 @@ class doc:
|
|||||||
None
|
None
|
||||||
else:
|
else:
|
||||||
debug.error("Unknow Documantation mode generation :'" + mode + "'")
|
debug.error("Unknow Documantation mode generation :'" + mode + "'")
|
||||||
|
self.target = None
|
||||||
return False
|
return False
|
||||||
|
self.target = None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -111,3 +132,65 @@ class doc:
|
|||||||
debug.verbose("find childs : " + str(list))
|
debug.verbose("find childs : " + str(list))
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief trnsform the classname in a generic link (HTML)
|
||||||
|
## @param[in] elementName Name of the class requested
|
||||||
|
## @return [className, link]
|
||||||
|
##
|
||||||
|
def get_class_link(self, elementName):
|
||||||
|
if elementName == "const" \
|
||||||
|
or elementName == "enum" \
|
||||||
|
or elementName == "void" \
|
||||||
|
or elementName == "char" \
|
||||||
|
or elementName == "char32_t" \
|
||||||
|
or elementName == "float" \
|
||||||
|
or elementName == "double" \
|
||||||
|
or elementName == "bool" \
|
||||||
|
or elementName == "int8_t" \
|
||||||
|
or elementName == "uint8_t" \
|
||||||
|
or elementName == "int16_t" \
|
||||||
|
or elementName == "uint16_t" \
|
||||||
|
or elementName == "int32_t" \
|
||||||
|
or elementName == "uint32_t" \
|
||||||
|
or elementName == "int64_t" \
|
||||||
|
or elementName == "uint64_t" \
|
||||||
|
or elementName == "int" \
|
||||||
|
or elementName == "T" \
|
||||||
|
or elementName == "CLASS_TYPE" \
|
||||||
|
or elementName[:5] == "std::" \
|
||||||
|
or elementName[:6] == "appl::" \
|
||||||
|
or elementName == "&" \
|
||||||
|
or elementName == "*" \
|
||||||
|
or elementName == "**":
|
||||||
|
return [elementName, ""]
|
||||||
|
if elementName in self.listClass.keys():
|
||||||
|
link = elementName.replace(":","_") + ".html"
|
||||||
|
return [elementName, link]
|
||||||
|
elif elementName in self.listEnum.keys():
|
||||||
|
link = elementName.replace(":","_") + ".html"
|
||||||
|
return [elementName, link]
|
||||||
|
else:
|
||||||
|
return self.target.doc_get_link(elementName)
|
||||||
|
return [elementName, ""]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief trnsform the classname in a generic link (HTML) (external access ==> from target)
|
||||||
|
## @param[in] elementName Name of the class requested
|
||||||
|
## @return [className, link]
|
||||||
|
##
|
||||||
|
def get_class_link_from_target(self, elementName):
|
||||||
|
# reject when auto call :
|
||||||
|
if self.target != None:
|
||||||
|
return [elementName, ""]
|
||||||
|
# search in local list :
|
||||||
|
if elementName in self.listClass.keys():
|
||||||
|
link = elementName.replace(":","_") + ".html"
|
||||||
|
return [elementName, "../" + self.moduleName + "/" + link]
|
||||||
|
elif elementName in self.listEnum.keys():
|
||||||
|
link = elementName.replace(":","_") + ".html"
|
||||||
|
return [elementName, "../" + self.moduleName + "/" + link]
|
||||||
|
# did not find :
|
||||||
|
return [elementName, ""]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
101
lutinDocHtml.py
101
lutinDocHtml.py
@ -24,14 +24,14 @@ def replace_storage_keyword(match):
|
|||||||
|
|
||||||
def display_color(valBase):
|
def display_color(valBase):
|
||||||
# storage keyword :
|
# storage keyword :
|
||||||
p = re.compile("(inline|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)")
|
p = re.compile("(inline|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|volatile|typedef|struct|union|enum)")
|
||||||
val = p.sub(replace_storage_keyword, valBase)
|
val = p.sub(replace_storage_keyword, valBase)
|
||||||
# type :
|
# type :
|
||||||
p = re.compile("(bool|BOOL|char(16_t|32_t)?|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128))")
|
p = re.compile("(bool|BOOL|char(16_t|32_t)?|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128))")
|
||||||
val = p.sub(replace_type, val)
|
val = p.sub(replace_type, val)
|
||||||
return val, len(valBase)
|
return val, len(valBase)
|
||||||
|
|
||||||
def display_type(type, localClassName):
|
def display_type(type, myDoc):
|
||||||
type = type.replace("inline ", "")
|
type = type.replace("inline ", "")
|
||||||
lenght = 0;
|
lenght = 0;
|
||||||
isFirst = True
|
isFirst = True
|
||||||
@ -43,12 +43,10 @@ def display_type(type, localClassName):
|
|||||||
lenght += 1
|
lenght += 1
|
||||||
isFirst = False
|
isFirst = False
|
||||||
# check if the element in internal at the current lib
|
# check if the element in internal at the current lib
|
||||||
if element[:len(localClassName)] == localClassName:
|
name, link = myDoc.get_class_link(element)
|
||||||
out += "<a href=\"" + element.replace(":","_") + ".html\" class=\"code-type\">" + element + "</a>"
|
if len(link) != 0:
|
||||||
|
out += "<a href=\"" + link + "\" class=\"code-type\">" + name + "</a>"
|
||||||
lenght += len(element)
|
lenght += len(element)
|
||||||
# check if the element is in local Lib:
|
|
||||||
elif False:
|
|
||||||
None
|
|
||||||
# Ckeck if the variable in a standard class:
|
# Ckeck if the variable in a standard class:
|
||||||
elif element in global_class_link.keys():
|
elif element in global_class_link.keys():
|
||||||
out += "<a href=\"" + global_class_link[element] + "\" class=\"code-type\">" + element + "</a>"
|
out += "<a href=\"" + global_class_link[element] + "\" class=\"code-type\">" + element + "</a>"
|
||||||
@ -148,7 +146,7 @@ def white_space(size) :
|
|||||||
ret += " "
|
ret += " "
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def displayReductFunction(function, file, classement, sizeReturn, sizefunction, localClassName) :
|
def display_reduct_function(function, file, classement, sizeReturn, sizefunction, myDoc) :
|
||||||
file.write(classement + " ")
|
file.write(classement + " ")
|
||||||
lenght = len(classement)+1;
|
lenght = len(classement)+1;
|
||||||
if function['destructor'] :
|
if function['destructor'] :
|
||||||
@ -158,7 +156,7 @@ def displayReductFunction(function, file, classement, sizeReturn, sizefunction,
|
|||||||
file.write(white_space(sizeReturn+1))
|
file.write(white_space(sizeReturn+1))
|
||||||
lenght += sizeReturn+1;
|
lenght += sizeReturn+1;
|
||||||
else :
|
else :
|
||||||
typeData, typeLen = display_type(function["rtnType"], localClassName);
|
typeData, typeLen = display_type(function["rtnType"], myDoc);
|
||||||
file.write(typeData)
|
file.write(typeData)
|
||||||
file.write(white_space(sizeReturn+1 - typeLen))
|
file.write(white_space(sizeReturn+1 - typeLen))
|
||||||
lenght += sizeReturn+1;
|
lenght += sizeReturn+1;
|
||||||
@ -172,7 +170,7 @@ def displayReductFunction(function, file, classement, sizeReturn, sizefunction,
|
|||||||
file.write(",<br/>")
|
file.write(",<br/>")
|
||||||
file.write(white_space(parameterPos))
|
file.write(white_space(parameterPos))
|
||||||
|
|
||||||
typeData, typeLen = display_type(param["type"], localClassName);
|
typeData, typeLen = display_type(param["type"], myDoc);
|
||||||
file.write(typeData)
|
file.write(typeData)
|
||||||
if param['name'] != "":
|
if param['name'] != "":
|
||||||
file.write(" ")
|
file.write(" ")
|
||||||
@ -182,7 +180,7 @@ def displayReductFunction(function, file, classement, sizeReturn, sizefunction,
|
|||||||
file.write("<br>")
|
file.write("<br>")
|
||||||
|
|
||||||
|
|
||||||
def displayFunction(namespace, function, file, classement, sizeReturn, sizefunction, localClassName) :
|
def displayFunction(namespace, function, file, classement, sizeReturn, sizefunction, myDoc) :
|
||||||
lineData = ""
|
lineData = ""
|
||||||
if ( function['constructor'] == True \
|
if ( function['constructor'] == True \
|
||||||
or function['destructor'] == True \
|
or function['destructor'] == True \
|
||||||
@ -201,7 +199,7 @@ def displayFunction(namespace, function, file, classement, sizeReturn, sizefunct
|
|||||||
elif function['constructor'] :
|
elif function['constructor'] :
|
||||||
lenght = 0;
|
lenght = 0;
|
||||||
else :
|
else :
|
||||||
typeData, typeLen = display_type(function["rtnType"], localClassName);
|
typeData, typeLen = display_type(function["rtnType"], myDoc);
|
||||||
file.write(typeData + " ")
|
file.write(typeData + " ")
|
||||||
lenght = typeLen+1;
|
lenght = typeLen+1;
|
||||||
|
|
||||||
@ -212,7 +210,7 @@ def displayFunction(namespace, function, file, classement, sizeReturn, sizefunct
|
|||||||
if isFirst == False:
|
if isFirst == False:
|
||||||
file.write(",\n")
|
file.write(",\n")
|
||||||
file.write(white_space(parameterPos))
|
file.write(white_space(parameterPos))
|
||||||
typeData, typeLen = display_type(param["type"], localClassName);
|
typeData, typeLen = display_type(param["type"], myDoc);
|
||||||
file.write(typeData)
|
file.write(typeData)
|
||||||
if param['name'] != "":
|
if param['name'] != "":
|
||||||
file.write(" ")
|
file.write(" ")
|
||||||
@ -253,13 +251,13 @@ def generate(myDoc, outFolder) :
|
|||||||
genericHeader += "<html>\n"
|
genericHeader += "<html>\n"
|
||||||
genericHeader += "<head>\n"
|
genericHeader += "<head>\n"
|
||||||
genericHeader += " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\">\n"
|
genericHeader += " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\">\n"
|
||||||
genericHeader += " <title>Ewol Library</title>\n"
|
genericHeader += " <title>" + myDoc.moduleName+ " Library</title>\n"
|
||||||
genericHeader += " <link rel=\"stylesheet\" href=\"base.css\">\n"
|
genericHeader += " <link rel=\"stylesheet\" href=\"base.css\">\n"
|
||||||
genericHeader += "</head>\n"
|
genericHeader += "</head>\n"
|
||||||
genericHeader += "<body>\n"
|
genericHeader += "<body>\n"
|
||||||
genericHeader += " <div class=\"navbar navbar-fixed-top\">\n"
|
genericHeader += " <div class=\"navbar navbar-fixed-top\">\n"
|
||||||
genericHeader += " <div class=\"container\">\n"
|
genericHeader += " <div class=\"container\">\n"
|
||||||
genericHeader += " <h1>Ewol Library</h1>\n"
|
genericHeader += " <h1>" + myDoc.moduleName+ " Library</h1>\n"
|
||||||
#genericHeader += " <ul>\n"
|
#genericHeader += " <ul>\n"
|
||||||
baseNamespace = ""
|
baseNamespace = ""
|
||||||
for className in sorted(myDoc.listClass.iterkeys()) :
|
for className in sorted(myDoc.listClass.iterkeys()) :
|
||||||
@ -281,6 +279,27 @@ def generate(myDoc, outFolder) :
|
|||||||
|
|
||||||
if baseNamespace != "":
|
if baseNamespace != "":
|
||||||
genericHeader += " </ul>\n"
|
genericHeader += " </ul>\n"
|
||||||
|
|
||||||
|
for enumName in sorted(myDoc.listEnum.iterkeys()) :
|
||||||
|
pos = enumName.find("::")
|
||||||
|
if pos >= 0:
|
||||||
|
namespace = enumName[:pos]
|
||||||
|
rest = enumName[pos+2:]
|
||||||
|
else:
|
||||||
|
namespace = ""
|
||||||
|
rest = enumName
|
||||||
|
if baseNamespace != namespace:
|
||||||
|
if baseNamespace != "":
|
||||||
|
genericHeader += " </ul>\n"
|
||||||
|
genericHeader += " <li>" + namespace + "</li>\n"
|
||||||
|
genericHeader += " <ul>\n"
|
||||||
|
baseNamespace = namespace
|
||||||
|
|
||||||
|
genericHeader += " <li><a href=\"" + class_name_to_file_name(enumName) + "\">" + rest + "</a></li>\n"
|
||||||
|
|
||||||
|
if baseNamespace != "":
|
||||||
|
genericHeader += " </ul>\n"
|
||||||
|
|
||||||
#genericHeader += " </ul>\n"
|
#genericHeader += " </ul>\n"
|
||||||
genericHeader += " </div>\n"
|
genericHeader += " </div>\n"
|
||||||
genericHeader += " </div>\n"
|
genericHeader += " </div>\n"
|
||||||
@ -303,9 +322,8 @@ def generate(myDoc, outFolder) :
|
|||||||
|
|
||||||
file.write(genericHeader)
|
file.write(genericHeader)
|
||||||
|
|
||||||
file.write("<h1>" + className + "</h1>\n")
|
file.write("<h1>Class: " + className + "</h1>\n")
|
||||||
file.write("\n")
|
file.write("<br/>\n")
|
||||||
file.write("\n")
|
|
||||||
# calculate function max size return & function name size:
|
# calculate function max size return & function name size:
|
||||||
sizeReturn=0
|
sizeReturn=0
|
||||||
sizefunction=0
|
sizefunction=0
|
||||||
@ -324,11 +342,11 @@ def generate(myDoc, outFolder) :
|
|||||||
# TODO: ...
|
# TODO: ...
|
||||||
file.write("<pre>\n");
|
file.write("<pre>\n");
|
||||||
for function in localClass["methods"]["public"]:
|
for function in localClass["methods"]["public"]:
|
||||||
displayReductFunction(function, file, "+ ", sizeReturn, sizefunction, className)
|
display_reduct_function(function, file, "+ ", sizeReturn, sizefunction, myDoc)
|
||||||
for function in localClass["methods"]["protected"]:
|
for function in localClass["methods"]["protected"]:
|
||||||
displayReductFunction(function, file, "# ", sizeReturn, sizefunction, className)
|
display_reduct_function(function, file, "# ", sizeReturn, sizefunction, myDoc)
|
||||||
for function in localClass["methods"]["private"]:
|
for function in localClass["methods"]["private"]:
|
||||||
displayReductFunction(function, file, "- ", sizeReturn, sizefunction, className)
|
display_reduct_function(function, file, "- ", sizeReturn, sizefunction, myDoc)
|
||||||
file.write("</pre>\n");
|
file.write("</pre>\n");
|
||||||
file.write("\n")
|
file.write("\n")
|
||||||
file.write("\n")
|
file.write("\n")
|
||||||
@ -343,13 +361,15 @@ def generate(myDoc, outFolder) :
|
|||||||
if level != 0:
|
if level != 0:
|
||||||
file.write(white_space(level*4) + "+--> ")
|
file.write(white_space(level*4) + "+--> ")
|
||||||
if heritedClass != className:
|
if heritedClass != className:
|
||||||
file.write("<a href=\"" + class_name_to_file_name(heritedClass) + "\">" + heritedClass + "</a>\n")
|
name, link = myDoc.get_class_link(heritedClass)
|
||||||
|
file.write("<a href=\"" + link + "\">" + name + "</a>\n")
|
||||||
else:
|
else:
|
||||||
file.write("<b>" + heritedClass + "</b>\n")
|
file.write("<b>" + heritedClass + "</b>\n")
|
||||||
level += 1;
|
level += 1;
|
||||||
for heritedClass in heritageDown:
|
for heritedClass in heritageDown:
|
||||||
file.write(white_space(level*4) + "+--> ")
|
file.write(white_space(level*4) + "+--> ")
|
||||||
file.write("<a href=\"" + class_name_to_file_name(heritedClass) + "\">" + heritedClass + "</a>\n")
|
name, link = myDoc.get_class_link(heritedClass)
|
||||||
|
file.write("<a href=\"" + link + "\">" + name + "</a>\n")
|
||||||
file.write("</pre>\n")
|
file.write("</pre>\n")
|
||||||
file.write("<br/>\n")
|
file.write("<br/>\n")
|
||||||
"""
|
"""
|
||||||
@ -371,18 +391,47 @@ def generate(myDoc, outFolder) :
|
|||||||
file.write("<h2>Detail:<h2>\n")
|
file.write("<h2>Detail:<h2>\n")
|
||||||
# display all the class internal functions :
|
# display all the class internal functions :
|
||||||
for function in localClass["methods"]["public"]:
|
for function in localClass["methods"]["public"]:
|
||||||
displayFunction(localClass['namespace'] , function, file, "+ ", sizeReturn, sizefunction, className)
|
displayFunction(localClass['namespace'] , function, file, "+ ", sizeReturn, sizefunction, myDoc)
|
||||||
file.write("\n<hr/>\n")
|
file.write("\n<hr/>\n")
|
||||||
for function in localClass["methods"]["protected"]:
|
for function in localClass["methods"]["protected"]:
|
||||||
displayFunction(localClass['namespace'] , function, file, "# ", sizeReturn, sizefunction, className)
|
displayFunction(localClass['namespace'] , function, file, "# ", sizeReturn, sizefunction, myDoc)
|
||||||
file.write("\n<hr/>\n")
|
file.write("\n<hr/>\n")
|
||||||
for function in localClass["methods"]["private"]:
|
for function in localClass["methods"]["private"]:
|
||||||
displayFunction(localClass['namespace'] , function, file, "- ", sizeReturn, sizefunction, className)
|
displayFunction(localClass['namespace'] , function, file, "- ", sizeReturn, sizefunction, myDoc)
|
||||||
file.write("\n<hr/>\n")
|
file.write("\n<hr/>\n")
|
||||||
|
|
||||||
file.write(genericFooter)
|
file.write(genericFooter)
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
for enumName in sorted(myDoc.listEnum.iterkeys()) :
|
||||||
|
localEnum = myDoc.listEnum[enumName]
|
||||||
|
debug.debug(" enum: " + enumName)
|
||||||
|
fileName = outFolder + "/" + class_name_to_file_name(enumName)
|
||||||
|
# create directory (in case)
|
||||||
|
lutinTools.CreateDirectoryOfFile(fileName);
|
||||||
|
debug.printElement("doc", myDoc.moduleName, "<==", enumName)
|
||||||
|
# open the file :
|
||||||
|
file = open(fileName, "w")
|
||||||
|
|
||||||
|
file.write(genericHeader)
|
||||||
|
|
||||||
|
file.write("<h1>Enum: " + enumName + "</h1>\n")
|
||||||
|
file.write("<br/>\n")
|
||||||
|
file.write("Value :<br>\n")
|
||||||
|
file.write("<ul>\n")
|
||||||
|
#debug.info(" enum: " + str(localEnum))
|
||||||
|
for value in localEnum["values"]:
|
||||||
|
file.write("<li>" + value["name"])
|
||||||
|
if "doxygen" in value.keys():
|
||||||
|
file.write(" " + value["doxygen"] )
|
||||||
|
file.write("</li>")
|
||||||
|
file.write("</ul>\n")
|
||||||
|
|
||||||
|
file.write(genericFooter)
|
||||||
|
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
133
lutinModule.py
133
lutinModule.py
@ -13,19 +13,17 @@ import lutinMultiprocess
|
|||||||
import lutinEnv
|
import lutinEnv
|
||||||
import lutinDoc
|
import lutinDoc
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
class module:
|
class module:
|
||||||
"""
|
|
||||||
Module class represent all system needed for a specific
|
##
|
||||||
module like
|
## @brief Module class represent all system needed for a specific
|
||||||
- type (bin/lib ...)
|
## module like
|
||||||
- dependency
|
## - type (bin/lib ...)
|
||||||
- flags
|
## - dependency
|
||||||
- files
|
## - flags
|
||||||
- ...
|
## - files
|
||||||
"""
|
## - ...
|
||||||
|
##
|
||||||
def __init__(self, file, moduleName, moduleType):
|
def __init__(self, file, moduleName, moduleType):
|
||||||
## Remove all variable to prevent error of multiple deffinition of the module ...
|
## Remove all variable to prevent error of multiple deffinition of the module ...
|
||||||
self.originFile=''
|
self.originFile=''
|
||||||
@ -37,8 +35,8 @@ class module:
|
|||||||
# Dependency list:
|
# Dependency list:
|
||||||
self.depends=[]
|
self.depends=[]
|
||||||
# Dependency list:
|
# Dependency list:
|
||||||
self.docPath=lutinTools.GetCurrentPath(file)
|
self.docPath = ""
|
||||||
self.documentation = lutinDoc.doc(self.name)
|
self.documentation = None
|
||||||
# export PATH
|
# export PATH
|
||||||
self.export_path=[]
|
self.export_path=[]
|
||||||
self.local_path=[]
|
self.local_path=[]
|
||||||
@ -94,9 +92,9 @@ class module:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## add Some copilation flags for this module (and only this one)
|
## @brief Add Some copilation flags for this module (and only this one)
|
||||||
###############################################################################
|
##
|
||||||
def add_extra_compile_flags(self):
|
def add_extra_compile_flags(self):
|
||||||
self.CompileFlags_CC([
|
self.CompileFlags_CC([
|
||||||
"-Wall",
|
"-Wall",
|
||||||
@ -106,9 +104,9 @@ class module:
|
|||||||
"-Wno-write-strings"]);
|
"-Wno-write-strings"]);
|
||||||
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## remove all unneeded warning on compilation ==> for extern libs ...
|
## @brief remove all unneeded warning on compilation ==> for extern libs ...
|
||||||
###############################################################################
|
##
|
||||||
def remove_compile_warning(self):
|
def remove_compile_warning(self):
|
||||||
self.CompileFlags_CC([
|
self.CompileFlags_CC([
|
||||||
"-Wno-int-to-pointer-cast"
|
"-Wno-int-to-pointer-cast"
|
||||||
@ -118,9 +116,9 @@ class module:
|
|||||||
])
|
])
|
||||||
# only for gcc :"-Wno-unused-but-set-variable"
|
# only for gcc :"-Wno-unused-but-set-variable"
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to compile a m++ file.
|
## @brief Commands for running gcc to compile a m++ file.
|
||||||
###############################################################################
|
##
|
||||||
def Compile_mm_to_o(self, file, binary, target, depancy):
|
def Compile_mm_to_o(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
@ -151,9 +149,9 @@ class module:
|
|||||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to compile a m file.
|
## @brief Commands for running gcc to compile a m file.
|
||||||
###############################################################################
|
##
|
||||||
def Compile_m_to_o(self, file, binary, target, depancy):
|
def Compile_m_to_o(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
@ -184,9 +182,9 @@ class module:
|
|||||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to compile a C++ file.
|
## @brief Commands for running gcc to compile a C++ file.
|
||||||
###############################################################################
|
##
|
||||||
def Compile_xx_to_o(self, file, binary, target, depancy):
|
def Compile_xx_to_o(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
@ -216,9 +214,9 @@ class module:
|
|||||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to compile a C file.
|
## @brief Commands for running gcc to compile a C file.
|
||||||
###############################################################################
|
##
|
||||||
def Compile_cc_to_o(self, file, binary, target, depancy):
|
def Compile_cc_to_o(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
@ -246,9 +244,9 @@ class module:
|
|||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running ar.
|
## @brief Commands for running ar.
|
||||||
###############################################################################
|
##
|
||||||
def Link_to_a(self, file, binary, target, depancy):
|
def Link_to_a(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"lib-static")
|
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"lib-static")
|
||||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||||
@ -280,9 +278,9 @@ class module:
|
|||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
###############################################################################
|
##
|
||||||
def Link_to_so(self, file, binary, target, depancy, libName=""):
|
def Link_to_so(self, file, binary, target, depancy, libName=""):
|
||||||
if libName=="":
|
if libName=="":
|
||||||
libName = self.name
|
libName = self.name
|
||||||
@ -300,8 +298,8 @@ class module:
|
|||||||
target.global_flags_ld])
|
target.global_flags_ld])
|
||||||
|
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if False==dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) \
|
if dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||||
and False==dependency.NeedRePackage(file_dst, depancy.src, False, file_cmd, cmdLine):
|
and dependency.NeedRePackage(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||||
return tmpList[1]
|
return tmpList[1]
|
||||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||||
debug.printElement("SharedLib", libName, "==>", file_dst)
|
debug.printElement("SharedLib", libName, "==>", file_dst)
|
||||||
@ -323,9 +321,9 @@ class module:
|
|||||||
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for running gcc to link an executable.
|
## @brief Commands for running gcc to link an executable.
|
||||||
###############################################################################
|
##
|
||||||
def Link_to_bin(self, file, binary, target, depancy):
|
def Link_to_bin(self, file, binary, target, depancy):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"bin")
|
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"bin")
|
||||||
#create comdLine :
|
#create comdLine :
|
||||||
@ -362,26 +360,34 @@ class module:
|
|||||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for copying files
|
## @brief Commands for copying files
|
||||||
###############################################################################
|
##
|
||||||
def files_to_staging(self, binaryName, target):
|
def files_to_staging(self, binaryName, target):
|
||||||
for element in self.files:
|
for element in self.files:
|
||||||
debug.verbose("Might copy file : " + element[0] + " ==> " + element[1])
|
debug.verbose("Might copy file : " + element[0] + " ==> " + element[1])
|
||||||
target.AddFileStaging(self.originFolder+"/"+element[0], element[1])
|
target.AddFileStaging(self.originFolder+"/"+element[0], element[1])
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Commands for copying files
|
## @brief Commands for copying files
|
||||||
###############################################################################
|
##
|
||||||
def folders_to_staging(self, binaryName, target):
|
def folders_to_staging(self, binaryName, target):
|
||||||
for element in self.folders:
|
for element in self.folders:
|
||||||
debug.verbose("Might copy folder : " + element[0] + "==>" + element[1])
|
debug.verbose("Might copy folder : " + element[0] + "==>" + element[1])
|
||||||
lutinTools.CopyAnythingTarget(target, self.originFolder+"/"+element[0],element[1])
|
lutinTools.CopyAnythingTarget(target, self.originFolder+"/"+element[0],element[1])
|
||||||
|
|
||||||
###############################################################################
|
##
|
||||||
## Create the module documentation:
|
## @brief Set the documentation availlable for this module
|
||||||
###############################################################################
|
##
|
||||||
def CreateDoc(self, target) :
|
def doc_enable(self):
|
||||||
|
self.docPath = lutinTools.GetCurrentPath(self.originFile)
|
||||||
|
self.documentation = lutinDoc.doc(self.name)
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Create the module documentation:
|
||||||
|
## @param[in,out] target target that request generation of the documentation
|
||||||
|
##
|
||||||
|
def doc_parse_code(self, target):
|
||||||
if self.docPath == "":
|
if self.docPath == "":
|
||||||
return False
|
return False
|
||||||
for root, dirnames, filenames in os.walk(self.docPath):
|
for root, dirnames, filenames in os.walk(self.docPath):
|
||||||
@ -391,9 +397,28 @@ class module:
|
|||||||
fileCompleteName = os.path.join(root, filename)
|
fileCompleteName = os.path.join(root, filename)
|
||||||
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
||||||
self.documentation.add_file(fileCompleteName)
|
self.documentation.add_file(fileCompleteName)
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Generate real documentation files
|
||||||
|
## @param[in,out] target target that request generation of the documentation
|
||||||
|
##
|
||||||
|
def doc_generate(self, target):
|
||||||
|
if self.docPath == "":
|
||||||
|
return False
|
||||||
# Real creation of the documentation :
|
# Real creation of the documentation :
|
||||||
lutinTools.RemoveFolderAndSubFolder(target.GetDocFolder(self.name));
|
lutinTools.RemoveFolderAndSubFolder(target.GetDocFolder(self.name));
|
||||||
self.documentation.generate_documantation(target.GetDocFolder(self.name))
|
self.documentation.generate_documantation(target, target.GetDocFolder(self.name))
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get link on a class or an enum in all the subclasses
|
||||||
|
## @param[in] name of the class
|
||||||
|
## @return [real element name, link on it]
|
||||||
|
##
|
||||||
|
def doc_get_link(self, target, elementName):
|
||||||
|
if self.docPath == "":
|
||||||
|
return [elementName, ""]
|
||||||
|
return self.documentation.get_class_link_from_target(elementName);
|
||||||
|
|
||||||
|
|
||||||
# call here to build the module
|
# call here to build the module
|
||||||
|
@ -207,10 +207,18 @@ class Target:
|
|||||||
self.LoadIfNeeded(modName)
|
self.LoadIfNeeded(modName)
|
||||||
|
|
||||||
def Build(self, name, packagesName=None):
|
def Build(self, name, packagesName=None):
|
||||||
if name == "dump":
|
if name == "doc":
|
||||||
|
debug.info("Documentation for all")
|
||||||
|
self.LoadAll()
|
||||||
|
print 'Doc all modules'
|
||||||
|
for mod in self.moduleList:
|
||||||
|
mod.doc_parse_code(self)
|
||||||
|
for mod in self.moduleList:
|
||||||
|
mod.doc_generate(self)
|
||||||
|
elif name == "dump":
|
||||||
debug.info("dump all")
|
debug.info("dump all")
|
||||||
self.LoadAll()
|
self.LoadAll()
|
||||||
print 'Dump all module properties'
|
print 'Dump all modules properties'
|
||||||
for mod in self.moduleList:
|
for mod in self.moduleList:
|
||||||
mod.Display(self)
|
mod.Display(self)
|
||||||
elif name == "all":
|
elif name == "all":
|
||||||
@ -261,9 +269,23 @@ class Target:
|
|||||||
return mod.Build(self, None)
|
return mod.Build(self, None)
|
||||||
elif actionName == "doc":
|
elif actionName == "doc":
|
||||||
debug.debug("Create doc module '" + moduleName + "'")
|
debug.debug("Create doc module '" + moduleName + "'")
|
||||||
return mod.CreateDoc(self)
|
if mod.doc_parse_code(self) == False:
|
||||||
|
return False
|
||||||
|
return mod.doc_generate(self)
|
||||||
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
|
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get link on a class or an enum in all the subclasses
|
||||||
|
## @param[in] name of the class
|
||||||
|
## @return [real element name, link on it]
|
||||||
|
##
|
||||||
|
def doc_get_link(self, elementName):
|
||||||
|
for mod in self.moduleList:
|
||||||
|
elementRealName, link = mod.doc_get_link(self, elementName)
|
||||||
|
if len(link) != 0:
|
||||||
|
debug.verbose("find the element : " + elementName + " ==> " + link)
|
||||||
|
return [elementRealName, link]
|
||||||
|
return [elementName, ""]
|
||||||
|
|
||||||
__startTargetName="lutinTarget"
|
__startTargetName="lutinTarget"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user