1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768(* This file is part of Bisect_ppx, released under the MIT license. See
LICENSE.md for details, or visit
https://github.com/aantron/bisect_ppx/blob/master/LICENSE.md. *)letconditional=reffalseletenabled()=match!conditionalwith|false->`Enabled|true->matchSys.getenv"BISECT_ENABLE"with|exceptionNot_found->`Disabled|swhenString.uppercase_asciis="YES"->`Enabled|_->`Disabledletconditional_exclude_filefilename=matchenabled()with|`Enabled->Exclusions.add_from_filefilename|`Disabled->()letswitches=[("--exclude-files",Arg.StringExclusions.add_file,"<regexp> Exclude files matching <regexp>");("--exclusions",Arg.Stringconditional_exclude_file,"<filename> Exclude functions listed in given file");("--conditional",Arg.Setconditional," Instrument only when BISECT_ENABLE is YES");("--bisect-file",Arg.String(funs->Instrument.bisect_file:=Somes)," Default value for BISECT_FILE environment variable");("--bisect-silent",Arg.String(funs->Instrument.bisect_silent:=Somes)," Default value for BISECT_SILENT environment variable");("--bisect-sigterm",Arg.SetInstrument.bisect_sigterm,(" Install a signal handler writing coverage data and"^" terminating on reception of SIGTERM"));]let()=Arg.alignswitches|>List.iter(fun(key,spec,doc)->Ppxlib.Driver.add_argkeyspec~doc)let()=letimplctxtast=matchenabled()with|`Enabled->newInstrument.instrumenter#transform_impl_filectxtast|`Disabled->astinletinstrument=Ppxlib.Driver.Instrument.V2.makeimpl~position:AfterinPpxlib.Driver.register_transformation~instrument"bisect_ppx"