summaryrefslogtreecommitdiffstats
path: root/Source/cmConvertMSBuildXMLToJSON.py
diff options
context:
space:
mode:
authorStephan Szabo <stephan.szabo@sony.com>2018-11-28 15:31:16 (GMT)
committerStephan Szabo <stephan.szabo@sony.com>2018-11-28 15:43:24 (GMT)
commit139b39985f26d4517072d49715c3dfd50a0d7001 (patch)
tree8fc247636decbe4f44afaf6260abf4d6dc62e887 /Source/cmConvertMSBuildXMLToJSON.py
parent1763f0428193cd6e28af4e49131516299acdf3b7 (diff)
downloadCMake-139b39985f26d4517072d49715c3dfd50a0d7001.zip
CMake-139b39985f26d4517072d49715c3dfd50a0d7001.tar.gz
CMake-139b39985f26d4517072d49715c3dfd50a0d7001.tar.bz2
Update XML->JSON generation script
Update generation script to write a newline to generated json. Update generation script to remove / or - at start of switches in xml Update generation script to put separators on switch as in headers
Diffstat (limited to 'Source/cmConvertMSBuildXMLToJSON.py')
-rw-r--r--Source/cmConvertMSBuildXMLToJSON.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmConvertMSBuildXMLToJSON.py b/Source/cmConvertMSBuildXMLToJSON.py
index 92569e7..02074ba 100644
--- a/Source/cmConvertMSBuildXMLToJSON.py
+++ b/Source/cmConvertMSBuildXMLToJSON.py
@@ -96,7 +96,6 @@ def read_msbuild_json(path, values=[]):
return values
-
def main():
"""Script entrypoint."""
# Parse the arguments
@@ -213,6 +212,14 @@ def __find_and_remove_value(list, compare):
return found
+def __normalize_switch(switch, separator):
+ new = switch
+ if switch.startswith("/") or switch.startswith("-"):
+ new = switch[1:]
+ if new and separator:
+ new = new + separator
+ return new
+
###########################################################################################
# private xml functions
def __convert(root, tag, values, func):
@@ -257,6 +264,8 @@ def __convert_bool(node):
reverse_switch = __get_attribute(node, 'ReverseSwitch')
if reverse_switch:
+ __with_argument(node, converted)
+
converted_reverse = copy.deepcopy(converted)
converted_reverse['switch'] = reverse_switch
@@ -303,7 +312,11 @@ def __convert_node(node, default_value='', default_flags=vsflags()):
converted = {}
converted['name'] = name
- converted['switch'] = __get_attribute(node, 'Switch')
+
+ switch = __get_attribute(node, 'Switch')
+ separator = __get_attribute(node, 'Separator')
+ converted['switch'] = __normalize_switch(switch, separator)
+
converted['comment'] = __get_attribute(node, 'DisplayName')
converted['value'] = default_value
@@ -435,7 +448,7 @@ def __write_json_file(path, values):
with open(path, 'w') as f:
json.dump(sorted_values, f, indent=2, separators=(',', ': '))
-
+ f.write("\n")
###########################################################################################
# private list helpers