diff --git a/build.gradle.kts b/build.gradle.kts index 5772be4be4..da28832906 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ buildscript { allprojects { group = "hu.bme.mit.inf.theta" - version = "2.4.2" + version = "2.5.0" apply(from = rootDir.resolve("gradle/shared-with-buildSrc/mirrors.gradle.kts")) } diff --git a/subprojects/cfa-cli/README.md b/subprojects/cfa-cli/README.md index 0d7b3e389a..0e23bab5ef 100644 --- a/subprojects/cfa-cli/README.md +++ b/subprojects/cfa-cli/README.md @@ -55,6 +55,7 @@ If the extension of the output file is `pdf`, `png` or `svg` an automatic visual Otherwise, the output is simply in `dot` format. The arguments related to the algorithm are described in more detail (along with best practices) in [CEGAR-algorithms.md](../../doc/CEGAR-algorithms.md). +* `--version`: Print version info (in this case `--model` is of course not required). ### For developer usage diff --git a/subprojects/cfa-cli/src/main/java/hu/bme/mit/theta/cfa/cli/CfaCli.java b/subprojects/cfa-cli/src/main/java/hu/bme/mit/theta/cfa/cli/CfaCli.java index 1adbf8a0b6..27baa9d4c9 100644 --- a/subprojects/cfa-cli/src/main/java/hu/bme/mit/theta/cfa/cli/CfaCli.java +++ b/subprojects/cfa-cli/src/main/java/hu/bme/mit/theta/cfa/cli/CfaCli.java @@ -49,6 +49,7 @@ import hu.bme.mit.theta.cfa.analysis.config.CfaConfigBuilder.Search; import hu.bme.mit.theta.cfa.analysis.utils.CfaVisualizer; import hu.bme.mit.theta.cfa.dsl.CfaDslManager; +import hu.bme.mit.theta.common.CliUtils; import hu.bme.mit.theta.common.logging.ConsoleLogger; import hu.bme.mit.theta.common.logging.Logger; import hu.bme.mit.theta.common.logging.Logger.Level; @@ -130,6 +131,9 @@ public class CfaCli { @Parameter(names = "--stacktrace", description = "Print full stack trace in case of exception") boolean stacktrace = false; + @Parameter(names = "--version", description = "Display version", help = true) + boolean versionInfo = false; + private Logger logger; public CfaCli(final String[] args) { @@ -158,6 +162,11 @@ private void run() { return; } + if (versionInfo) { + CliUtils.printVersion(System.out); + return; + } + try { final Stopwatch sw = Stopwatch.createStarted(); final CFA cfa = loadModel(); diff --git a/subprojects/common/src/main/java/hu/bme/mit/theta/common/CliUtils.java b/subprojects/common/src/main/java/hu/bme/mit/theta/common/CliUtils.java new file mode 100644 index 0000000000..f8d3aaba27 --- /dev/null +++ b/subprojects/common/src/main/java/hu/bme/mit/theta/common/CliUtils.java @@ -0,0 +1,13 @@ +package hu.bme.mit.theta.common; + +import java.io.PrintStream; + +public class CliUtils { + private CliUtils() { } + + public static void printVersion(PrintStream ps) { + String ver = new CliUtils().getClass().getPackage().getImplementationVersion(); + if (ver == null) ver = "Unknown version. Are you running from JAR file?"; + ps.println(ver); + } +} diff --git a/subprojects/sts-cli/README.md b/subprojects/sts-cli/README.md index 304a0a1405..416fbf9f8c 100644 --- a/subprojects/sts-cli/README.md +++ b/subprojects/sts-cli/README.md @@ -43,6 +43,7 @@ All arguments are optional, except `--model`. * `--cex`: Output file where the counterexample is written (if the result is unsafe). If the argument is not given (default) the counterexample is not printed. Use `CON` (Windows) or `/dev/stdout` (Linux) as argument to print to the standard output. * `--loglevel`: Detailedness of logging. * Possible values (from the least to the most detailed): `RESULT`, `MAINSTEP`, `SUBSTEP` (default), `INFO`, `DETAIL`, `VERBOSE` +* `--version`: Print version info (in this case `--model` is of course not required). The arguments related to the algorithm are described in more detail (along with best practices) in [CEGAR-algorithms.md](../../doc/CEGAR-algorithms.md). diff --git a/subprojects/sts-cli/src/main/java/hu/bme/mit/theta/sts/cli/StsCli.java b/subprojects/sts-cli/src/main/java/hu/bme/mit/theta/sts/cli/StsCli.java index c3567b3566..31a60502d0 100644 --- a/subprojects/sts-cli/src/main/java/hu/bme/mit/theta/sts/cli/StsCli.java +++ b/subprojects/sts-cli/src/main/java/hu/bme/mit/theta/sts/cli/StsCli.java @@ -29,6 +29,7 @@ import hu.bme.mit.theta.analysis.algorithm.cegar.CegarStatistics; import hu.bme.mit.theta.analysis.expr.ExprState; import hu.bme.mit.theta.analysis.expr.refinement.PruneStrategy; +import hu.bme.mit.theta.common.CliUtils; import hu.bme.mit.theta.common.Utils; import hu.bme.mit.theta.common.logging.ConsoleLogger; import hu.bme.mit.theta.common.logging.Logger; @@ -104,6 +105,9 @@ public class StsCli { @Parameter(names = "--stacktrace", description = "Print full stack trace in case of exception") boolean stacktrace = false; + @Parameter(names = "--version", description = "Display version", help = true) + boolean versionInfo = false; + private Logger logger; public StsCli(final String[] args) { @@ -132,6 +136,11 @@ private void run() { return; } + if (versionInfo) { + CliUtils.printVersion(System.out); + return; + } + try { final Stopwatch sw = Stopwatch.createStarted(); final STS sts = loadModel(); diff --git a/subprojects/xsts-cli/README.md b/subprojects/xsts-cli/README.md index 15722c8e62..db6c3e571d 100644 --- a/subprojects/xsts-cli/README.md +++ b/subprojects/xsts-cli/README.md @@ -47,6 +47,7 @@ All arguments are optional, except `--model` and `--property`. * `--cex`: Output file where the counterexample is written (if the result is unsafe). If the argument is not given (default) the counterexample is not printed. Use `CON` (Windows) or `/dev/stdout` (Linux) as argument to print to the standard output. * `--loglevel`: Detailedness of logging. * Possible values (from the least to the most detailed): `RESULT`, `MAINSTEP`, `SUBSTEP` (default), `INFO`, `DETAIL`, `VERBOSE`. +* `--version`: Print version info (in this case `--model` and `--property` is of course not required). The arguments related to the algorithm are described in more detail (along with best practices) in [CEGAR-algorithms.md](../../doc/CEGAR-algorithms.md). diff --git a/subprojects/xsts-cli/src/main/java/hu/bme/mit/theta/xsts/cli/XstsCli.java b/subprojects/xsts-cli/src/main/java/hu/bme/mit/theta/xsts/cli/XstsCli.java index 1c907d0ab0..f205a69780 100644 --- a/subprojects/xsts-cli/src/main/java/hu/bme/mit/theta/xsts/cli/XstsCli.java +++ b/subprojects/xsts-cli/src/main/java/hu/bme/mit/theta/xsts/cli/XstsCli.java @@ -8,6 +8,7 @@ import hu.bme.mit.theta.analysis.algorithm.*; import hu.bme.mit.theta.analysis.algorithm.cegar.*; import hu.bme.mit.theta.analysis.expr.refinement.PruneStrategy; +import hu.bme.mit.theta.common.CliUtils; import hu.bme.mit.theta.common.logging.ConsoleLogger; import hu.bme.mit.theta.common.logging.Logger; import hu.bme.mit.theta.common.logging.NullLogger; @@ -90,6 +91,9 @@ public class XstsCli { @Parameter(names = "--stacktrace", description = "Print full stack trace in case of exception") boolean stacktrace = false; + @Parameter(names = "--version", description = "Display version", help = true) + boolean versionInfo = false; + private Logger logger; public XstsCli(final String[] args) { @@ -118,6 +122,11 @@ private void run() { return; } + if (versionInfo) { + CliUtils.printVersion(System.out); + return; + } + try { final Stopwatch sw = Stopwatch.createStarted(); final XSTS xsts = loadModel(); diff --git a/subprojects/xta-cli/src/main/java/hu/bme/mit/theta/xta/cli/XtaCli.java b/subprojects/xta-cli/src/main/java/hu/bme/mit/theta/xta/cli/XtaCli.java index 77d7444125..1558fdf2e0 100644 --- a/subprojects/xta-cli/src/main/java/hu/bme/mit/theta/xta/cli/XtaCli.java +++ b/subprojects/xta-cli/src/main/java/hu/bme/mit/theta/xta/cli/XtaCli.java @@ -27,6 +27,7 @@ import hu.bme.mit.theta.analysis.unit.UnitPrec; import hu.bme.mit.theta.analysis.utils.ArgVisualizer; import hu.bme.mit.theta.analysis.utils.TraceVisualizer; +import hu.bme.mit.theta.common.CliUtils; import hu.bme.mit.theta.common.logging.Logger; import hu.bme.mit.theta.common.table.BasicTableWriter; import hu.bme.mit.theta.common.table.TableWriter; @@ -68,6 +69,9 @@ public final class XtaCli { @Parameter(names = "--stacktrace", description = "Print full stack trace in case of exception") boolean stacktrace = false; + @Parameter(names = "--version", description = "Display version", help = true) + boolean versionInfo = false; + public XtaCli(final String[] args) { this.args = args; this.writer = new BasicTableWriter(System.out, ",", "\"", "\""); @@ -93,6 +97,11 @@ private void run() { return; } + if (versionInfo) { + CliUtils.printVersion(System.out); + return; + } + try { final XtaSystem system = loadModel(); final SafetyChecker checker = LazyXtaCheckerFactory.create(system, dataStrategy,