Make Gerrit.getVersion public for other code to use

This may be useful to embed into a URL, such as to ensure that
the URL is loaded at least once per application version seen by
a browser.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-02-16 13:27:40 -08:00
parent 8c21ea62c5
commit 0d74e7fa07

View File

@@ -57,6 +57,7 @@ public class Gerrit implements EntryPoint {
public static final GerritIcons ICONS = GWT.create(GerritIcons.class);
public static final SystemInfoService SYSTEM_SVC;
private static String myVersion;
private static Account myAccount;
private static final ArrayList<SignedInListener> signedInListeners =
new ArrayList<SignedInListener>();
@@ -232,18 +233,25 @@ public class Gerrit implements EntryPoint {
private static void populateBottomMenu() {
final RootPanel btmmenu = RootPanel.get("gerrit_btmmenu");
final String vs;
if (GWT.isScript()) {
final GerritVersion v = GWT.create(GerritVersion.class);
vs = v.version();
} else {
vs = "dev";
}
final String vs = getVersion();
final HTML version = new HTML(M.poweredBy(vs));
version.setStyleName("gerrit-version");
btmmenu.add(version);
}
/** @return version number of the Gerrit application software */
public static String getVersion() {
if (myVersion == null) {
if (GWT.isScript()) {
final GerritVersion v = GWT.create(GerritVersion.class);
myVersion = v.version();
} else {
myVersion = "dev";
}
}
return myVersion;
}
private void onModuleLoad2() {
if (Cookies.getCookie(ACCOUNT_COOKIE) != null
|| Common.getGerritConfig().getLoginType() == SystemConfig.LoginType.HTTP) {