Merge "Populate version from HTML and not compiled into GWT JS"
This commit is contained in:
@@ -16,10 +16,7 @@ gwt_module(
|
|||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
name = 'server',
|
name = 'server',
|
||||||
srcs = glob(
|
srcs = glob([SRC + 'common/**/*.java']),
|
||||||
[SRC + 'common/**/*.java'],
|
|
||||||
excludes = [SRC + 'common/ClientVersion.java'],
|
|
||||||
),
|
|
||||||
deps = [
|
deps = [
|
||||||
'//gerrit-patch-jgit:server',
|
'//gerrit-patch-jgit:server',
|
||||||
'//gerrit-prettify:server',
|
'//gerrit-prettify:server',
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
// Copyright (C) 2009 The Android Open Source Project
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package com.google.gerrit.common;
|
|
||||||
|
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
|
||||||
import com.google.gwt.resources.client.TextResource;
|
|
||||||
|
|
||||||
public interface ClientVersion extends ClientBundle {
|
|
||||||
/** Version number of this client software build. */
|
|
||||||
@Source("Version")
|
|
||||||
TextResource version();
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/** Data sent as part of the host page, to bootstrap the UI. */
|
/** Data sent as part of the host page, to bootstrap the UI. */
|
||||||
public class HostPageData {
|
public class HostPageData {
|
||||||
|
public String version;
|
||||||
public Account account;
|
public Account account;
|
||||||
public AccountDiffPreference accountDiffPref;
|
public AccountDiffPreference accountDiffPref;
|
||||||
public String xGerritAuth;
|
public String xGerritAuth;
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ DEBUG_OPTS = [
|
|||||||
'-optimize', '0',
|
'-optimize', '0',
|
||||||
]
|
]
|
||||||
|
|
||||||
APP_DEPS = [
|
APP_DEPS = [':ui_module']
|
||||||
':ui_module',
|
|
||||||
'//gerrit-common:version',
|
|
||||||
]
|
|
||||||
|
|
||||||
def gwt_user_agent_permutations(
|
def gwt_user_agent_permutations(
|
||||||
name,
|
name,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import com.google.gerrit.client.ui.MorphingTabPanel;
|
|||||||
import com.google.gerrit.client.ui.PatchLink;
|
import com.google.gerrit.client.ui.PatchLink;
|
||||||
import com.google.gerrit.client.ui.Screen;
|
import com.google.gerrit.client.ui.Screen;
|
||||||
import com.google.gerrit.client.ui.ScreenLoadEvent;
|
import com.google.gerrit.client.ui.ScreenLoadEvent;
|
||||||
import com.google.gerrit.common.ClientVersion;
|
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.common.data.GerritConfig;
|
import com.google.gerrit.common.data.GerritConfig;
|
||||||
import com.google.gerrit.common.data.GitwebConfig;
|
import com.google.gerrit.common.data.GitwebConfig;
|
||||||
@@ -434,19 +433,13 @@ public class Gerrit implements EntryPoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void populateBottomMenu(final RootPanel btmmenu) {
|
private static void populateBottomMenu(RootPanel btmmenu, HostPageData hpd) {
|
||||||
final Label keyHelp = new Label(C.keyHelp());
|
final Label keyHelp = new Label(C.keyHelp());
|
||||||
keyHelp.setStyleName(RESOURCES.css().keyhelp());
|
keyHelp.setStyleName(RESOURCES.css().keyhelp());
|
||||||
btmmenu.add(keyHelp);
|
btmmenu.add(keyHelp);
|
||||||
|
|
||||||
String vs;
|
String vs = hpd.version;
|
||||||
if (GWT.isScript()) {
|
if (vs == null || vs.isEmpty()) {
|
||||||
final ClientVersion v = GWT.create(ClientVersion.class);
|
|
||||||
vs = v.version().getText();
|
|
||||||
if (vs.startsWith("v")) {
|
|
||||||
vs = vs.substring(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vs = "dev";
|
vs = "dev";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +532,7 @@ public class Gerrit implements EntryPoint {
|
|||||||
|
|
||||||
applyUserPreferences();
|
applyUserPreferences();
|
||||||
initHistoryHooks();
|
initHistoryHooks();
|
||||||
populateBottomMenu(gBottomMenu);
|
populateBottomMenu(gBottomMenu, hpd);
|
||||||
refreshMenuBar();
|
refreshMenuBar();
|
||||||
|
|
||||||
History.addValueChangeHandler(new ValueChangeHandler<String>() {
|
History.addValueChangeHandler(new ValueChangeHandler<String>() {
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
|
|
||||||
package com.google.gerrit.httpd.raw;
|
package com.google.gerrit.httpd.raw;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.hash.Hasher;
|
import com.google.common.hash.Hasher;
|
||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
|
import com.google.gerrit.common.Version;
|
||||||
import com.google.gerrit.common.data.GerritConfig;
|
import com.google.gerrit.common.data.GerritConfig;
|
||||||
import com.google.gerrit.common.data.HostPageData;
|
import com.google.gerrit.common.data.HostPageData;
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
@@ -275,6 +276,7 @@ public class HostPageServlet extends HttpServlet {
|
|||||||
footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer);
|
footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer);
|
||||||
|
|
||||||
final HostPageData pageData = new HostPageData();
|
final HostPageData pageData = new HostPageData();
|
||||||
|
pageData.version = Version.getVersion();
|
||||||
pageData.config = config;
|
pageData.config = config;
|
||||||
|
|
||||||
final StringWriter w = new StringWriter();
|
final StringWriter w = new StringWriter();
|
||||||
|
|||||||
Reference in New Issue
Block a user