summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-02-16 13:27:40 -0800
committerShawn O. Pearce <sop@google.com>2009-02-16 13:27:40 -0800
commit0d74e7fa07e70a95df0ee91c62065f3ca64ac885 (patch)
tree0ae8ca3bd2037813974626fc8017e377e4d13b61
parent8c21ea62c5ad96ebeba05505d0290b77dccf4f2a (diff)
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>
-rw-r--r--src/main/java/com/google/gerrit/client/Gerrit.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/com/google/gerrit/client/Gerrit.java b/src/main/java/com/google/gerrit/client/Gerrit.java
index 5e709d9539..8ebadcb02b 100644
--- a/src/main/java/com/google/gerrit/client/Gerrit.java
+++ b/src/main/java/com/google/gerrit/client/Gerrit.java
@@ -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) {