[DEV] update GLD parsing
This commit is contained in:
parent
08e50c35b3
commit
9dc5218775
@ -1140,7 +1140,7 @@ class Module:
|
|||||||
## @param[in] self (handle) Class handle
|
## @param[in] self (handle) Class handle
|
||||||
## @param[in] type (string) inclusion group name 'c', 'c++', 'java' ...
|
## @param[in] type (string) inclusion group name 'c', 'c++', 'java' ...
|
||||||
## @param[in] list ([string,...] or string) List of path to include
|
## @param[in] list ([string,...] or string) List of path to include
|
||||||
## @param[in] export (bool) export the flat that has been requested to add if module is present.
|
## @param[in] export (bool) export the flag that has been requested to add if module is present.
|
||||||
## @return None
|
## @return None
|
||||||
##
|
##
|
||||||
def add_flag(self, type, list, export=False):
|
def add_flag(self, type, list, export=False):
|
||||||
|
@ -70,6 +70,7 @@ list_of_element_availlable=[
|
|||||||
"dependency",
|
"dependency",
|
||||||
"copy",
|
"copy",
|
||||||
"flag",
|
"flag",
|
||||||
|
"flag-export",
|
||||||
"compiler",
|
"compiler",
|
||||||
"mode",
|
"mode",
|
||||||
"target",
|
"target",
|
||||||
@ -205,12 +206,10 @@ list_of_element_availlable=[
|
|||||||
"gale/context/X11/Context.cpp"
|
"gale/context/X11/Context.cpp"
|
||||||
],
|
],
|
||||||
"flag": {
|
"flag": {
|
||||||
"language": "c++",
|
"c++": "-DGALE_BUILD_X11"
|
||||||
"value": "-DGALE_BUILD_X11"
|
|
||||||
},
|
},
|
||||||
"missing-flag": {
|
"missing-flag": {
|
||||||
"language": "c++",
|
"c++": "-DGALE_DOES_NOT_BUILD_X11"
|
||||||
"value": "-DGALE_DOES_NOT_BUILD_X11"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -231,6 +230,14 @@ list_of_element_availlable=[
|
|||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
"flag": {
|
||||||
|
"c++": "-DGALE_BUILD_X11",
|
||||||
|
"c": [
|
||||||
|
"-DAPPL_VERSION={{{project.version}}}",
|
||||||
|
"-DAPPL_NAME={{{project.name}}}",
|
||||||
|
"-DAPPL_TYPE={{{project.type}}}"
|
||||||
|
]
|
||||||
|
},
|
||||||
"arch": {
|
"arch": {
|
||||||
"x86": {
|
"x86": {
|
||||||
|
|
||||||
@ -376,6 +383,15 @@ def check_compatible(mode, value, list_to_check, json_path):
|
|||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
|
||||||
|
def replace_dynamic_tags(my_module, data):
|
||||||
|
out = data;
|
||||||
|
out = out.replace("{{{project.version}}}", tools.version_to_string(my_module.get_version()));
|
||||||
|
out = out.replace("{{{project.name}}}", my_module.get_name());
|
||||||
|
out = out.replace("{{{project.type}}}", my_module.get_type());
|
||||||
|
out = out.replace("{{{quote}}}", "\\'");
|
||||||
|
out = out.replace("{{{quote2}}}", "\\\""); # "
|
||||||
|
return out;
|
||||||
|
|
||||||
|
|
||||||
def parse_node_arch(target, path, json_path, my_module, data):
|
def parse_node_arch(target, path, json_path, my_module, data):
|
||||||
for elem in data.keys():
|
for elem in data.keys():
|
||||||
@ -392,9 +408,19 @@ def parse_node_platform(target, path, json_path, my_module, data):
|
|||||||
if check_compatible("target", elem, target.get_type(), json_path):
|
if check_compatible("target", elem, target.get_type(), json_path):
|
||||||
parse_node_generic(target, path, json_path, my_module, data[elem]);
|
parse_node_generic(target, path, json_path, my_module, data[elem]);
|
||||||
|
|
||||||
def parse_node_flag(target, path, json_path, my_module, data):
|
def parse_node_flag(target, path, json_path, my_module, data, export = False):
|
||||||
|
if type(data) != dict:
|
||||||
|
debug.error("Can not parseflag other than dictionnary in: " + str(json_path));
|
||||||
for elem in data.keys():
|
for elem in data.keys():
|
||||||
my_module.add_flag(elem, data[elem]);
|
if type(data[elem]) == list:
|
||||||
|
tmp = []
|
||||||
|
for elenFlag in data[elem]:
|
||||||
|
tmp.append(replace_dynamic_tags(my_module, elenFlag));
|
||||||
|
my_module.add_flag(elem, tmp, export);
|
||||||
|
elif type(data[elem]) == str:
|
||||||
|
my_module.add_flag(elem, replace_dynamic_tags(my_module, data[elem]), export);
|
||||||
|
else:
|
||||||
|
debug.error("not manage list of flag other than string and list of string, but it is " + str(type(data[elem])) + " in: '" + str(json_path) + "' for: " + str(data));
|
||||||
|
|
||||||
def parse_node_generic(target, path, json_path, my_module, data, first = False ):
|
def parse_node_generic(target, path, json_path, my_module, data, first = False ):
|
||||||
for elem in data.keys():
|
for elem in data.keys():
|
||||||
@ -411,7 +437,9 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
|
|||||||
debug.warning("Available List: " + str(list_of_element_ignored) + " or: " + str(list_of_element_availlable));
|
debug.warning("Available List: " + str(list_of_element_ignored) + " or: " + str(list_of_element_availlable));
|
||||||
|
|
||||||
if "source" in data.keys():
|
if "source" in data.keys():
|
||||||
if type(data["source"]) == list:
|
if type(data["source"]) == str:
|
||||||
|
my_module.add_src_file(data["source"]);
|
||||||
|
elif type(data["source"]) == list:
|
||||||
my_module.add_src_file(data["source"]);
|
my_module.add_src_file(data["source"]);
|
||||||
elif type(data["source"]) == dict:
|
elif type(data["source"]) == dict:
|
||||||
if "list" in data["source"].keys():
|
if "list" in data["source"].keys():
|
||||||
@ -419,7 +447,7 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
|
|||||||
else:
|
else:
|
||||||
debug.error("missing 'list' in node 'source:{}'");
|
debug.error("missing 'list' in node 'source:{}'");
|
||||||
else:
|
else:
|
||||||
debug.error("Wrong type for node 'source' [] or {}");
|
debug.error("'" + json_path + "'Wrong type for node 'source' [] or {} or string");
|
||||||
|
|
||||||
if "header" in data.keys():
|
if "header" in data.keys():
|
||||||
if type(data["header"]) == list:
|
if type(data["header"]) == list:
|
||||||
@ -471,8 +499,12 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
|
|||||||
if type(data["dependency"]) == list:
|
if type(data["dependency"]) == list:
|
||||||
for elem in data["dependency"]:
|
for elem in data["dependency"]:
|
||||||
GLD_add_depend(my_module, elem);
|
GLD_add_depend(my_module, elem);
|
||||||
|
elif type(data["dependency"]) == str:
|
||||||
|
GLD_add_depend(my_module, data["dependency"]);
|
||||||
|
elif type(data["dependency"]) == dict:
|
||||||
|
GLD_add_depend(my_module, data["dependency"]);
|
||||||
else:
|
else:
|
||||||
debug.error("Wrong type for node 'dependency' []");
|
debug.error("Wrong type for node 'dependency' [] or {} or \"\"");
|
||||||
|
|
||||||
if "compilation-version" in data.keys():
|
if "compilation-version" in data.keys():
|
||||||
if type(data["compilation-version"]) == dict:
|
if type(data["compilation-version"]) == dict:
|
||||||
@ -499,7 +531,10 @@ def parse_node_generic(target, path, json_path, my_module, data, first = False )
|
|||||||
parse_node_mode(target, path, json_path, my_module, data["mode"]);
|
parse_node_mode(target, path, json_path, my_module, data["mode"]);
|
||||||
|
|
||||||
if "flag" in data.keys():
|
if "flag" in data.keys():
|
||||||
parse_node_flag(target, path, json_path, my_module, data["flag"]);
|
parse_node_flag(target, path, json_path, my_module, data["flag"], False);
|
||||||
|
|
||||||
|
if "flag-export" in data.keys():
|
||||||
|
parse_node_flag(target, path, json_path, my_module, data["flag-export"], True);
|
||||||
|
|
||||||
def load_module_from_GLD(target, name, path, json_path):
|
def load_module_from_GLD(target, name, path, json_path):
|
||||||
debug.debug("Parse file: "+ json_path + "'");
|
debug.debug("Parse file: "+ json_path + "'");
|
||||||
@ -619,29 +654,36 @@ def GLD_compile_version(my_module, data):
|
|||||||
my_module.compile_version(elem, data[elem])
|
my_module.compile_version(elem, data[elem])
|
||||||
|
|
||||||
def GLD_copy(my_module, data):
|
def GLD_copy(my_module, data):
|
||||||
path_src = None;
|
try:
|
||||||
file_src = None;
|
if type(data) == dict:
|
||||||
path_to = "";
|
path_src = None;
|
||||||
recursive = False;
|
file_src = None;
|
||||||
if "path" in data.keys():
|
path_to = "";
|
||||||
path_src = data["path"];
|
recursive = False;
|
||||||
if "file" in data.keys():
|
if "path" in data.keys():
|
||||||
file_src = data["file"];
|
path_src = data["path"];
|
||||||
if "to" in data.keys():
|
if "file" in data.keys():
|
||||||
path_to = data["to"];
|
file_src = data["file"];
|
||||||
if "recursive" in data.keys():
|
if "to" in data.keys():
|
||||||
if type(data["recursive"]) == bool:
|
path_to = data["to"];
|
||||||
recursive = data["recursive"];
|
if "recursive" in data.keys():
|
||||||
|
if type(data["recursive"]) == bool:
|
||||||
|
recursive = data["recursive"];
|
||||||
|
else:
|
||||||
|
debug.error("recursive is a boolean !!!");
|
||||||
|
if path_src == None and file_src == None:
|
||||||
|
debug.error("copy must at least have 'path' or 'file' !!!");
|
||||||
|
if path_src != None:
|
||||||
|
my_module.copy_path(path_src, path_to);
|
||||||
|
if file_src != None:
|
||||||
|
my_module.copy_file(file_src, path_to);
|
||||||
|
elif type(data) == str:
|
||||||
|
my_module.copy_file(data, "");
|
||||||
else:
|
else:
|
||||||
debug.error("recursive is a boolean !!!");
|
debug.error("in module : " + my_module.get_name() + " not supported type for copy: " + type(data) + " string or object data=" + str(data));
|
||||||
if path_src == None and file_src == None:
|
except Exception as e:
|
||||||
debug.error("copy must at least have 'path' or 'file' !!!");
|
debug.warning("in module : " + my_module.get_name());
|
||||||
if path_src != None:
|
raise e;
|
||||||
my_module.copy_path(path_src, path_to);
|
|
||||||
if file_src != None:
|
|
||||||
my_module.copy_file(file_src, path_to);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_module_option_GLD(path, data, name):
|
def get_module_option_GLD(path, data, name):
|
||||||
type = None;
|
type = None;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user