(args)
| 379 | |
| 380 | |
| 381 | def _parse(args): |
| 382 | from xcactivitylog import ( |
| 383 | newest_logpath, |
| 384 | extract_compile_log, |
| 385 | metapath_from_buildroot, |
| 386 | ) |
| 387 | |
| 388 | """args: same as main.parse args""" |
| 389 | if args.sync: |
| 390 | xcpath = newest_logpath(metapath_from_buildroot(args.sync), scheme=args.scheme) |
| 391 | if not xcpath: |
| 392 | echo( |
| 393 | f"no newest_logpath xcactivitylog at {args.sync}/Logs/Build/LogStoreManifest.plist" |
| 394 | ) |
| 395 | return 1 |
| 396 | |
| 397 | echo(f"extract_compile_log at {xcpath}") |
| 398 | in_fd = extract_compile_log(xcpath) |
| 399 | elif args.xcactivitylog: |
| 400 | in_fd = extract_compile_log(args.xcactivitylog) |
| 401 | elif args.input == "-": |
| 402 | in_fd = sys.stdin |
| 403 | elif args.input.endswith(".xcactivitylog"): |
| 404 | in_fd = extract_compile_log(args.input) |
| 405 | else: |
| 406 | in_fd = open(args.input, "r") |
| 407 | |
| 408 | parser = XcodeLogParser(in_fd, echo, skip_validate_bin=args.skip_validate_bin, verbosity=args.verbose) |
| 409 | items = parser.parse() |
| 410 | |
| 411 | if args.output == "-": |
| 412 | return dump_database(items, sys.stdout) |
| 413 | if not args.output: |
| 414 | output = default_output_path |
| 415 | |
| 416 | for index_store_path in parser.index_store_path: |
| 417 | echo(f"use index_store_path at {index_store_path}") |
| 418 | break |
| 419 | else: |
| 420 | index_store_path = None |
| 421 | |
| 422 | # also dump buildServer.json when use default output |
| 423 | from config import ServerConfig |
| 424 | |
| 425 | c = ServerConfig.shared() |
| 426 | c.indexStorePath = index_store_path |
| 427 | c.kind = "manual" |
| 428 | c.save() |
| 429 | else: |
| 430 | output = args.output |
| 431 | |
| 432 | if args.append and os.path.exists(output): |
| 433 | merge_database(items, output) |
| 434 | else: |
| 435 | # open will clear file |
| 436 | dump_database(items, open(output, "w")) |
| 437 | |
| 438 |
no test coverage detected