Package org.bmc4j.gradle
Class BmcExtensionConfig
java.lang.Object
org.bmc4j.gradle.BmcExtensionConfig
The
bmc { } DSL block.
bmc {
unwind = 16 // default loop bound for proofs
// jbmcPath = "/opt/cbmc/bin/jbmc" // use a local binary instead of the bundled engine
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThemodels { conformant(...) / domain(...) }DSL block. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.ListProperty<String> Build-wide acknowledged nondet stubs: methods every proof may rely on as havoc'd stand-ins without warning.abstract org.gradle.api.provider.Property<Boolean> getCache()Per-proof verdict caching.abstract org.gradle.api.provider.Property<String> Optional path to an existing JBMC binary.abstract BmcExtensionConfig.ModelSpecRegistered user models with their declared intent.abstract org.gradle.api.provider.Property<Integer> How many proofs to verify concurrently — each runs its ownjbmcprocess, and proofs are independent, so this scales near-linearly.abstract org.gradle.api.provider.Property<Boolean> Show per-proof progress while thetesttask runs ("proving X", "OK/REFUTED X (Ns)") plus a final summary, at Gradle's lifecycle level so it's visible in a normalgradlew test.abstract org.gradle.api.provider.Property<String> SAT/SMT backend for JBMC.abstract org.gradle.api.provider.Property<String> Path/command for an external SMT2 solver binary (used with--smt2); overridesgetSolver().abstract org.gradle.api.provider.Property<String> Directory holding the SMT solver binary (e.g.abstract org.gradle.api.provider.Property<Boolean> Strict user-model mode, thestrictStubsanalog.abstract org.gradle.api.provider.Property<Boolean> Strict nondet-stub mode.abstract org.gradle.api.provider.Property<Integer> Default per-proof wall-clock budget in seconds.abstract org.gradle.api.provider.Property<Integer> Default loop/recursion unwinding bound for proofs that don't override it.abstract org.gradle.api.provider.ListProperty<String> Package prefixes of the module under test.voidmodels(org.gradle.api.Action<? super BmcExtensionConfig.ModelSpec> action) Configure the registered user models -- seegetModelSpec().
-
Constructor Details
-
BmcExtensionConfig
public BmcExtensionConfig()
-
-
Method Details
-
getJbmcPath
Optional path to an existing JBMC binary. When set, the bundled engine dependency is not added and this binary is used instead — useful for an internal mirror, a custom build, or air-gapped environments. -
getUnwind
Default loop/recursion unwinding bound for proofs that don't override it. -
getTimeoutSeconds
Default per-proof wall-clock budget in seconds. When a proof doesn't reach a verdict in time, its engine process tree is force-killed and the proof is reportedUNKNOWN(undecided — still fails, but distinctly from a refutation). A proof's@BmcProof(timeoutSeconds=…)overrides this. Unset /0means no timeout (proofs run to completion). Overridable at the command line with-Dbmc.timeoutSeconds. -
getParallelism
How many proofs to verify concurrently — each runs its ownjbmcprocess, and proofs are independent, so this scales near-linearly. Defaults to the number of available processors. Set to1to run proofs serially (e.g. if heavy proofs strain memory). -
getSolver
SAT/SMT backend for JBMC. Default is JBMC's built-in MiniSat. SMT solvers ("z3","boolector","cvc4","cvc5") — which must be onPATH— can be much faster on array/bitvector-heavy proofs; any other value is passed to--sat-solver(e.g."cadical","glucose"). -
getSolverCmd
Path/command for an external SMT2 solver binary (used with--smt2); overridesgetSolver(). Use when the solver isn't onPATH. -
getSolverPath
Directory holding the SMT solver binary (e.g. the dir containingz3). It's prepended to jbmc's PATH sogetSolver()/@BmcProof(solver=…)can find the solver without it being on the globalPATH. Keep machine-specific paths out of the repo — set it from a Gradle property, e.g.solverPath = providers.gradleProperty("z3Path").orNull. -
getProgress
Show per-proof progress while thetesttask runs ("proving X", "OK/REFUTED X (Ns)") plus a final summary, at Gradle's lifecycle level so it's visible in a normalgradlew test. On by default — proofs can take seconds each, and silence looks like a hang. Set tofalsefor quiet CI logs. -
getCache
Per-proof verdict caching. Whentrue(the default), a proof that verified and whose inputs (bytecode, flags, engine + runtime semantics) are unchanged is skipped on the next run and reported passed from the cache underbuild/bmc4j/verdict-cache/— so "nothing changed" runs are near-free. Only green verdicts are ever cached; refuted/UNKNOWN proofs always re-run. Setfalse(or pass-Dbmc.noCache=true) to force full re-verification every time. The cache lives underbuild/, sogradlew cleanclears it. -
getAllowStubs
Build-wide acknowledged nondet stubs: methods every proof may rely on as havoc'd stand-ins without warning. JBMC stubs any callee it has no body for to a nondet result; bmc4j footnotes that on green proofs (and, undergetStrictStubs(), turns an unacknowledged stub into UNKNOWN). Listing a method here silences it suite-wide; a proof can add more with@BmcProof(allowStubs = …). Entries are fully-qualified method names with an optional trailing wildcard:"java.util.Formatter.format","java.util.Formatter.*", or"java.util.*". -
getStrictStubs
Strict nondet-stub mode. Whentrue, any unacknowledged stub a proof reaches turns its verdict into UNKNOWN (BmcUndecidedError) — nothing was proven wrong, but the verdict rests on havoc'd stand-ins, so it isn't trustworthy. Defaultfalse(lenient: green + footnote). Overridable at the command line with-Dbmc.strictStubs=true, so flipping it re-judges from the stored stub fact without re-running proofs (the stub list is cached). -
getUserPackages
Package prefixes of the module under test. A stub from one of these — the user's own code — is almost always a missing-dependency config bug, not a JDK modeling gap, so it is warned loudly even in lenient mode (and forces UNKNOWN in strict mode). Comma/space-separated prefixes, e.g.userPackages = ["com.acme"]. Overridable with-Dbmc.userPackages. -
getModelSpec
Registered user models with their declared intent. A class undersrc/bmcModelshadows its real counterpart on JBMC's analysis classpath; registering it here adds the trust metadata bmc4j needs to put provenance on a verdict that rests on it.bmc { models { conformant("acme.FastList") // claims JDK fidelity domain("acme.NoCollisionMap", "keys are UUIDs, collision-free") // intentional divergence } }A
domainmodel encodes a constraint that deliberately diverges from the JDK -- it isBmc.assume()at classpath altitude -- so it requires a one-line rationale, which is footnoted on every green proof that rests on it. Aconformantmodel claims JDK fidelity and can be checked by the same conformance harness as bundled models. UndergetStrictModels(), a model present undersrc/bmcModelbut NOT registered here turns the verdict into UNKNOWN. -
models
Configure the registered user models -- seegetModelSpec(). -
getStrictModels
Strict user-model mode, thestrictStubsanalog. Whentrue, a model present undersrc/bmcModelwith nobmc { models { ... } }intent declaration turns the proof's verdict into UNKNOWN (BmcUndecidedError) -- no proof silently rests on an undeclared override. Defaultfalse(lenient: green + a loud "UNDECLARED model" footnote). Overridable at the command line with-Dbmc.strictModels=true; likestrictStubsit is read-time policy, so flipping it re-judges without re-running proofs.
-