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