Merge "Populate version from HTML and not compiled into GWT JS"
This commit is contained in:
commit
c6b69e739a
@ -16,10 +16,7 @@ gwt_module(
|
||||
|
||||
java_library(
|
||||
name = 'server',
|
||||
srcs = glob(
|
||||
[SRC + 'common/**/*.java'],
|
||||
excludes = [SRC + 'common/ClientVersion.java'],
|
||||
),
|
||||
srcs = glob([SRC + 'common/**/*.java']),
|
||||
deps = [
|
||||
'//gerrit-patch-jgit: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. */
|
||||
public class HostPageData {
|
||||
public String version;
|
||||
public Account account;
|
||||
public AccountDiffPreference accountDiffPref;
|
||||
public String xGerritAuth;
|
||||
|
@ -31,10 +31,7 @@ DEBUG_OPTS = [
|
||||
'-optimize', '0',
|
||||
]
|
||||
|
||||
APP_DEPS = [
|
||||
':ui_module',
|
||||
'//gerrit-common:version',
|
||||
]
|
||||
APP_DEPS = [':ui_module']
|
||||
|
||||
def gwt_user_agent_permutations(
|
||||
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.Screen;
|
||||
import com.google.gerrit.client.ui.ScreenLoadEvent;
|
||||
import com.google.gerrit.common.ClientVersion;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.common.data.GerritConfig;
|
||||
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());
|
||||
keyHelp.setStyleName(RESOURCES.css().keyhelp());
|
||||
btmmenu.add(keyHelp);
|
||||
|
||||
String vs;
|
||||
if (GWT.isScript()) {
|
||||
final ClientVersion v = GWT.create(ClientVersion.class);
|
||||
vs = v.version().getText();
|
||||
if (vs.startsWith("v")) {
|
||||
vs = vs.substring(1);
|
||||
}
|
||||
} else {
|
||||
String vs = hpd.version;
|
||||
if (vs == null || vs.isEmpty()) {
|
||||
vs = "dev";
|
||||
}
|
||||
|
||||
@ -539,7 +532,7 @@ public class Gerrit implements EntryPoint {
|
||||
|
||||
applyUserPreferences();
|
||||
initHistoryHooks();
|
||||
populateBottomMenu(gBottomMenu);
|
||||
populateBottomMenu(gBottomMenu, hpd);
|
||||
refreshMenuBar();
|
||||
|
||||
History.addValueChangeHandler(new ValueChangeHandler<String>() {
|
||||
|
@ -14,10 +14,11 @@
|
||||
|
||||
package com.google.gerrit.httpd.raw;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.hash.Hasher;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.collect.Lists;
|
||||
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.HostPageData;
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
@ -275,6 +276,7 @@ public class HostPageServlet extends HttpServlet {
|
||||
footer = injectXmlFile(hostDoc, "gerrit_footer", site.site_footer);
|
||||
|
||||
final HostPageData pageData = new HostPageData();
|
||||
pageData.version = Version.getVersion();
|
||||
pageData.config = config;
|
||||
|
||||
final StringWriter w = new StringWriter();
|
||||
|
Loading…
Reference in New Issue
Block a user