Skip to content

Commit

Permalink
Simplify js api build (#3349)
Browse files Browse the repository at this point in the history
Historically, the js api and ide projects were separate, under the
assumption that distinct JS files might be exposed to different
consumers. That never happened, and for DHC the web-client-ide jar is
down to only three .java files. This PR moves those files to
web-client-api, and then removes the build wiring made redundant with
only one JS library.
  • Loading branch information
niloc132 authored and devinrsmith committed Jan 27, 2023
1 parent 0f65df1 commit 71f3bd7
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 84 deletions.
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ String[] mods = [
String[] webMods = [
'web',
'web-client-api', // compiled javascript api client
'web-client-ide', // IDE-only additions to open-api javascript client
'web-client-ui', // React IDE client app
'web-shared-beans', // shared data types and common interfaces
'web-client-backplane', // shared data types and common interfaces
Expand Down
38 changes: 31 additions & 7 deletions web/client-api/client-api.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
plugins {
id 'io.deephaven.project.register'
id 'java-library'
}

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

configurations {
js
}

dependencies {
api project(':web-shared-beans')
implementation project(':web-shared-beans')
implementation project(':web-client-backplane')

api 'com.vertispan.nio:gwt-nio:1.0-alpha-1'
implementation 'com.vertispan.nio:gwt-nio:1.0-alpha-1'

js project(path: ':proto:raw-js-openapi', configuration: 'js')
}
Classpaths.inheritElemental(project, 'elemental2-core', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-promise', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-dom', 'implementation')

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

def jsOutput = layout.buildDirectory.dir('js')
def gwtOutput = tasks.register('gwtOutput', Sync) {
includeEmptyDirs = false
from(tasks.getByName('gwtCompile').outputs.files) {
// only copy the dhapi module, and don't give it a wrapper directory
include 'dhapi/**'
eachFile { it.path = 'jsapi/' + it.path.substring('dhapi/'.length()) }
}
into jsOutput
}

artifacts {
js(jsOutput) {
builtBy gwtOutput
}
}
Classpaths.inheritElemental(project, 'elemental2-core', 'api')
Classpaths.inheritElemental(project, 'elemental2-promise', 'api')
Classpaths.inheritElemental(project, 'elemental2-dom', 'api')

GwtTools.gwtLib project
project.tasks.getByName('quick').dependsOn project.tasks.withType(de.esoco.gwt.gradle.task.GwtCompileTask)

apply from: "$rootDir/gradle/web-gwt-test.gradle"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN" "http://gwtproject.org/doctype/2.8.2/gwt-module.dtd">
<module rename-to="dhcore">
<module rename-to="dhapi">
<inherits name="elemental2.dom.Dom"/>
<inherits name="io.deephaven.ide.IdeShared"/>

<define-property name="dh.dev" values="true, false" />
<set-property name="dh.dev" value="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN" "http://gwtproject.org/doctype/2.8.2/gwt-module.dtd">
<module rename-to="dhcore">
<module rename-to="dhapi">
<inherits name="io.deephaven.web.DeephavenApi" />

<set-property name="dh.dev" value="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import elemental2.dom.CustomEventInit;
import elemental2.dom.DomGlobal;
import elemental2.promise.Promise;
import io.deephaven.ide.shared.IdeSession;
import io.deephaven.web.client.ide.IdeSession;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.console_pb.*;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.ticket_pb.Ticket;
import io.deephaven.web.client.api.barrage.stream.ResponseStreamWrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.shared;
package io.deephaven.web.client.ide;

import elemental2.promise.Promise;
import io.deephaven.web.client.api.console.JsCommandResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.client;
package io.deephaven.web.client.ide;

import elemental2.promise.Promise;
import io.deephaven.ide.shared.IdeSession;
import io.deephaven.web.client.fu.CancellablePromise;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.client;
package io.deephaven.web.client.ide;

import elemental2.promise.Promise;
import io.deephaven.web.client.api.Callbacks;
import io.deephaven.web.client.api.QueryConnectable;
import io.deephaven.web.client.api.WorkerConnection;
import io.deephaven.web.client.api.console.JsVariableChanges;
import io.deephaven.web.shared.data.ConnectToken;
import io.deephaven.web.shared.fu.JsConsumer;
import io.deephaven.web.shared.fu.JsRunnable;
import io.deephaven.web.shared.data.ConnectToken;
import jsinterop.annotations.*;
import jsinterop.annotations.JsConstructor;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsOptional;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import jsinterop.base.JsPropertyMap;

import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.client;
package io.deephaven.web.client.ide;

import jsinterop.annotations.JsConstructor;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(namespace = "dh")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.shared;
package io.deephaven.web.client.ide;

import com.google.gwt.user.client.Timer;
import elemental2.core.JsArray;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.ide.shared;
package io.deephaven.web.client.ide;

import elemental2.core.JsArray;
import io.deephaven.web.shared.ide.lsp.CompletionItem;
Expand Down
1 change: 0 additions & 1 deletion web/client-ide/.gitignore

This file was deleted.

40 changes: 0 additions & 40 deletions web/client-ide/client-ide.gradle

This file was deleted.

1 change: 0 additions & 1 deletion web/client-ide/gradle.properties

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion web/web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ configurations {

dependencies {
js project(path: ':web-client-ui', configuration: 'js')
js project(path: ':web-client-ide', configuration: 'js')
js project(path: ':web-client-api', configuration: 'js')
}

/**
Expand Down

0 comments on commit 71f3bd7

Please sign in to comment.