MCPcopy Create free account
hub / github.com/Kitware/CMake / main

Function main

Source/cmConvertMSBuildXMLToJSON.py:104–172  ·  view source on GitHub ↗

Script entrypoint.

()

Source from the content-addressed store, hash-verified

102 return values
103
104def main():
105 """Script entrypoint."""
106 # Parse the arguments
107 parser = argparse.ArgumentParser(
108 description='Convert MSBuild XML to JSON format')
109
110 parser.add_argument(
111 '-t', '--toolchain', help='The name of the toolchain', required=True)
112 parser.add_argument(
113 '-o', '--output', help='The output directory', default='')
114 parser.add_argument(
115 '-r',
116 '--overwrite',
117 help='Whether previously output should be overwritten',
118 dest='overwrite',
119 action='store_true')
120 parser.set_defaults(overwrite=False)
121 parser.add_argument(
122 '-d',
123 '--debug',
124 help="Debug tool output",
125 action="store_const",
126 dest="loglevel",
127 const=logging.DEBUG,
128 default=logging.WARNING)
129 parser.add_argument(
130 '-v',
131 '--verbose',
132 help="Verbose output",
133 action="store_const",
134 dest="loglevel",
135 const=logging.INFO)
136 parser.add_argument('input', help='The input files', nargs='+')
137
138 args = parser.parse_args()
139
140 toolchain = args.toolchain
141
142 logging.basicConfig(level=args.loglevel)
143 logging.info('Creating %s toolchain files', toolchain)
144
145 values = {}
146
147 # Iterate through the inputs
148 for input in args.input:
149 input = __get_path(input)
150
151 read_msbuild_xml(input, values)
152
153 # Determine if the output directory needs to be created
154 output_dir = __get_path(args.output)
155
156 if not os.path.exists(output_dir):
157 os.mkdir(output_dir)
158 logging.info('Created output directory %s', output_dir)
159
160 for key, value in values.items():
161 output_path = __output_path(toolchain, key, output_dir)

Callers 1

Calls 6

__get_pathFunction · 0.85
read_msbuild_xmlFunction · 0.85
__output_pathFunction · 0.85
__merge_json_valuesFunction · 0.85
read_msbuild_jsonFunction · 0.85
__write_json_fileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…