Skip to content

Commit cb6a523

Browse files
committed
Load version from file
1 parent 8915b13 commit cb6a523

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/multeval/MultEval.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import jannopts.Configurator;
55

66
import java.io.IOException;
7+
import java.io.FileInputStream;
8+
import java.util.Properties;
79
import java.util.ArrayList;
810
import java.util.List;
911
import java.util.Map;
@@ -68,21 +70,31 @@ static int initThreads(final List<Metric<?>> metrics, int threads) {
6870
return threads;
6971
}
7072

73+
private static String loadVersion() throws IOException {
74+
Properties props = new Properties();
75+
FileInputStream in = new FileInputStream("constants");
76+
props.load(in);
77+
in.close();
78+
String version = props.getProperty("version");
79+
return version;
80+
}
81+
7182
public static void main(String[] args) throws ConfigurationException, IOException,
7283
InterruptedException {
7384

85+
String version = loadVersion();
86+
System.err.println(String.format("MultEval V%s\n", version) +
87+
"By Jonathan Clark\n" +
88+
"Using Libraries: METEOR (Michael Denkowski) and TER (Matthew Snover)\n");
89+
7490
if (args.length == 0 || !MODULES.keySet().contains(args[0])) {
7591
System.err.println("Usage: program <module_name> <module_options>");
7692
System.err.println("Available modules: " + MODULES.keySet().toString());
7793
System.exit(1);
7894
} else {
7995
String moduleName = args[0];
8096
Module module = MODULES.get(moduleName);
81-
// TODO: Load version from constants file
82-
Configurator opts =
83-
new Configurator().withProgramHeader(
84-
"MultEval V0.5.0\nBy Jonathan Clark\nUsing Libraries: METEOR (Michael Denkowski) and TER (Matthew Snover)\n")
85-
.withModuleOptions(moduleName, module.getClass());
97+
Configurator opts = new Configurator().withModuleOptions(moduleName, module.getClass());
8698

8799
// add "dynamic" options, which might be activated later
88100
// by the specified switch values

0 commit comments

Comments
 (0)