| 424 | |
| 425 | |
| 426 | def commandline_parser() -> ArgumentParser: |
| 427 | script_description = ( |
| 428 | "Generates a report listing bytecode and metadata obtained by compiling all the " |
| 429 | "*.sol files found in the current working directory using the provided binary." |
| 430 | ) |
| 431 | |
| 432 | parser = ArgumentParser(description=script_description) |
| 433 | parser.add_argument(dest='compiler_path', help="Solidity compiler executable") |
| 434 | parser.add_argument( |
| 435 | '--interface', |
| 436 | dest='interface', |
| 437 | default=CompilerInterface.STANDARD_JSON.value, |
| 438 | choices=[c.value for c in CompilerInterface], |
| 439 | help="Compiler interface to use.", |
| 440 | ) |
| 441 | parser.add_argument( |
| 442 | '--execution-arch', |
| 443 | dest='execution_arch', |
| 444 | default=ExecutionArchitecture.NATIVE.value, |
| 445 | choices=[c.value for c in ExecutionArchitecture], |
| 446 | help="Select the architecture of the universal binary that should be executed. (Only relevant for macOS)", |
| 447 | ) |
| 448 | parser.add_argument( |
| 449 | '--preset', |
| 450 | dest='presets', |
| 451 | default=None, |
| 452 | nargs='+', |
| 453 | action='append', |
| 454 | choices=[p.value for p in SettingsPreset], |
| 455 | help="Predefined set of settings to pass to the compiler. More than one can be selected.", |
| 456 | ) |
| 457 | parser.add_argument( |
| 458 | '--smt-use', |
| 459 | dest='smt_use', |
| 460 | default=SMTUse.DISABLE.value, |
| 461 | choices=[s.value for s in SMTUse], |
| 462 | help="What to do about contracts that use the experimental SMT checker." |
| 463 | ) |
| 464 | parser.add_argument( |
| 465 | '--force-no-optimize-yul', |
| 466 | dest='force_no_optimize_yul', |
| 467 | default=False, |
| 468 | action='store_true', |
| 469 | help="Explicitly disable Yul optimizer in CLI runs without optimization to work around a bug in solc 0.6.0 and 0.6.1." |
| 470 | ) |
| 471 | parser.add_argument('--report-file', dest='report_file', default='report.txt', help="The file to write the report to.") |
| 472 | parser.add_argument('--verbose', dest='verbose', default=False, action='store_true', help="More verbose output.") |
| 473 | parser.add_argument( |
| 474 | '--exit-on-error', |
| 475 | dest='exit_on_error', |
| 476 | default=False, |
| 477 | action='store_true', |
| 478 | help="Immediately exit and print compiler output if the compiler exits with an error.", |
| 479 | ) |
| 480 | return parser |
| 481 | |
| 482 | |
| 483 | if __name__ == "__main__": |