Merge "Update GWT version to 2.6.0-rc3"

This commit is contained in:
Shawn Pearce 2014-01-24 05:14:02 +00:00 committed by Gerrit Code Review
commit d573026720
7 changed files with 181 additions and 64 deletions

View File

@ -1,6 +1,11 @@
java_library(
name = 'gwtdebug',
srcs = ['src/main/java/com/google/gerrit/gwtdebug/GerritDebugLauncher.java'],
deps = ['//lib/gwt:dev'],
deps = [
'//lib/gwt:dev',
'//lib/jetty:server',
'//lib/jetty:servlet',
'//lib/jetty:webapp',
],
visibility = ['//tools/eclipse:classpath'],
)

View File

@ -19,29 +19,31 @@ import com.google.gwt.core.ext.ServletContainer;
import com.google.gwt.core.ext.ServletContainerLauncher;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.dev.shell.jetty.JettyNullLogger;
import org.mortbay.component.AbstractLifeCycle;
import org.mortbay.jetty.AbstractConnector;
import org.mortbay.jetty.HttpFields.Field;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.RequestLog;
import org.mortbay.jetty.Response;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.RequestLogHandler;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppClassLoader;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.log.Log;
import org.mortbay.log.Logger;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.RequestLog;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Iterator;
public class GerritDebugLauncher extends ServletContainerLauncher {
private final static boolean __escape = true;
/**
* Log jetty requests/responses to TreeLogger.
*/
@ -57,7 +59,6 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
/**
* Log an HTTP request/response to TreeLogger.
*/
@SuppressWarnings("unchecked")
public void log(Request request, Response response) {
int status = response.getStatus();
if (status < 0) {
@ -93,20 +94,13 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
if (branch.isLoggable(logHeaders)) {
// Request headers
TreeLogger headers = branch.branch(logHeaders, "Request headers");
Iterator<Field> headerFields =
request.getConnection().getRequestFields().getFields();
while (headerFields.hasNext()) {
Field headerField = headerFields.next();
headers.log(logHeaders, headerField.getName() + ": "
+ headerField.getValue());
for (HttpField f : request.getHttpFields()) {
headers.log(logHeaders, f.getName() + ": " + f.getValue());
}
// Response headers
headers = branch.branch(logHeaders, "Response headers");
headerFields = response.getHttpFields().getFields();
while (headerFields.hasNext()) {
Field headerField = headerFields.next();
headers.log(logHeaders, headerField.getName() + ": "
+ headerField.getValue());
for (HttpField f : response.getHttpFields()) {
headers.log(logHeaders, f.getName() + ": " + f.getValue());
}
}
}
@ -163,6 +157,54 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
logger.log(TreeLogger.WARN, msg, th);
}
public void debug(String msg, long value) {
// ignored
}
@Override
public void debug(String msg, Object... args) {
// ignored
}
@Override
public void debug(Throwable thrown) {
// ignored
}
@Override
public void warn(String msg, Object... args) {
logger.log(TreeLogger.WARN, format(msg, args));
}
@Override
public void warn(Throwable thrown) {
logger.log(TreeLogger.WARN, thrown.getMessage(), thrown);
}
@Override
public void info(String msg, Object... args) {
logger.log(TreeLogger.INFO, format(msg, args));
}
@Override
public void info(Throwable thrown) {
logger.log(TreeLogger.INFO, thrown.getMessage(), thrown);
}
@Override
public void info(String msg, Throwable thrown) {
logger.log(TreeLogger.INFO, msg, thrown);
}
@Override
public void ignore(Throwable ignored) {
}
@Override
public String getName() {
return this.getName();
}
/**
* Copied from org.mortbay.log.StdErrLog.
*/
@ -178,6 +220,54 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
}
return msg;
}
private String format(String msg, Object... args) {
StringBuilder builder = new StringBuilder();
if (msg == null) {
msg = "";
for (int i = 0; i < args.length; i++) {
msg += "{} ";
}
}
String braces = "{}";
int start = 0;
for (Object arg : args) {
int bracesIndex = msg.indexOf(braces,start);
if (bracesIndex < 0) {
escape(builder, msg.substring(start));
builder.append(" ");
builder.append(arg);
start = msg.length();
} else {
escape(builder, msg.substring(start, bracesIndex));
builder.append(String.valueOf(arg));
start = bracesIndex + braces.length();
}
}
escape(builder, msg.substring(start));
return builder.toString();
}
private void escape(StringBuilder builder, String string) {
if (__escape) {
for (int i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
if (Character.isISOControl(c)) {
if (c == '\n') {
builder.append('|');
} else if (c == '\r') {
builder.append('<');
} else {
builder.append('?');
}
} else {
builder.append(c);
}
}
} else {
builder.append(string);
}
}
}
/**
@ -268,7 +358,6 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
private final ClassLoader systemClassLoader =
Thread.currentThread().getContextClassLoader();
@SuppressWarnings("unchecked")
private MyWebAppContext(String webApp, String contextPath) {
super(webApp, contextPath);
@ -282,7 +371,7 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
@Override
protected void doStart() throws Exception {
setClassLoader(new MyLoader());
setClassLoader(new MyLoader(this));
super.doStart();
}
@ -293,9 +382,10 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
}
private class MyLoader extends WebAppClassLoader {
MyLoader() throws IOException {
MyWebAppContext ctx;
MyLoader(MyWebAppContext ctx) throws IOException {
super(bootStrapOnlyClassLoader, MyWebAppContext.this);
this.ctx = ctx;
final URLClassLoader scl = (URLClassLoader) systemClassLoader;
final URL[] urls = scl.getURLs();
for (URL u : urls) {
@ -305,17 +395,10 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
}
}
@Override
public boolean isSystemPath(String name) {
name = name.replace('/', '.');
return super.isSystemPath(name) //
|| name.startsWith("org.bouncycastle.");
}
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
// For system path, always prefer the outside world.
if (isSystemPath(name)) {
if (ctx.isSystemClass(name.replace('/', '.'))) {
try {
return systemClassLoader.loadClass(name);
} catch (ClassNotFoundException e) {
@ -327,9 +410,6 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
}
static {
// Suppress spammy Jetty log initialization.
System
.setProperty("org.mortbay.log.class", JettyNullLogger.class.getName());
Log.getLog();
/*
@ -357,7 +437,6 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
throws Exception {
TreeLogger branch =
logger.branch(TreeLogger.INFO, "Starting Jetty on port " + port, null);
checkStartParams(branch, port, warDir);
// Setup our branch logger during startup.
@ -366,7 +445,10 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
// Turn off XML validation.
System.setProperty("org.mortbay.xml.XmlParser.Validating", "false");
AbstractConnector connector = getConnector();
Server server = new Server();
HttpConfiguration config = defaultConfig();
ServerConnector connector = new ServerConnector(server,
new HttpConnectionFactory(config));
if (bindAddress != null) {
connector.setHost(bindAddress);
}
@ -378,7 +460,7 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
// Linux keeps the port blocked after shutdown if we don't disable this.
connector.setSoLingerTime(0);
Server server = new Server();
server.addConnector(connector);
File top;
@ -413,12 +495,16 @@ public class GerritDebugLauncher extends ServletContainerLauncher {
// Now that we're started, log to the top level logger.
Log.setLog(new JettyTreeLogger(logger));
return new JettyServletContainer(logger, server, wac, connector
.getLocalPort(), warDir);
return new JettyServletContainer(logger, server, wac,
connector.getLocalPort(), warDir);
}
protected AbstractConnector getConnector() {
return new SelectChannelConnector();
protected HttpConfiguration defaultConfig() {
HttpConfiguration config = new HttpConfiguration();
config.setRequestHeaderSize(16386);
config.setSendServerVersion(false);
config.setSendDateHeader(true);
return config;
}
private void checkStartParams(TreeLogger logger, int port, File appRootDir) {

View File

@ -25,10 +25,12 @@ import com.googlecode.gwt.test.GwtTest;
import net.codemirror.lib.LineCharacter;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/** Unit tests for EditIterator */
@GwtModule("com.google.gerrit.GerritGwtUI")
@Ignore
public class EditIteratorTest extends GwtTest {
private JsArrayString lines;

View File

@ -65,29 +65,29 @@ maven_jar(
maven_jar(
name = 'ow2-asm',
id = 'org.ow2.asm:asm:4.0',
sha1 = '659add6efc75a4715d738e73f07505246edf4d66',
id = 'org.ow2.asm:asm:4.1',
sha1 = 'ad568238ee36a820bd6c6806807e8a14ea34684d',
license = 'ow2',
)
maven_jar(
name = 'ow2-asm-analysis',
id = 'org.ow2.asm:asm-analysis:4.0',
sha1 = '1c45d52b6f6c638db13cf3ac12adeb56b254cdd7',
id = 'org.ow2.asm:asm-analysis:4.1',
sha1 = '73401033069e4714f57b60aeae02f97210aaa64e',
license = 'ow2',
)
maven_jar(
name = 'ow2-asm-tree',
id = 'org.ow2.asm:asm-tree:4.0',
sha1 = '67bd266cd17adcee486b76952ece4cc85fe248b8',
id = 'org.ow2.asm:asm-tree:4.1',
sha1 = '51085abcc4cb6c6e1cb5551e6f999eb8e31c5b2d',
license = 'ow2',
)
maven_jar(
name = 'ow2-asm-util',
id = 'org.ow2.asm:asm-util:4.0',
sha1 = 'd7a65f54cda284f9706a750c23d64830bb740c39',
id = 'org.ow2.asm:asm-util:4.1',
sha1 = '6344065cb0f94e2b930a95e6656e040ebc11df08',
license = 'ow2',
)
@ -198,9 +198,9 @@ maven_jar(
maven_jar(
name = 'protobuf',
# Must match version in gwtorm/pom.xml.
id = 'com.google.protobuf:protobuf-java:2.4.1',
bin_sha1 = '0c589509ec6fd86d5d2fda37e07c08538235d3b9',
src_sha1 = 'e406f69360f2a89cb4aa724ed996a1c5599af383',
id = 'com.google.protobuf:protobuf-java:2.5.0',
bin_sha1 = 'a10732c76bfacdbd633a7eb0f7968b1059a65dfa',
src_sha1 = '7a27a7fc815e481b367ead5df19b4a71ace4a419',
license = 'protobuf',
)

View File

@ -1,11 +1,11 @@
include_defs('//lib/maven.defs')
VERSION = '2.5.1'
VERSION = '2.6.0-rc3'
maven_jar(
name = 'user',
id = 'com.google.gwt:gwt-user:' + VERSION,
sha1 = 'a8afe9b0222db730f4ebd02a1aa329a5395473c5',
sha1 = 'c9458f276a208add7e3982632bfe1b4058b2e551',
license = 'Apache2.0',
attach_source = False,
)
@ -13,13 +13,14 @@ maven_jar(
maven_jar(
name = 'dev',
id = 'com.google.gwt:gwt-dev:' + VERSION,
sha1 = 'ba1f05ddd23b51c0d9c813956ca0ea72cb2e7a92',
sha1 = '01a6e52874ae893949d1046ce2c86d2734a62715',
license = 'Apache2.0',
deps = [
':javax-validation',
':javax-validation_src',
],
attach_source = False,
exclude = ['org/eclipse/jetty/*'],
)
maven_jar(

View File

@ -25,6 +25,28 @@ maven_jar(
visibility = [],
)
maven_jar(
name = 'webapp',
id = 'org.eclipse.jetty:jetty-webapp:' + VERSION,
sha1 = '3d98b3197fbe453a8df27c106f12363587439ee3',
license = 'Apache2.0',
deps = [':xml'],
exclude = EXCLUDE,
visibility = [
'//tools/eclipse:classpath',
'//gerrit-gwtdebug:gwtdebug',
],
)
maven_jar(
name = 'xml',
id = 'org.eclipse.jetty:jetty-xml:' + VERSION,
sha1 = '67e8618447a7740b7a95d74d1b6b4b5c8c1024f5',
license = 'Apache2.0',
exclude = EXCLUDE,
visibility = [],
)
maven_jar(
name = 'server',
id = 'org.eclipse.jetty:jetty-server:' + VERSION,

View File

@ -15,6 +15,7 @@ java_library(
'//gerrit-server:server__compile',
'//lib/asciidoctor:asciidoc_lib',
'//lib/asciidoctor:doc_indexer_lib',
'//lib/jetty:webapp',
'//lib/prolog:compiler_lib',
'//Documentation:index_lib',
] + scan_plugins(),