Mercurial > vim-crosoft
diff scripts/list_sln_files.py @ 15:cfcac4ed7d21 default tip
Improve loading of solution files
- New argument to force a rebuild of the cache
- Gracefully handle missing projects in a solution
- Handle more different xml namespaces
- Support more edge cases
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 29 Aug 2023 12:59:54 -0700 |
parents | d5ddd9ffaf11 |
children |
line wrap: on
line diff
--- a/scripts/list_sln_files.py Tue Aug 29 12:52:12 2023 -0700 +++ b/scripts/list_sln_files.py Tue Aug 29 12:59:54 2023 -0700 @@ -14,6 +14,9 @@ help="The path to the Visual Studio solution file.") parser.add_argument('-c', '--cache', help="The solution cache file to load.") + parser.add_argument('--rebuild-cache', + action='store_true', + help="Force rebuild the cache even if it is valid") parser.add_argument('--list-cache', help=("If the solution cache is valid, use this " "pre-saved file list. Otherwise, compute the " @@ -29,7 +32,8 @@ args = parser.parse_args(args) setup_logging(args.verbose) - cache, loaded = SolutionCache.load_or_rebuild(args.solution, args.cache) + cache, loaded = SolutionCache.load_or_rebuild(args.solution, args.cache, + args.rebuild_cache) if loaded and args.list_cache: caches_exist = True try: @@ -61,10 +65,13 @@ for p in projs: ig = p.defaultitemgroup() + if ig is None: + continue for i in ig.get_items_of_types(itemtypes): - file_path = os.path.abspath(os.path.join(p.absdirpath, i.include)) - print(file_path) - items.append(file_path + '\n') + if i.include: + file_path = os.path.abspath(os.path.join(p.absdirpath, i.include)) + print(file_path) + items.append(file_path + '\n') if args.list_cache: logger.debug("Writing file list cache: %s" % args.list_cache)