Skip to content

Commit

Permalink
Update to GWT 2.11, clean up old gradle wiring (#5576)
Browse files Browse the repository at this point in the history
Precursor to changes for #188 - updating to GWT 2.11 will make it
smoother to follow up with additional updates. The GWT 2.10 release
changed the groupId from com.google.gwt to org.gwtproject, but our
Gradle plugin does not support the new groupId, so this patch also
rewrites automatic dependencies added by the plugin to use the new
version.
  • Loading branch information
niloc132 authored Jun 8, 2024
1 parent 070dc29 commit 6512b0e
Show file tree
Hide file tree
Showing 37 changed files with 78 additions and 115 deletions.
19 changes: 9 additions & 10 deletions buildSrc/src/main/groovy/Classpaths.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import org.gradle.internal.Actions
class Classpaths {

static final String ELEMENTAL_GROUP = 'com.google.elemental2'
static final String ELEMENTAL_VERSION = '1.1.0'
static final String ELEMENTAL_VERSION = '1.2.1'

static final String GWT_GROUP = 'com.google.gwt'
static final String GWT_VERSION = '2.9.0'
static final String GWT_GROUP = 'org.gwtproject'
static final String GWT_VERSION = '2.11.0'

static final String JAVA_PARSER_GROUP = 'com.github.javaparser'
static final String JAVA_PARSER_NAME = 'javaparser-core'
Expand All @@ -36,11 +36,10 @@ class Classpaths {
static final String JAVAX_ANNOTATIONS_NAME = 'validation-api'
static final String JAVAX_ANNOTATIONS_VERSION = '1.0.0.GA'

static final String JETTY_GROUP = 'org.eclipse.jetty'
static final String JETTY_VERSION = '9.4.20.v20190813'
static final String JETTY_VERSION = '9.4.44.v20210927'

static final String JS_INTEROP_GROUP = 'com.google.jsinterop'
static final String JS_INTEROP_VERSION = '2.0.0'
static final String JS_INTEROP_VERSION = '2.0.2'

static final String COMMONS_GROUP = 'org.apache.commons'

Expand Down Expand Up @@ -158,9 +157,9 @@ class Classpaths {
if (addDependency(config, GWT_GROUP, name, GWT_VERSION)) {
// when we add gwt-dev, lets also force asm version, just to be safe.
name == 'gwt-dev' && config.resolutionStrategy {
force 'org.ow2.asm:asm:5.0.3'
force 'org.ow2.asm:asm-util:5.0.3'
force 'org.ow2.asm:asm-commons:5.0.3'
force 'org.ow2.asm:asm:9.2'
force 'org.ow2.asm:asm-util:9.2'
force 'org.ow2.asm:asm-commons:9.2'
}
}
}
Expand All @@ -180,7 +179,7 @@ class Classpaths {
addDependency config, JS_INTEROP_GROUP, name,
// google is annoying, and have different versions released for the same groupId
// :base: is the only one that is different, so we'll use it in the ternary.
name == 'base'? '1.0.0' : JS_INTEROP_VERSION
name == 'base'? '1.0.1' : JS_INTEROP_VERSION
}

static void inheritElemental(Project p, String name, String configName) {
Expand Down
14 changes: 11 additions & 3 deletions buildSrc/src/main/groovy/GwtTools.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import de.esoco.gwt.gradle.task.GwtCheckTask
import de.esoco.gwt.gradle.task.GwtCompileTask
import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.compile.JavaCompile

import java.nio.file.Files

/**
* Helper to simplify / centralize configuring gwt plugins in build files
*/
Expand Down Expand Up @@ -83,8 +82,17 @@ class GwtTools {
static void applyDefaults(Project p, GwtExtension gwt, boolean compile = false) {
gwt.gwtVersion = Classpaths.GWT_VERSION
gwt.jettyVersion = Classpaths.JETTY_VERSION
p.configurations.all { Configuration c ->
c.resolutionStrategy.dependencySubstitution { sub ->
sub.substitute(sub.module("com.google.gwt:gwt-codeserver"))
.using(sub.module("org.gwtproject:gwt-codeserver:${Classpaths.GWT_VERSION}"))
sub.substitute(sub.module("com.google.gwt:gwt-user"))
.using(sub.module("org.gwtproject:gwt-user:${Classpaths.GWT_VERSION}"))
sub.substitute(sub.module("com.google.gwt:gwt-dev"))
.using(sub.module("org.gwtproject:gwt-dev:${Classpaths.GWT_VERSION}"))
}
}
if (compile) {

String warPath = new File(p.buildDir, 'gwt').absolutePath

gwt.compile.with {
Expand Down
8 changes: 0 additions & 8 deletions gradle/web-client.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions gradle/web-common.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions open-api/lang-parser/lang-parser.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ plugins {
id 'io.deephaven.project.register'
}

apply from: "$rootDir/gradle/web-common.gradle"

dependencies {
implementation project(':Util')
api project(':open-api-shared-fu')
Expand Down
2 changes: 0 additions & 2 deletions open-api/lang-tools/lang-tools.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ plugins {
id 'java-library'
}

apply from: "$rootDir/gradle/web-common.gradle"

Classpaths.inheritCommonsText(project, 'implementation')
dependencies {

Expand Down
2 changes: 0 additions & 2 deletions open-api/shared-fu/shared-fu.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ plugins {
id 'io.deephaven.project.register'
}

apply from: "$rootDir/gradle/web-common.gradle"

// Contains all general purpose utilities used across all open-api modules.
3 changes: 1 addition & 2 deletions web/client-api/client-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ plugins {

evaluationDependsOn(Docker.registryProject('selenium'))

apply from: "$rootDir/gradle/web-client.gradle"

configurations {
js
dts
Expand All @@ -35,6 +33,7 @@ dependencies {
Classpaths.inheritElemental(project, 'elemental2-core', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-promise', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-dom', 'implementation')
Classpaths.inheritGwt(project, 'gwt-user', 'testImplementation')

GwtTools.gwtCompile project, 'io.deephaven.web.DeephavenApi', 'Create a jar of client JS API'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public String getServerUrl() {
public Promise<String[][]> getAuthConfigValues() {
return ideConnection.getConnectOptions().then(options -> {
BrowserHeaders metadata = new BrowserHeaders();
JsObject.keys(options.headers).forEach((key, index, arr) -> {
JsObject.keys(options.headers).forEach((key, index) -> {
metadata.set(key, options.headers.get(key));
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public <T> void fireEvent(String type, CustomEvent<T> e) {
}
if (map.has(e.type)) {
final JsArray<EventFn<T>> callbacks = Js.cast(JsArray.from((JsArrayLike<EventFn<?>>) map.get(e.type)));
callbacks.forEach((item, ind, all) -> {
callbacks.forEach((item, ind) -> {
try {
item.onEvent(e);
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private void handleKeys(Event update) {
RangeSet added = eventData.getAdded().getRange();
added.indexIterator().forEachRemaining((long index) -> {
// extract the key to use
JsArray<Object> key = eventData.getColumns().map((c, p1, p2) -> eventData.getData(index, c));
JsArray<Object> key = eventData.getColumns().map((c, p1) -> eventData.getData(index, c));
knownKeys.add(key.asList());
CustomEventInit<JsArray<Object>> init = CustomEventInit.create();
init.setDetail(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ default CustomColumn asCustomColumn() {
@JsMethod
@SuppressWarnings("unusable-by-js")
public JsArray<CustomColumn> applyCustomColumns(JsArray<CustomColumnArgUnionType> customColumns) {
String[] customColumnStrings = customColumns.map((item, index, array) -> {
String[] customColumnStrings = customColumns.map((item, index) -> {
if (item.isString() || item.isCustomColumn()) {
return item.toString();
}
Expand Down Expand Up @@ -1728,7 +1728,7 @@ public void processSnapshot() {
return;
}
JsArray<Column> viewportColumns =
getColumns().filter((item, index, all) -> debounce.columns.get(item.getIndex()));
getColumns().filter((item, index) -> debounce.columns.get(item.getIndex()));
ViewportData data = new ViewportData(debounce.includedRows, debounce.dataColumns, viewportColumns,
currentState.getRowFormatColumn() == null ? NO_ROW_FORMAT_COLUMN
: currentState.getRowFormatColumn().getIndex(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public JsTotalsTableConfig(JsPropertyMap<Object> source) {
if (source.has("operationMap")) {
operationMap = source.getAsAny("operationMap").cast();
operationMap.forEach(key -> {
operationMap.get(key).forEach((value, index, array) -> {
operationMap.get(key).forEach((value, index) -> {
checkOperation(Js.cast(value));
return null;
});
Expand Down Expand Up @@ -237,9 +237,9 @@ public AggregateRequest buildRequest(JsArray<Column> allColumns) {
Map<String, LinkedHashSet<String>> aggs = new HashMap<>();
List<String> colsNeedingCompoundNames = new ArrayList<>();
Set<String> seenColNames = new HashSet<>();
groupBy.forEach((col, p1, p2) -> seenColNames.add(Js.cast(col)));
groupBy.forEach((col, p1) -> seenColNames.add(Js.cast(col)));
this.operationMap.forEach(colName -> {
this.operationMap.get(colName).forEach((agg, index, arr) -> {
this.operationMap.get(colName).forEach((agg, index) -> {
if (!JsAggregationOperation.canAggregateType(agg, columnTypes.get(colName))) {
// skip this column. to follow DHE's behavior
return null;
Expand Down Expand Up @@ -272,7 +272,7 @@ public AggregateRequest buildRequest(JsArray<Column> allColumns) {
AggregationCount count = new AggregationCount();
count.setColumnName("Count");
agg.setCount(count);
aggColumns.forEach((p0, p1, p2) -> {
aggColumns.forEach((p0, p1) -> {
String colName = p0.split("=")[0].trim();
customColumns.push(colName + " = Count");
return null;
Expand All @@ -296,7 +296,7 @@ public AggregateRequest buildRequest(JsArray<Column> allColumns) {
columns.setSpec(spec);
columns.setMatchPairsList(aggColumns);
agg.setColumns(columns);
aggColumns.forEach((p0, p1, p2) -> {
aggColumns.forEach((p0, p1) -> {
String colName = p0.split("=")[0].trim();
customColumns.push(colName + "= `` + " + colName);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private void connectToWorker() {
}),
info.getConnectOptions().then(options -> {
// set other specified headers, if any
JsObject.keys(options.headers).forEach((key, index, arr) -> {
JsObject.keys(options.headers).forEach((key, index) -> {
metadata.set(key, options.headers.get(key));
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static class EmulatedBiDiStream<T, U> extends BiDiStream<T, U> {
public void send(T payload) {
if (responseStream == null) {
responseStream = responseStreamFactory.apply(payload);
pending.forEach((p0, p1, p2) -> {
pending.forEach((p0, p1) -> {
p0.apply(responseStream);
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ public static BiDiStream<HandshakeRequest, HandshakeResponse> create(WorkerConne
Client<HandshakeRequest, HandshakeResponse> client = Grpc.client(FlightService.Handshake,
(io.deephaven.javascript.proto.dhinternal.grpcweb.grpc.ClientRpcOptions) options);
client.onEnd((status, statusMessage, trailers) -> {
listeners.get(STATUS_EVENT_LISTENER_NAME).forEach((item, index, arr) -> item.call(null,
listeners.get(STATUS_EVENT_LISTENER_NAME).forEach((item, index) -> item.call(null,
ResponseStreamWrapper.Status.of(status, statusMessage, metadata)));
listeners.get(END_EVENT_LISTENER_NAME).forEach((item, index, arr) -> item.call(null,
listeners.get(END_EVENT_LISTENER_NAME).forEach((item, index) -> item.call(null,
ResponseStreamWrapper.Status.of(status, statusMessage, metadata)));
listeners.clear();
});
client.onMessage(message -> {
listeners.get(DATA_EVENT_LISTENER_NAME).forEach((item, index, arr) -> item.call(null, message));
listeners.get(DATA_EVENT_LISTENER_NAME).forEach((item, index) -> item.call(null, message));
});
client.onHeaders(headers -> {
listeners.get(HEADERS_EVENT_LISTENER_NAME)
.forEach((item, index, arr) -> item.call(null, headers));
.forEach((item, index) -> item.call(null, headers));
});
client.start(metadata);

Expand Down Expand Up @@ -103,20 +103,20 @@ public BidirectionalStream<HandshakeRequest, HandshakeResponse> write(
props.setDebug(false);
props.setOnMessage(responseMessage -> {
listeners.get(DATA_EVENT_LISTENER_NAME)
.forEach((item, index, arr) -> item.call(null, responseMessage));
.forEach((item, index) -> item.call(null, responseMessage));
});
props.setOnEnd((status, statusMessage, trailers) -> {
listeners.get(STATUS_EVENT_LISTENER_NAME).forEach(
(item, index, arr) -> item.call(null,
(item, index) -> item.call(null,
ResponseStreamWrapper.Status.of(status, statusMessage, metadata)));
listeners.get(END_EVENT_LISTENER_NAME).forEach(
(item, index, arr) -> item.call(null,
(item, index) -> item.call(null,
ResponseStreamWrapper.Status.of(status, statusMessage, metadata)));
listeners.clear();
});
props.setOnHeaders(headers -> {
listeners.get(HEADERS_EVENT_LISTENER_NAME)
.forEach((item, index, arr) -> item.call(null, headers));
.forEach((item, index) -> item.call(null, headers));
});
Request client = Grpc.invoke.onInvoke(BrowserFlightService.OpenHandshake, props);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Promise<JsArray<JsItemDetails>> listItems(String path, @JsOptional String
return Callbacks.<ListItemsResponse, Object>grpcUnaryPromise(c -> client().listItems(req, metadata(), c::apply))
.then(response -> Promise
.resolve(response.getItemsList()
.map((item, i, arr) -> JsItemDetails.fromProto(response.getCanonicalPath(), item))));
.map((item, i) -> JsItemDetails.fromProto(response.getCanonicalPath(), item))));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public RollupRequest buildRequest(JsArray<Column> tableColumns) {
Map<String, LinkedHashSet<String>> aggs = new HashMap<>();
List<String> colsNeedingCompoundNames = new ArrayList<>();
Set<String> seenColNames = new HashSet<>();
groupingColumns.forEach((col, p1, p2) -> seenColNames.add(Js.cast(col)));
groupingColumns.forEach((col, p1) -> seenColNames.add(Js.cast(col)));
this.aggregations.forEach(key -> {
LinkedHashSet<String> cols = new LinkedHashSet<>();
this.aggregations.get(key).forEach((col, index, arr) -> {
this.aggregations.get(key).forEach((col, index) -> {
String colName = Js.cast(col);
cols.add(colName);
if (seenColNames.contains(colName)) {
Expand Down Expand Up @@ -297,22 +297,22 @@ private JsArray<String> dedup(LinkedHashSet<String> cols, List<String> colsNeedi
private String unusedColumnName(JsArray<Column> existingColumns, String... suggestedNames) {
// Try to use the default column names
for (String suggestedName : suggestedNames) {
if (!existingColumns.some((p0, p1, p2) -> p0.getName().equals(suggestedName))) {
if (!existingColumns.some((p0, p1) -> p0.getName().equals(suggestedName))) {
return suggestedName;
}
}

// Next add a suffix and use that if possible
for (String suggestedName : suggestedNames) {
if (!existingColumns.some((p0, p1, p2) -> p0.getName().equals(suggestedName + "_"))) {
if (!existingColumns.some((p0, p1) -> p0.getName().equals(suggestedName + "_"))) {
return suggestedName + "_";
}
}

// Give up and add a timestamp suffix
for (String suggestedName : suggestedNames) {
if (!existingColumns
.some((p0, p1, p2) -> p0.getName().equals(suggestedName + "_" + System.currentTimeMillis()))) {
.some((p0, p1) -> p0.getName().equals(suggestedName + "_" + System.currentTimeMillis()))) {
return suggestedName + "_" + System.currentTimeMillis();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private TreeViewportData(double offset, long viewportSize, double treeSize, Colu

// Without modifying this.columns (copied and frozen), make sure our key columns are present
// in the list of columns that we will copy data for the viewport
keyColumns.forEach((col, p1, p2) -> {
keyColumns.forEach((col, p1) -> {
if (this.columns.indexOf(col) == -1) {
columns[columns.length] = col;
}
Expand Down Expand Up @@ -567,8 +567,8 @@ private Promise<JsTable> makeKeyTable() {
keyTableColumns.push(rowDepthCol);
keyTableColumns.push(actionCol);
keyTable = connection.newTable(
Js.uncheckedCast(keyTableColumns.map((p0, p1, p2) -> p0.getName())),
Js.uncheckedCast(keyTableColumns.map((p0, p1, p2) -> p0.getType())),
Js.uncheckedCast(keyTableColumns.map((p0, p1) -> p0.getName())),
Js.uncheckedCast(keyTableColumns.map((p0, p1) -> p0.getType())),
keyTableData,
null,
null);
Expand Down Expand Up @@ -804,7 +804,7 @@ private BitSet makeColumnSubscriptionBitset() {
}
columnsBitset.set(rowDepthCol.getIndex());
columnsBitset.set(rowExpandedCol.getIndex());
keyColumns.forEach((p0, p1, p2) -> {
keyColumns.forEach((p0, p1) -> {
columnsBitset.set(p0.getIndex());
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public Promise<JsWidget> refetch() {
messageStream.onData(res -> {

JsArray<JsWidgetExportedObject> responseObjects = res.getData().getExportedReferencesList()
.map((p0, p1, p2) -> new JsWidgetExportedObject(connection, p0));
.map((p0, p1) -> new JsWidgetExportedObject(connection, p0));
if (!hasFetched) {
response = res;
exportedObjects = responseObjects;
Expand Down
Loading

0 comments on commit 6512b0e

Please sign in to comment.