Bump GWT version to 2.8.0-rc2
There are number of important changes in this GWT release: 1. HtmlUnit, Jetty and their dependencies upgrade: [1],[2],[3] 2. Unbundled most dependencies from GWT Maven artifacts With 1. we can remove patched WebServer fork from GWT project, that was needed to adapt to Jetty 9 version. With 2. we don't need to strip Jetty classes from gwt-dev artifact any more to avoid classpath collisions (we wouldn't get classpath collisions to start with because of 1.). However, because of 2. we need to add quite some dependencies that we got for granted in gwt-dev in early GWT releases on our own: * Apache Ant, Apache 2.0 License * Apache Tapestry, Apache 2.0 License * CERN colt, CERN own or LGPL License * Google JS Interop annotations, Apache 2.0 License * W3C CSS sac library, License W3C IPR SOFTWARE NOTICE According to the release notes: [4]. Double/Boolean are not boxed anymore That leads to the NPE when such method: void showLineEndings(boolean s); is used with null value: p.showLineEndings(in.showLineEndings); where in.showLineEndings is null. Adapt the code to accept Boolean instead. gwtjsonrpc is updated to version 1.10 which is built for GWT 2.8.0-rc2. TEST PLAN: * Verified that daemon works * Verified that SDM works [1] https://github.com/gwtproject/gwt/issues/8712 [2] https://sourceforge.net/p/htmlunit/bugs/1656/ [3] https://gwt-review.googlesource.com/7857 [4] http://www.gwtproject.org/release-notes.html#Release_Notes_2_8_0_RC1 Change-Id: I3f009f3ef0cbb8bafac236fb9a81c951697a5903
This commit is contained in:
parent
fe91cbb399
commit
7817498d77
44
WORKSPACE
44
WORKSPACE
@ -68,18 +68,18 @@ maven_jar(
|
||||
sha1 = '5d9e2e895e3111622720157d0aa540066d5fce3a',
|
||||
)
|
||||
|
||||
GWT_VERS = '2.7.0'
|
||||
GWT_VERS = '2.8.0-rc2'
|
||||
|
||||
maven_jar(
|
||||
name = 'user',
|
||||
artifact = 'com.google.gwt:gwt-user:' + GWT_VERS,
|
||||
sha1 = 'bdc7af42581745d3d79c2efe0b514f432b998a5b',
|
||||
sha1 = 'ad99b09a626c20cce2bdacf3726a51b2cd16b99e',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'dev',
|
||||
artifact = 'com.google.gwt:gwt-dev:' + GWT_VERS,
|
||||
sha1 = 'c2c3dd5baf648a0bb199047a818be5e560f48982',
|
||||
sha1 = 'd70a6feb4661c07488090cb81303415e9110b15a',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
@ -88,6 +88,36 @@ maven_jar(
|
||||
sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'jsinterop_annotations',
|
||||
artifact = 'com.google.jsinterop:jsinterop-annotations:1.0.0',
|
||||
sha1 = '23c3a3c060ffe4817e67673cc8294e154b0a4a95',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'ant',
|
||||
artifact = 'ant:ant:1.6.5',
|
||||
sha1 = '7d18faf23df1a5c3a43613952e0e8a182664564b',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'colt',
|
||||
artifact = 'colt:colt:1.2.0',
|
||||
sha1 = '0abc984f3adc760684d49e0f11ddf167ba516d4f',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'tapestry',
|
||||
artifact = 'tapestry:tapestry:4.0.2',
|
||||
sha1 = 'e855a807425d522e958cbce8697f21e9d679b1f7',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'w3c_css_sac',
|
||||
artifact = 'org.w3c.css:sac:1.3',
|
||||
sha1 = 'cdb2dcb4e22b83d6b32b93095f644c3462739e82',
|
||||
)
|
||||
|
||||
JGIT_VERS = '4.4.1.201607150455-r.118-g1096652'
|
||||
|
||||
maven_jar(
|
||||
@ -135,14 +165,14 @@ maven_jar(
|
||||
|
||||
maven_jar(
|
||||
name = 'gwtjsonrpc',
|
||||
artifact = 'com.google.gerrit:gwtjsonrpc:1.8',
|
||||
sha1 = 'c264bf2f543cffddceada5cdf031eea06dbd44a0',
|
||||
artifact = 'com.google.gerrit:gwtjsonrpc:1.10',
|
||||
sha1 = '25adea6ef102b761993688e80dfc7203e0f5edf0',
|
||||
)
|
||||
|
||||
http_jar(
|
||||
name = 'gwtjsonrpc_src',
|
||||
sha256 = '2ef86396861a7c555c404b5a20a72dc6599b541ce2d1370a62f6470eefe7142d',
|
||||
url = 'http://repo.maven.apache.org/maven2/com/google/gerrit/gwtjsonrpc/1.8/gwtjsonrpc-1.8-sources.jar',
|
||||
sha256 = '009c4c7574eaddf49d2c72dd015cfbd5b495fbeea4c3958c2ec548af2c186733',
|
||||
url = 'http://repo.maven.apache.org/maven2/com/google/gerrit/gwtjsonrpc/1.10/gwtjsonrpc-1.10-sources.jar',
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
|
@ -1,541 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* 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.gwt.dev.codeserver;
|
||||
|
||||
import com.google.gwt.core.ext.TreeLogger;
|
||||
import com.google.gwt.core.ext.TreeLogger.Type;
|
||||
import com.google.gwt.core.ext.UnableToCompleteException;
|
||||
import com.google.gwt.dev.codeserver.CompileDir.PolicyFile;
|
||||
import com.google.gwt.dev.codeserver.Pages.ErrorPage;
|
||||
import com.google.gwt.dev.json.JsonObject;
|
||||
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.servlets.GzipFilter;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* The web server for Super Dev Mode, also known as the code server. The URLs handled include:
|
||||
* <ul>
|
||||
* <li>HTML pages for the front page and module pages</li>
|
||||
* <li>JavaScript that implementing the bookmarklets</li>
|
||||
* <li>The web API for recompiling a GWT app</li>
|
||||
* <li>The output files and log files from the GWT compiler</li>
|
||||
* <li>Java source code (for source-level debugging)</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>EXPERIMENTAL. There is no authentication, encryption, or XSS protection, so this server is
|
||||
* only safe to run on localhost.</p>
|
||||
*/
|
||||
// This file was copied from GWT project and adjusted to run against
|
||||
// Jetty 9.2.2. The original diff can be found here:
|
||||
// https://gwt-review.googlesource.com/#/c/7857/13/dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java
|
||||
public class WebServer {
|
||||
|
||||
private static final Pattern SAFE_DIRECTORY =
|
||||
Pattern.compile("([a-zA-Z0-9_-]+\\.)*[a-zA-Z0-9_-]+"); // no extension needed
|
||||
|
||||
private static final Pattern SAFE_FILENAME =
|
||||
Pattern.compile("([a-zA-Z0-9_-]+\\.)+[a-zA-Z0-9_-]+"); // an extension is required
|
||||
|
||||
private static final Pattern SAFE_MODULE_PATH =
|
||||
Pattern.compile("/(" + SAFE_DIRECTORY + ")/$");
|
||||
|
||||
static final Pattern SAFE_DIRECTORY_PATH =
|
||||
Pattern.compile("/(" + SAFE_DIRECTORY + "/)+$");
|
||||
|
||||
/* visible for testing */
|
||||
static final Pattern SAFE_FILE_PATH =
|
||||
Pattern.compile("/(" + SAFE_DIRECTORY + "/)+" + SAFE_FILENAME + "$");
|
||||
|
||||
static final Pattern STRONG_NAME = Pattern.compile("[\\dA-F]{32}");
|
||||
|
||||
private static final Pattern CACHE_JS_FILE = Pattern.compile("/(" + STRONG_NAME + ").cache.js$");
|
||||
|
||||
private static final MimeTypes MIME_TYPES = new MimeTypes();
|
||||
|
||||
private static final String TIME_IN_THE_PAST = "Mon, 01 Jan 1990 00:00:00 GMT";
|
||||
|
||||
private final SourceHandler handler;
|
||||
private final JsonExporter jsonExporter;
|
||||
private final OutboxTable outboxes;
|
||||
private final JobRunner runner;
|
||||
private final JobEventTable eventTable;
|
||||
|
||||
private final String bindAddress;
|
||||
private final int port;
|
||||
|
||||
private Server server;
|
||||
|
||||
WebServer(SourceHandler handler, JsonExporter jsonExporter, OutboxTable outboxes,
|
||||
JobRunner runner, JobEventTable eventTable, String bindAddress, int port) {
|
||||
this.handler = handler;
|
||||
this.jsonExporter = jsonExporter;
|
||||
this.outboxes = outboxes;
|
||||
this.runner = runner;
|
||||
this.eventTable = eventTable;
|
||||
this.bindAddress = bindAddress;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
void start(final TreeLogger logger) throws UnableToCompleteException {
|
||||
|
||||
Server newServer = new Server();
|
||||
ServerConnector connector = new ServerConnector(newServer);
|
||||
connector.setHost(bindAddress);
|
||||
connector.setPort(port);
|
||||
connector.setReuseAddress(false);
|
||||
connector.setSoLingerTime(0);
|
||||
|
||||
newServer.addConnector(connector);
|
||||
|
||||
ServletContextHandler newHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
||||
newHandler.setContextPath("/");
|
||||
newHandler.addServlet(new ServletHolder(new HttpServlet() {
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
handleRequest(request.getPathInfo(), request, response, logger);
|
||||
}
|
||||
}), "/*");
|
||||
newHandler.addFilter(GzipFilter.class, "/*", EnumSet.allOf(DispatcherType.class));
|
||||
newServer.setHandler(newHandler);
|
||||
try {
|
||||
newServer.start();
|
||||
} catch (Exception e) {
|
||||
logger.log(TreeLogger.ERROR, "cannot start web server", e);
|
||||
throw new UnableToCompleteException();
|
||||
}
|
||||
this.server = newServer;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
server.stop();
|
||||
server = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of the compiler output. (Changes after every recompile.)
|
||||
* @param outputModuleName the module name that the GWT compiler used in its output.
|
||||
*/
|
||||
public File getCurrentWarDir(String outputModuleName) {
|
||||
return outboxes.findByOutputModuleName(outputModuleName).getWarDir();
|
||||
}
|
||||
|
||||
private void handleRequest(String target, HttpServletRequest request,
|
||||
HttpServletResponse response, TreeLogger parentLogger)
|
||||
throws IOException {
|
||||
|
||||
if (request.getMethod().equalsIgnoreCase("get")) {
|
||||
|
||||
TreeLogger logger = parentLogger.branch(Type.TRACE, "GET " + target);
|
||||
|
||||
Response page = doGet(target, request, logger);
|
||||
if (page == null) {
|
||||
logger.log(Type.WARN, "not handled: " + target);
|
||||
return;
|
||||
}
|
||||
|
||||
setHandled(request);
|
||||
if (!target.endsWith(".cache.js")) {
|
||||
// Make sure IE9 doesn't cache any pages.
|
||||
// (Nearly all pages may change on server restart.)
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Expires", TIME_IN_THE_PAST);
|
||||
response.setDateHeader("Date", new Date().getTime());
|
||||
}
|
||||
page.send(request, response, logger);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the page that should be sent in response to a GET request, or null for no response.
|
||||
*/
|
||||
private Response doGet(String target, HttpServletRequest request, TreeLogger logger)
|
||||
throws IOException {
|
||||
|
||||
if (target.equals("/")) {
|
||||
JsonObject json = jsonExporter.exportFrontPageVars();
|
||||
return Pages.newHtmlPage("config", json, "frontpage.html");
|
||||
}
|
||||
|
||||
if (target.equals("/dev_mode_on.js")) {
|
||||
JsonObject json = jsonExporter.exportDevModeOnVars();
|
||||
return Responses.newJavascriptResponse("__gwt_codeserver_config", json,
|
||||
"dev_mode_on.js");
|
||||
}
|
||||
|
||||
// Recompile on request from the bookmarklet.
|
||||
// This is a GET because a bookmarklet can call it from a different origin (JSONP).
|
||||
if (target.startsWith("/recompile/")) {
|
||||
String moduleName = target.substring("/recompile/".length());
|
||||
Outbox box = outboxes.findByOutputModuleName(moduleName);
|
||||
if (box == null) {
|
||||
return new ErrorPage("No such module: " + moduleName);
|
||||
}
|
||||
|
||||
// We are passing properties from an unauthenticated GET request directly to the compiler.
|
||||
// This should be safe, but only because these are binding properties. For each binding
|
||||
// property, you can only choose from a set of predefined values. So all an attacker can do is
|
||||
// cause a spurious recompile, resulting in an unexpected permutation being loaded later.
|
||||
//
|
||||
// It would be unsafe to allow a configuration property to be changed.
|
||||
Job job = box.makeJob(getBindingProperties(request), logger);
|
||||
runner.submit(job);
|
||||
Job.Result result = job.waitForResult();
|
||||
JsonObject json = jsonExporter.exportRecompileResponse(result);
|
||||
return Responses.newJsonResponse(json);
|
||||
}
|
||||
|
||||
if (target.startsWith("/log/")) {
|
||||
String moduleName = target.substring("/log/".length());
|
||||
Outbox box = outboxes.findByOutputModuleName(moduleName);
|
||||
if (box == null) {
|
||||
return new ErrorPage("No such module: " + moduleName);
|
||||
} else if (box.containsStubCompile()) {
|
||||
return new ErrorPage("This module hasn't been compiled yet.");
|
||||
} else {
|
||||
return makeLogPage(box);
|
||||
}
|
||||
}
|
||||
|
||||
if (target.equals("/favicon.ico")) {
|
||||
InputStream faviconStream = getClass().getResourceAsStream("favicon.ico");
|
||||
if (faviconStream == null) {
|
||||
return new ErrorPage("icon not found");
|
||||
}
|
||||
// IE8 will not load the favicon in an img tag with the default MIME type,
|
||||
// so use "image/x-icon" instead.
|
||||
return Responses.newBinaryStreamResponse("image/x-icon", faviconStream);
|
||||
}
|
||||
|
||||
if (target.equals("/policies/")) {
|
||||
return makePolicyIndexPage();
|
||||
}
|
||||
|
||||
if (target.equals("/progress")) {
|
||||
// TODO: return a list of progress objects here, one for each job.
|
||||
JobEvent event = eventTable.getCompilingJobEvent();
|
||||
|
||||
JsonObject json;
|
||||
if (event == null) {
|
||||
json = new JsonObject();
|
||||
json.put("status", "idle");
|
||||
} else {
|
||||
json = jsonExporter.exportProgressResponse(event);
|
||||
}
|
||||
return Responses.newJsonResponse(json);
|
||||
}
|
||||
|
||||
Matcher matcher = SAFE_MODULE_PATH.matcher(target);
|
||||
if (matcher.matches()) {
|
||||
return makeModulePage(matcher.group(1));
|
||||
}
|
||||
|
||||
matcher = SAFE_DIRECTORY_PATH.matcher(target);
|
||||
if (matcher.matches() && SourceHandler.isSourceMapRequest(target)) {
|
||||
return handler.handle(target, request, logger);
|
||||
}
|
||||
|
||||
matcher = SAFE_FILE_PATH.matcher(target);
|
||||
if (matcher.matches()) {
|
||||
if (SourceHandler.isSourceMapRequest(target)) {
|
||||
return handler.handle(target, request, logger);
|
||||
}
|
||||
if (target.startsWith("/policies/")) {
|
||||
return makePolicyFilePage(target);
|
||||
}
|
||||
return makeCompilerOutputPage(target);
|
||||
}
|
||||
|
||||
logger.log(TreeLogger.WARN, "ignored get request: " + target);
|
||||
return null; // not handled
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file that the compiler wrote to its war directory.
|
||||
*/
|
||||
private Response makeCompilerOutputPage(String target) {
|
||||
|
||||
int secondSlash = target.indexOf('/', 1);
|
||||
String moduleName = target.substring(1, secondSlash);
|
||||
Outbox box = outboxes.findByOutputModuleName(moduleName);
|
||||
if (box == null) {
|
||||
return new ErrorPage("No such module: " + moduleName);
|
||||
}
|
||||
|
||||
final String contentEncoding;
|
||||
File file = box.getOutputFile(target);
|
||||
if (!file.isFile()) {
|
||||
// perhaps it's compressed
|
||||
file = box.getOutputFile(target + ".gz");
|
||||
if (!file.isFile()) {
|
||||
return new ErrorPage("not found: " + file.toString());
|
||||
}
|
||||
contentEncoding = "gzip";
|
||||
} else {
|
||||
contentEncoding = null;
|
||||
}
|
||||
|
||||
final String sourceMapUrl;
|
||||
Matcher match = CACHE_JS_FILE.matcher(target);
|
||||
if (match.matches()) {
|
||||
String strongName = match.group(1);
|
||||
String template = SourceHandler.sourceMapLocationTemplate(moduleName);
|
||||
sourceMapUrl = template.replace("__HASH__", strongName);
|
||||
} else {
|
||||
sourceMapUrl = null;
|
||||
}
|
||||
|
||||
String mimeType = guessMimeType(target);
|
||||
final Response barePage = Responses.newFileResponse(mimeType, file);
|
||||
|
||||
// Wrap the response to send the extra headers.
|
||||
return new Response() {
|
||||
@Override
|
||||
public void send(HttpServletRequest request, HttpServletResponse response, TreeLogger logger)
|
||||
throws IOException {
|
||||
// TODO: why do we need this? Looks like Ray added it a long time ago.
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (sourceMapUrl != null) {
|
||||
response.setHeader("X-SourceMap", sourceMapUrl);
|
||||
response.setHeader("SourceMap", sourceMapUrl);
|
||||
}
|
||||
|
||||
if (contentEncoding != null) {
|
||||
if (!request.getHeader("Accept-Encoding").contains("gzip")) {
|
||||
response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
|
||||
logger.log(TreeLogger.WARN, "client doesn't accept gzip; bailing");
|
||||
return;
|
||||
}
|
||||
response.setHeader("Content-Encoding", "gzip");
|
||||
}
|
||||
|
||||
barePage.send(request, response, logger);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Response makeModulePage(String moduleName) {
|
||||
Outbox box = outboxes.findByOutputModuleName(moduleName);
|
||||
if (box == null) {
|
||||
return new ErrorPage("No such module: " + moduleName);
|
||||
}
|
||||
|
||||
JsonObject json = jsonExporter.exportModulePageVars(box);
|
||||
return Pages.newHtmlPage("config", json, "modulepage.html");
|
||||
}
|
||||
|
||||
private Response makePolicyIndexPage() {
|
||||
|
||||
return new Response() {
|
||||
|
||||
@Override
|
||||
public void send(HttpServletRequest request, HttpServletResponse response, TreeLogger logger)
|
||||
throws IOException {
|
||||
response.setContentType("text/html");
|
||||
|
||||
HtmlWriter out = new HtmlWriter(response.getWriter());
|
||||
|
||||
out.startTag("html").nl();
|
||||
out.startTag("head").nl();
|
||||
out.startTag("title").text("Policy Files").endTag("title").nl();
|
||||
out.endTag("head");
|
||||
out.startTag("body");
|
||||
|
||||
out.startTag("h1").text("Policy Files").endTag("h1").nl();
|
||||
|
||||
for (Outbox box : outboxes.getOutboxes()) {
|
||||
List<PolicyFile> policies = box.readRpcPolicyManifest();
|
||||
if (!policies.isEmpty()) {
|
||||
out.startTag("h2").text(box.getOutputModuleName()).endTag("h2").nl();
|
||||
|
||||
out.startTag("table").nl();
|
||||
for (PolicyFile policy : policies) {
|
||||
|
||||
out.startTag("tr");
|
||||
|
||||
out.startTag("td");
|
||||
|
||||
out.startTag("a", "href=", policy.getServiceSourceUrl());
|
||||
out.text(policy.getServiceName());
|
||||
out.endTag("a");
|
||||
|
||||
out.endTag("td");
|
||||
|
||||
out.startTag("td");
|
||||
|
||||
out.startTag("a", "href=", policy.getUrl());
|
||||
out.text(policy.getName());
|
||||
out.endTag("a");
|
||||
|
||||
out.endTag("td");
|
||||
|
||||
out.endTag("tr").nl();
|
||||
}
|
||||
out.endTag("table").nl();
|
||||
}
|
||||
}
|
||||
|
||||
out.endTag("body").nl();
|
||||
out.endTag("html").nl();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Response makePolicyFilePage(String target) {
|
||||
|
||||
int secondSlash = target.indexOf('/', 1);
|
||||
if (secondSlash < 1) {
|
||||
return new ErrorPage("invalid URL for policy file: " + target);
|
||||
}
|
||||
|
||||
String rest = target.substring(secondSlash + 1);
|
||||
if (rest.contains("/") || !rest.endsWith(".gwt.rpc")) {
|
||||
return new ErrorPage("invalid name for policy file: " + rest);
|
||||
}
|
||||
|
||||
File fileToSend = outboxes.findPolicyFile(rest);
|
||||
if (fileToSend == null) {
|
||||
return new ErrorPage("Policy file not found: " + rest);
|
||||
}
|
||||
|
||||
return Responses.newFileResponse("text/plain", fileToSend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the log file as html with errors highlighted in red.
|
||||
*/
|
||||
private Response makeLogPage(final Outbox box) {
|
||||
final File file = box.getCompileLog();
|
||||
if (!file.isFile()) {
|
||||
return new ErrorPage("log file not found");
|
||||
}
|
||||
|
||||
return new Response() {
|
||||
|
||||
@Override
|
||||
public void send(HttpServletRequest request, HttpServletResponse response, TreeLogger logger)
|
||||
throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.setContentType("text/html");
|
||||
response.setHeader("Content-Style-Type", "text/css");
|
||||
|
||||
HtmlWriter out = new HtmlWriter(response.getWriter());
|
||||
out.startTag("html").nl();
|
||||
out.startTag("head").nl();
|
||||
out.startTag("title").text(box.getOutputModuleName() + " compile log").endTag("title").nl();
|
||||
out.startTag("style").nl();
|
||||
out.text(".error { color: red; font-weight: bold; }").nl();
|
||||
out.endTag("style").nl();
|
||||
out.endTag("head").nl();
|
||||
out.startTag("body").nl();
|
||||
sendLogAsHtml(reader, out);
|
||||
out.endTag("body").nl();
|
||||
out.endTag("html").nl();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static final Pattern ERROR_PATTERN = Pattern.compile("\\[ERROR\\]");
|
||||
|
||||
/**
|
||||
* Copies in to out line by line, escaping each line for html characters and highlighting
|
||||
* error lines. Closes <code>in</code> when done.
|
||||
*/
|
||||
private static void sendLogAsHtml(BufferedReader in, HtmlWriter out) throws IOException {
|
||||
try {
|
||||
out.startTag("pre").nl();
|
||||
String line = in.readLine();
|
||||
while (line != null) {
|
||||
Matcher m = ERROR_PATTERN.matcher(line);
|
||||
boolean error = m.find();
|
||||
if (error) {
|
||||
out.startTag("span", "class=", "error");
|
||||
}
|
||||
out.text(line);
|
||||
if (error) {
|
||||
out.endTag("span");
|
||||
}
|
||||
out.nl(); // the readLine doesn't include the newline.
|
||||
line = in.readLine();
|
||||
}
|
||||
out.endTag("pre").nl();
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
/* visible for testing */
|
||||
static String guessMimeType(String filename) {
|
||||
String mimeType = MIME_TYPES.getMimeByExtension(filename);
|
||||
return mimeType != null ? mimeType : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the binding properties from the web page where dev mode is being used. (As passed in
|
||||
* by dev_mode_on.js in a JSONP request to "/recompile".)
|
||||
*/
|
||||
private Map<String, String> getBindingProperties(HttpServletRequest request) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Object key : request.getParameterMap().keySet()) {
|
||||
String propName = (String) key;
|
||||
if (!propName.equals("_callback")) {
|
||||
result.put(propName, request.getParameter(propName));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void setHandled(HttpServletRequest request) {
|
||||
Request baseRequest = (request instanceof Request) ? (Request) request :
|
||||
HttpConnection.getCurrentConnection().getHttpChannel().getRequest();
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
}
|
@ -129,24 +129,24 @@ public class DiffPreferences extends JavaScriptObject {
|
||||
public final native void lineLength(int c) /*-{ this.line_length = c }-*/;
|
||||
public final native void context(int c) /*-{ this.context = c }-*/;
|
||||
public final native void cursorBlinkRate(int r) /*-{ this.cursor_blink_rate = r }-*/;
|
||||
public final native void intralineDifference(boolean i) /*-{ this.intraline_difference = i }-*/;
|
||||
public final native void showLineEndings(boolean s) /*-{ this.show_line_endings = s }-*/;
|
||||
public final native void showTabs(boolean s) /*-{ this.show_tabs = s }-*/;
|
||||
public final native void showWhitespaceErrors(boolean s) /*-{ this.show_whitespace_errors = s }-*/;
|
||||
public final native void syntaxHighlighting(boolean s) /*-{ this.syntax_highlighting = s }-*/;
|
||||
public final native void hideTopMenu(boolean s) /*-{ this.hide_top_menu = s }-*/;
|
||||
public final native void autoHideDiffTableHeader(boolean s) /*-{ this.auto_hide_diff_table_header = s }-*/;
|
||||
public final native void hideLineNumbers(boolean s) /*-{ this.hide_line_numbers = s }-*/;
|
||||
public final native void expandAllComments(boolean e) /*-{ this.expand_all_comments = e }-*/;
|
||||
public final native void manualReview(boolean r) /*-{ this.manual_review = r }-*/;
|
||||
public final native void renderEntireFile(boolean r) /*-{ this.render_entire_file = r }-*/;
|
||||
public final native void retainHeader(boolean r) /*-{ this.retain_header = r }-*/;
|
||||
public final native void hideEmptyPane(boolean s) /*-{ this.hide_empty_pane = s }-*/;
|
||||
public final native void skipUnchanged(boolean s) /*-{ this.skip_unchanged = s }-*/;
|
||||
public final native void skipUncommented(boolean s) /*-{ this.skip_uncommented = s }-*/;
|
||||
public final native void skipDeleted(boolean s) /*-{ this.skip_deleted = s }-*/;
|
||||
public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/;
|
||||
public final native void lineWrapping(boolean w) /*-{ this.line_wrapping = w }-*/;
|
||||
public final native void intralineDifference(Boolean i) /*-{ this.intraline_difference = i }-*/;
|
||||
public final native void showLineEndings(Boolean s) /*-{ this.show_line_endings = s }-*/;
|
||||
public final native void showTabs(Boolean s) /*-{ this.show_tabs = s }-*/;
|
||||
public final native void showWhitespaceErrors(Boolean s) /*-{ this.show_whitespace_errors = s }-*/;
|
||||
public final native void syntaxHighlighting(Boolean s) /*-{ this.syntax_highlighting = s }-*/;
|
||||
public final native void hideTopMenu(Boolean s) /*-{ this.hide_top_menu = s }-*/;
|
||||
public final native void autoHideDiffTableHeader(Boolean s) /*-{ this.auto_hide_diff_table_header = s }-*/;
|
||||
public final native void hideLineNumbers(Boolean s) /*-{ this.hide_line_numbers = s }-*/;
|
||||
public final native void expandAllComments(Boolean e) /*-{ this.expand_all_comments = e }-*/;
|
||||
public final native void manualReview(Boolean r) /*-{ this.manual_review = r }-*/;
|
||||
public final native void renderEntireFile(Boolean r) /*-{ this.render_entire_file = r }-*/;
|
||||
public final native void retainHeader(Boolean r) /*-{ this.retain_header = r }-*/;
|
||||
public final native void hideEmptyPane(Boolean s) /*-{ this.hide_empty_pane = s }-*/;
|
||||
public final native void skipUnchanged(Boolean s) /*-{ this.skip_unchanged = s }-*/;
|
||||
public final native void skipUncommented(Boolean s) /*-{ this.skip_uncommented = s }-*/;
|
||||
public final native void skipDeleted(Boolean s) /*-{ this.skip_deleted = s }-*/;
|
||||
public final native void matchBrackets(Boolean m) /*-{ this.match_brackets = m }-*/;
|
||||
public final native void lineWrapping(Boolean w) /*-{ this.line_wrapping = w }-*/;
|
||||
public final native boolean intralineDifference() /*-{ return this.intraline_difference || false }-*/;
|
||||
public final native boolean showLineEndings() /*-{ return this.show_line_endings || false }-*/;
|
||||
public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/;
|
||||
|
@ -639,7 +639,7 @@ abstract class DiffScreen extends Screen {
|
||||
}
|
||||
|
||||
private void toggleShowIntraline() {
|
||||
prefs.intralineDifference(!prefs.intralineDifference());
|
||||
prefs.intralineDifference(!Boolean.valueOf(prefs.intralineDifference()));
|
||||
setShowIntraline(prefs.intralineDifference());
|
||||
prefsAction.update();
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class PreferencesBox extends Composite {
|
||||
|
||||
@UiHandler("intralineDifference")
|
||||
void onIntralineDifference(ValueChangeEvent<Boolean> e) {
|
||||
prefs.intralineDifference(e.getValue());
|
||||
prefs.intralineDifference(Boolean.valueOf(e.getValue()));
|
||||
if (view != null) {
|
||||
view.setShowIntraline(prefs.intralineDifference());
|
||||
}
|
||||
|
@ -13,20 +13,5 @@ maven_jar(
|
||||
name = 'dev',
|
||||
id = 'com.google.gwt:gwt-dev:' + VERSION,
|
||||
license = 'Apache2.0',
|
||||
deps = [
|
||||
':javax-validation',
|
||||
':javax-validation_src',
|
||||
],
|
||||
attach_source = False,
|
||||
exclude = ['org/eclipse/jetty/*'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'javax-validation',
|
||||
id = 'javax.validation:validation-api:1.0.0.GA',
|
||||
bin_sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e',
|
||||
src_sha1 = '7a561191db2203550fbfa40d534d4997624cd369',
|
||||
license = 'Apache2.0',
|
||||
visibility = [],
|
||||
)
|
||||
|
||||
|
6
lib/BUCK
6
lib/BUCK
@ -54,9 +54,9 @@ java_library(
|
||||
|
||||
maven_jar(
|
||||
name = 'gwtjsonrpc',
|
||||
id = 'com.google.gerrit:gwtjsonrpc:1.9',
|
||||
bin_sha1 = '458f55e92584fbd9ab91a89fa1c37654922a0f2b',
|
||||
src_sha1 = 'ba539361c80a26f0d30a2f56068f6d83f44062d8',
|
||||
id = 'com.google.gerrit:gwtjsonrpc:1.10',
|
||||
bin_sha1 = '25adea6ef102b761993688e80dfc7203e0f5edf0',
|
||||
src_sha1 = '4401b5868976460f8fac504cf730425ed95481ff',
|
||||
license = 'Apache2.0',
|
||||
)
|
||||
|
||||
|
51
lib/gwt/BUCK
51
lib/gwt/BUCK
@ -1,11 +1,11 @@
|
||||
include_defs('//lib/maven.defs')
|
||||
|
||||
VERSION = '2.7.0'
|
||||
VERSION = '2.8.0-rc2'
|
||||
|
||||
maven_jar(
|
||||
name = 'user',
|
||||
id = 'com.google.gwt:gwt-user:' + VERSION,
|
||||
sha1 = 'bdc7af42581745d3d79c2efe0b514f432b998a5b',
|
||||
sha1 = 'ad99b09a626c20cce2bdacf3726a51b2cd16b99e',
|
||||
license = 'Apache2.0',
|
||||
attach_source = False,
|
||||
)
|
||||
@ -13,10 +13,9 @@ maven_jar(
|
||||
maven_jar(
|
||||
name = 'dev',
|
||||
id = 'com.google.gwt:gwt-dev:' + VERSION,
|
||||
sha1 = 'c2c3dd5baf648a0bb199047a818be5e560f48982',
|
||||
sha1 = 'd70a6feb4661c07488090cb81303415e9110b15a',
|
||||
license = 'Apache2.0',
|
||||
attach_source = False,
|
||||
exclude = ['org/eclipse/jetty/*'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
@ -28,3 +27,47 @@ maven_jar(
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'jsinterop-annotations',
|
||||
id = 'com.google.jsinterop:jsinterop-annotations:1.0.0',
|
||||
bin_sha1 = '23c3a3c060ffe4817e67673cc8294e154b0a4a95',
|
||||
src_sha1 = '5d7c478efbfccc191430d7c118d7bd2635e43750',
|
||||
license = 'Apache2.0',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'ant',
|
||||
id = 'ant:ant:1.6.5',
|
||||
bin_sha1 = '7d18faf23df1a5c3a43613952e0e8a182664564b',
|
||||
src_sha1 = '9e0a847494563f35f9b02846a1c1eb4aa2ee5a9a',
|
||||
license = 'Apache2.0',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'colt',
|
||||
id = 'colt:colt:1.2.0',
|
||||
attach_source = False,
|
||||
bin_sha1 = '0abc984f3adc760684d49e0f11ddf167ba516d4f',
|
||||
license = 'DO_NOT_DISTRIBUTE',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'tapestry',
|
||||
id = 'tapestry:tapestry:4.0.2',
|
||||
attach_source = False,
|
||||
bin_sha1 = 'e855a807425d522e958cbce8697f21e9d679b1f7',
|
||||
license = 'Apache2.0',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
name = 'w3c-css-sac',
|
||||
id = 'org.w3c.css:sac:1.3',
|
||||
attach_source = False,
|
||||
bin_sha1 = 'cdb2dcb4e22b83d6b32b93095f644c3462739e82',
|
||||
license = 'DO_NOT_DISTRIBUTE',
|
||||
visibility = ['PUBLIC'],
|
||||
)
|
||||
|
@ -21,8 +21,14 @@ java_library(
|
||||
'//lib/bouncycastle:bcprov',
|
||||
'//lib/bouncycastle:bcpg',
|
||||
'//lib/bouncycastle:bcpkix',
|
||||
'//lib/gwt:ant',
|
||||
'//lib/gwt:colt',
|
||||
'//lib/gwt:javax-validation',
|
||||
'//lib/gwt:javax-validation_src',
|
||||
'//lib/gwt:jsinterop-annotations',
|
||||
'//lib/gwt:jsinterop-annotations_src',
|
||||
'//lib/gwt:tapestry',
|
||||
'//lib/gwt:w3c-css-sac',
|
||||
'//lib/jetty:servlets',
|
||||
'//lib/prolog:compiler_lib',
|
||||
'//polygerrit-ui:polygerrit_components',
|
||||
|
@ -14,8 +14,14 @@ GWT_PLUGIN_DEPS = [
|
||||
]
|
||||
|
||||
GWT_TRANSITIVE_DEPS = [
|
||||
'//lib/gwt:ant',
|
||||
'//lib/gwt:colt',
|
||||
'//lib/gwt:javax-validation',
|
||||
'//lib/gwt:javax-validation_src',
|
||||
'//lib/gwt:jsinterop-annotations',
|
||||
'//lib/gwt:jsinterop-annotations_src',
|
||||
'//lib/gwt:tapestry',
|
||||
'//lib/gwt:w3c-css-sac',
|
||||
'//lib/ow2:ow2-asm',
|
||||
'//lib/ow2:ow2-asm-analysis',
|
||||
'//lib/ow2:ow2-asm-commons',
|
||||
|
Loading…
x
Reference in New Issue
Block a user