Skip to content

Commit bc74448

Browse files
committed
Update README, fix issue caused by automerge
1 parent 4582e74 commit bc74448

File tree

6 files changed

+780
-455
lines changed

6 files changed

+780
-455
lines changed

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
# TraVarT Core
1+
# TraVarT: Core library
22

3-
This directory contains the core interfaces / classes to be used across the TraVarT Ecosystem.
3+
This repository contains the TraVarT core module which can be extended with plugins. The core module itself only provides support
4+
for UVL models, which is the pivot metamodel. Additionally, the core module has a CLI to invoke transformations, list benchmarks etc.
45

5-
## CheckStyle
6+
To get started, copy over TraVarT plugins (as JAR archives) into the `plugins` folder in this repository (if this folder does not
7+
exist, create it, the path should be ignored by Git).
68

7-
Configure IntelliJ as follows:
9+
The command-line interface provides three subcommands: `plugin`, `benchmark` and `transform'. An exhaustive list of possible
10+
options and flags for individual subcommands can be viewed by invoking the respective subcommand as a sub-subcommand of `help` i.e., `help plugin`.
11+
If you want to start TraVarT directly off this repository (and not over a compiled JAR file independent from the repository), invoke
12+
the Maven exection plugin over `mvn exec:java`. You can provide command-line arguments while using `exec:java` with `-Dexec.args`.
813

9-
1. Install Checkstyle plugin
10-
1. Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to.
11-
1. Click Manage...|Import.., choose "CheckStyle Configuration" and select a corresponding CheckStyle configuration file.
12-
Click OK
14+
For clarity, we will shortly introduce the subcommands here:
1315

14-
[credit](http://biercoff.com/how-to-import-checkstyle-rules-into-intellij-idea-code-format-rules/)
16+
- `plugin`: This subcommand lists currently detected plugins. There are no flags or sub-subcommands of this subcommand.
17+
- `benchmark`: This subcommand lists currently known benchmarks. There are no flags or sub-subcommands of this subcommand.
18+
- `transform`: This subcommand allows invocation of installed plugins to transform models. It has four mandatory parameters and several optional flags:
19+
- First command-line parameter should be the path to the source model (model to be transformed).
20+
- Second command-line parameter should be the path to the target model (this will be created by the end of the transformation).
21+
- Two mandatory flags are `-st` and `-tt` (or respectively `--source-type` and `--target-type`). These should correspond to the source and target model types, else transformation is not possible.
22+
- The flag `--benchmark` can be used to activate any number of benchmarks during transformation. The argument to this option should be comma-seperated list of benchmark names, as shown over the `benchmark` subcommand.
23+
- The flag `--write-benchmarks` can be used to write benchmark results automatically into some given file. The given file will be concatenated, the output format is CSV.
24+
- The flag `--blacklist-file` can be used to include some blacklist file while transforming. Blacklisted models (matching by name) won't be transformed.
25+
- The flag `--strategy` can be used to enforce a certain transformation strategy. By default, TraVarT attempts an one-way transformation. The two possible values here are `ONE\_WAY` or `ROUNDTRIP`.
26+
- The flag `--inplace-roundtrip` can be used alongside `--strategy=ROUNDTRIP`. In-place roundtrip transformation means that the forward transformation is immediately followed by a reverse transformation; i.e. the resulting model is in source type.
27+
- The flag `--no-serialize` can be used to skip serialization after transformation. This is especially useful if the user is only interested in benchmarking results. When serialization is skipped, the target model is not persisted.
28+
- The flag `--strict` can be used when working in batch mode (source path is a folder with multiple models). If in strict mode, transformation is aborted after the first timeout/transformation failure.
29+
- As just mentioned, TraVarT has a default transformation timeout; this is 5 seconds by default. It can be optionally changed to some arbitrary number of seconds over the `--timeout` option.
30+
31+
All subcommands also support the `--verbose` flag.
32+
33+
More regarding the architecture of TraVarT and related tools can be found in the publications regarding TraVarT.

src/main/java/at/jku/cps/travart/core/FeatureModelStatistics.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*******************************************************************************/
1616
package at.jku.cps.travart.core;
1717

18-
import java.util.Objects;
19-
2018
import org.apache.logging.log4j.Level;
2119
import org.apache.logging.log4j.Logger;
2220

@@ -34,35 +32,46 @@ public int getVariabilityElementsCount(final FeatureModel fm) {
3432
}
3533

3634
@Override
37-
public long getConstraintsCount(final FeatureModel fm) {
38-
return (long) TraVarTUtils.getFeatureConstraints(fm).size() + TraVarTUtils.getGlobalConstraints(fm).size()
39-
+ TraVarTUtils.getLiteralConstraints(fm).size() + TraVarTUtils.getOwnConstraints(fm).size();
35+
public int getConstraintsCount(final FeatureModel fm) {
36+
return TraVarTUtils.getFeatureConstraints(fm).size()
37+
+ TraVarTUtils.getGlobalConstraints(fm).size()
38+
+ TraVarTUtils.getLiteralConstraints(fm).size()
39+
+ TraVarTUtils.getOwnConstraints(fm).size();
4040
}
4141

4242
@Override
4343
public void logModelStatistics(final Logger logger, final FeatureModel fm) {
44-
logger.log(Level.INFO, "Root Name: {}", fm.getRootFeature().getFeatureName());
45-
logger.log(Level.INFO, "#Features: {}", getVariabilityElementsCount(fm));
46-
logger.log(Level.INFO, "#Abstract Features: {}", countAbstractFeatures(fm));
47-
logger.log(Level.INFO, "#Mandatory Features: {}", countMandatoryFeatures(fm));
48-
logger.log(Level.INFO, "#Optional Features: {}", countOptionalFeatures(fm));
44+
logger.log(Level.INFO, "Root Name: {}",
45+
fm.getRootFeature().getFeatureName());
46+
logger.log(Level.INFO, "#Features: {}",
47+
getVariabilityElementsCount(fm));
48+
logger.log(Level.INFO, "#Abstract Features: {}",
49+
countAbstractFeatures(fm));
50+
logger.log(Level.INFO, "#Mandatory Features: {}",
51+
countMandatoryFeatures(fm));
52+
logger.log(Level.INFO, "#Optional Features: {}",
53+
countOptionalFeatures(fm));
4954
logger.log(Level.INFO, "#Or groups: {}", countOrGroups(fm));
5055
logger.log(Level.INFO, "#Xor groups: {}", countXorGroups(fm));
5156
logger.log(Level.INFO, "#Constraints: {}", getConstraintsCount(fm));
52-
logger.log(Level.INFO, "Tree height: {}", computeFMHeight(TraVarTUtils.getRoot(fm)));
57+
logger.log(Level.INFO, "Tree height: {}",
58+
computeFMHeight(TraVarTUtils.getRoot(fm)));
5359
}
5460

5561
private static int countAbstractFeatures(final FeatureModel fm) {
56-
return (int) TraVarTUtils.getFeatures(fm).stream().filter(TraVarTUtils::isAbstract).count();
62+
return (int) TraVarTUtils.getFeatures(fm).stream()
63+
.filter(TraVarTUtils::isAbstract).count();
5764
}
5865

5966
private static int countMandatoryFeatures(final FeatureModel fm) {
60-
return (int) TraVarTUtils.getFeatures(fm).stream().filter(TraVarTUtils::isMandatory).count();
67+
return (int) TraVarTUtils.getFeatures(fm).stream()
68+
.filter(TraVarTUtils::isMandatory).count();
6169
}
6270

6371
private static int countOptionalFeatures(final FeatureModel fm) {
64-
return (int) TraVarTUtils.getFeatures(fm).stream()
65-
.filter(f -> TraVarTUtils.checkGroupType(f, Group.GroupType.OPTIONAL)).count();
72+
return (int) TraVarTUtils.getFeatures(fm).stream().filter(
73+
f -> TraVarTUtils.checkGroupType(f, Group.GroupType.OPTIONAL))
74+
.count();
6675
}
6776

6877
private static int countOrGroups(final FeatureModel fm) {
@@ -73,7 +82,8 @@ private static int countXorGroups(final FeatureModel fm) {
7382
return countGroupType(fm, Group.GroupType.ALTERNATIVE);
7483
}
7584

76-
private static int countGroupType(final FeatureModel fm, final Group.GroupType grouptype) {
85+
private static int countGroupType(final FeatureModel fm,
86+
final Group.GroupType grouptype) {
7787
int count = 0;
7888
for (Feature feature : TraVarTUtils.getFeatures(fm)) {
7989
count += TraVarTUtils.countGroup(feature, grouptype);

src/main/java/at/jku/cps/travart/core/cli/TraVarTCommand.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
import at.jku.cps.travart.core.helpers.TraVarTPluginManager;
2222
import picocli.CommandLine; // Re-implement CLI with Commons CLI framework?
2323
import picocli.CommandLine.Command;
24+
import picocli.CommandLine.HelpCommand;
2425
import picocli.CommandLine.Option;
2526
import picocli.CommandLine.ScopeType;
2627

2728
@Command(name = "travart", subcommands = {TransformCommand.class,
28-
PluginCommand.class,
29-
BenchmarkCommand.class}, mixinStandardHelpOptions = true, version = "0.0.1", description = "TraVarT main command to transform and validate variability artifacts.")
29+
PluginCommand.class, BenchmarkCommand.class,
30+
HelpCommand.class}, mixinStandardHelpOptions = true, version = "0.0.1", description = "TraVarT main command to transform and validate variability artifacts.")
3031
public class TraVarTCommand {
3132

3233
static {
@@ -46,7 +47,7 @@ public static void main(final String[] args) {
4647
arg = args;
4748
}
4849
int exitCode = new CommandLine(new TraVarTCommand()).execute(arg);
49-
TraVarTPluginManager.stopPlugins();
50+
// TraVarTPluginManager.stopPlugins();
5051
System.exit(exitCode);
5152
}
5253
}

src/main/java/at/jku/cps/travart/core/cli/TransformCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ private static String toStringList(final Iterable<String> fileExtensions) {
9595
@Parameters(index = "1", description = "The output path to which the variability artifact is transformed. If the source is given as a folder, this parameter must be a folder too.")
9696
private Path targetPath;
9797

98-
@Option(names = {"-st", "-sourceType", "--st",
99-
"--sourceType"}, required = true, description = "The mandatory type of the source variability artifacts, as listed in the plugin command.")
98+
@Option(names = {"-st", "-sourceType", "--st", "--sourceType",
99+
"--source-type"}, required = true, description = "The mandatory type of the source variability artifacts, as listed in the plugin command.")
100100
private String sourceType;
101101

102-
@Option(names = {"-tt", "-targetType", "--tt",
103-
"--targetType"}, required = true, description = "The mandatory target type of the transformed variability artifacts, as listed by the plugin command.")
102+
@Option(names = {"-tt", "-targetType", "--tt", "--targetType",
103+
"--target-type"}, required = true, description = "The mandatory target type of the transformed variability artifacts, as listed by the plugin command.")
104104
private String targetType;
105105

106106
@Option(names = {"-b",

0 commit comments

Comments
 (0)