Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Aversion command-line option; fixes #3381 #3464

Merged
merged 14 commits into from
Jul 20, 2020
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Version 3.?.?, August 3, 2020

Added a new option `-Aversion` to print the version of the Checker Framework.

The Interning Checker supports method annotations @EqualsMethod and
@CompareToMethod. Place them on methods like equals(), compareTo(), and
compare() to permit certain uses of == on non-interned values.
Expand Down
4 changes: 4 additions & 0 deletions docs/manual/introduction.tex
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,10 @@
\<-AatfCacheSize>
Miscellaneous debugging options; see Section~\ref{creating-debugging-options-misc}.

\item
\<-Aversion>
Print the Checker Framework version.

\item
\<-AprintGitProperties>
Print information about the git repository from which the Checker Framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@

/// Amount of detail in messages

// Print the version of the Checker Framework
"version",
mernst marked this conversation as resolved.
Show resolved Hide resolved
// Print info about git repository from which the Checker Framework was compiled
"printGitProperties",

Expand Down Expand Up @@ -781,6 +783,9 @@ public void run() {
}
});
}
if (hasOption("version")) {
messager.printMessage(Kind.NOTE, "Checker Framework " + getCheckerVersion());
}
} catch (UserError ce) {
logUserError(ce);
} catch (TypeSystemError ce) {
Expand Down Expand Up @@ -2530,4 +2535,18 @@ private void printGitProperties() {
System.out.println("IOException while reading git.properties: " + e.getMessage());
}
}

/**
* Returns the version of the Checker Framework.
*
* @return Checker Framework version
*/
private String getCheckerVersion() {
Properties gitProperties = getProperties(getClass(), "/git.properties");
String version = gitProperties.getProperty("git.build.version");
if (version != null) {
return version;
}
throw new BugInCF("Could not find the version in git.properties");
}
}