diff --git a/Rakefile b/Rakefile index 5a77dce90f6af..acfebd5c39c09 100644 --- a/Rakefile +++ b/Rakefile @@ -124,7 +124,7 @@ JAVA_RELEASE_TARGETS = [ '//java/client/src/org/openqa/selenium:client-combined', '//java/server/src/com/thoughtworks/selenium:leg-rc', '//java/server/src/org/openqa/grid/selenium:classes', - '//java/server/src/org/openqa/selenium/grid:module', + '//java/server/src/org/openqa/selenium/grid:grid', '//third_party/java/jetty:jetty' ] diff --git a/java/client/src/org/openqa/selenium/firefox/xpi/module-info.txt b/java/client/src/org/openqa/selenium/firefox/xpi/module-info.txt index f2d662c54e8bc..8a75f17b34cfe 100644 --- a/java/client/src/org/openqa/selenium/firefox/xpi/module-info.txt +++ b/java/client/src/org/openqa/selenium/firefox/xpi/module-info.txt @@ -23,7 +23,7 @@ module org.openqa.selenium.firefox.xpi { requires transitive org.openqa.selenium.core; requires transitive org.openqa.selenium.remote; - exports org.openqa.selenium.firefox; + exports org.openqa.selenium.firefox.xpi; provides org.openqa.selenium.remote.service.DriverService$Builder with org.openqa.selenium.firefox.xpi.XpiDriverService$Builder; diff --git a/java/client/src/org/openqa/selenium/remote/BUCK b/java/client/src/org/openqa/selenium/remote/BUCK index 96db8278cb0bf..d84bba7c0370a 100644 --- a/java/client/src/org/openqa/selenium/remote/BUCK +++ b/java/client/src/org/openqa/selenium/remote/BUCK @@ -65,6 +65,7 @@ java_library( "//java/client/src/org/openqa/selenium:selenium", ], deps = [ + "//java/client/src/org/openqa/selenium/remote/tracing:tracing", "//third_party/java/bytebuddy:byte-buddy", "//third_party/java/guava:guava", ], @@ -86,6 +87,7 @@ java_library( "HandshakeResponse.java", "HttpCommandExecutor.java", "InitialHandshakeResponse.java", + "JsonToWebElementConverter.java", "JsonWireProtocolResponse.java", "LocalFileDetector.java", "NewSessionPayload.java", diff --git a/java/client/src/org/openqa/selenium/remote/JsonToWebElementConverter.java b/java/client/src/org/openqa/selenium/remote/JsonToWebElementConverter.java new file mode 100644 index 0000000000000..93b575edabb0f --- /dev/null +++ b/java/client/src/org/openqa/selenium/remote/JsonToWebElementConverter.java @@ -0,0 +1,96 @@ +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you 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 org.openqa.selenium.remote; + +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import org.openqa.selenium.WebElement; + +import java.util.Collection; +import java.util.Map; +import java.util.Objects; + +/** + * Reconstitutes {@link WebElement}s from their JSON representation. Will recursively convert Lists + * and Maps to catch nested references. All other values pass through the converter unchanged. + */ +public class JsonToWebElementConverter implements Function { + + private final RemoteWebDriver driver; + + public JsonToWebElementConverter(RemoteWebDriver driver) { + this.driver = driver; + } + + @Override + public Object apply(Object result) { + if (result instanceof Collection) { + Collection results = (Collection) result; + return Lists.newArrayList(Iterables.transform(results, this)); + } + + if (result instanceof Map) { + Map resultAsMap = (Map) result; + String elementKey = getElementKey(resultAsMap); + if (null != elementKey) { + RemoteWebElement element = newRemoteWebElement(); + element.setId(String.valueOf(resultAsMap.get(elementKey))); + return element; + } else { + return Maps.transformValues(resultAsMap, this); + } + } + + if (result instanceof RemoteWebElement) { + return setOwner((RemoteWebElement) result); + } + + if (result instanceof Number) { + if (result instanceof Float || result instanceof Double) { + return ((Number) result).doubleValue(); + } + return ((Number) result).longValue(); + } + + return result; + } + + protected RemoteWebElement newRemoteWebElement() { + return setOwner(new RemoteWebElement()); + } + + private RemoteWebElement setOwner(RemoteWebElement element) { + if (driver != null) { + element.setParent(driver); + element.setFileDetector(driver.getFileDetector()); + } + return element; + } + private String getElementKey(Map resultAsMap) { + for (Dialect d : Dialect.values()) { + String elementKeyForDialect = d.getEncodedElementKey(); + if (resultAsMap.containsKey(elementKeyForDialect)) { + return elementKeyForDialect; + } + } + return null; + } +} diff --git a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java index a1582cbdee30e..ae59f17f4f835 100644 --- a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -66,7 +66,6 @@ import org.openqa.selenium.logging.LoggingPreferences; import org.openqa.selenium.logging.Logs; import org.openqa.selenium.logging.NeedsLocalLogs; -import org.openqa.selenium.remote.internal.JsonToWebElementConverter; import org.openqa.selenium.remote.internal.WebElementToJsonConverter; import java.net.URL; diff --git a/java/client/src/org/openqa/selenium/remote/internal/JsonToWebElementConverter.java b/java/client/src/org/openqa/selenium/remote/internal/JsonToWebElementConverter.java index 2ed2af5223810..10472ab428359 100644 --- a/java/client/src/org/openqa/selenium/remote/internal/JsonToWebElementConverter.java +++ b/java/client/src/org/openqa/selenium/remote/internal/JsonToWebElementConverter.java @@ -29,70 +29,19 @@ import java.util.Collection; import java.util.Map; +import java.util.Objects; /** * Reconstitutes {@link WebElement}s from their JSON representation. Will recursively convert Lists * and Maps to catch nested references. All other values pass through the converter unchanged. + * + * @deprecated Use {@link org.openqa.selenium.remote.JsonToWebElementConverter} instead. */ -public class JsonToWebElementConverter implements Function { - - private final RemoteWebDriver driver; +@Deprecated +public class JsonToWebElementConverter extends org.openqa.selenium.remote.JsonToWebElementConverter { public JsonToWebElementConverter(RemoteWebDriver driver) { - this.driver = driver; - } - - @Override - public Object apply(Object result) { - if (result instanceof Collection) { - Collection results = (Collection) result; - return Lists.newArrayList(Iterables.transform(results, this)); - } - - if (result instanceof Map) { - Map resultAsMap = (Map) result; - String elementKey = getElementKey(resultAsMap); - if (null != elementKey) { - RemoteWebElement element = newRemoteWebElement(); - element.setId(String.valueOf(resultAsMap.get(elementKey))); - return element; - } else { - return Maps.transformValues(resultAsMap, this); - } - } - - if (result instanceof RemoteWebElement) { - return setOwner((RemoteWebElement) result); - } - - if (result instanceof Number) { - if (result instanceof Float || result instanceof Double) { - return ((Number) result).doubleValue(); - } - return ((Number) result).longValue(); - } - - return result; + super(driver); } - protected RemoteWebElement newRemoteWebElement() { - return setOwner(new RemoteWebElement()); - } - - private RemoteWebElement setOwner(RemoteWebElement element) { - if (driver != null) { - element.setParent(driver); - element.setFileDetector(driver.getFileDetector()); - } - return element; - } - private String getElementKey(Map resultAsMap) { - for (Dialect d : Dialect.values()) { - String elementKeyForDialect = d.getEncodedElementKey(); - if (resultAsMap.containsKey(elementKeyForDialect)) { - return elementKeyForDialect; - } - } - return null; - } } diff --git a/java/client/src/org/openqa/selenium/remote/module-info.txt b/java/client/src/org/openqa/selenium/remote/module-info.txt index 53260de449dfb..52c2507744e6c 100644 --- a/java/client/src/org/openqa/selenium/remote/module-info.txt +++ b/java/client/src/org/openqa/selenium/remote/module-info.txt @@ -3,8 +3,9 @@ module org.openqa.selenium.remote { requires net.bytebuddy; requires transitive com.google.common; - requires transitive httpclient; - requires transitive httpcore; + requires transitive io.opentracing.api; + requires transitive io.opentracing.noop; + requires transitive io.opentracing.util; requires transitive java.logging; requires transitive okhttp3; requires transitive org.openqa.selenium.core; @@ -15,12 +16,17 @@ module org.openqa.selenium.remote { exports org.openqa.selenium.net; exports org.openqa.selenium.os; exports org.openqa.selenium.remote; + exports org.openqa.selenium.remote.codec; + exports org.openqa.selenium.remote.codec.jwp; + exports org.openqa.selenium.remote.codec.w3c; exports org.openqa.selenium.remote.html5; exports org.openqa.selenium.remote.http; exports org.openqa.selenium.remote.mobile; exports org.openqa.selenium.remote.service; exports org.openqa.selenium.remote.session; + exports org.openqa.selenium.remote.tracing; + uses io.opentracing.Tracer; uses org.openqa.selenium.remote.service.CapabilitiesFilter; uses org.openqa.selenium.remote.service.CapabilityTransform; uses org.openqa.selenium.remote.service.DriverService$Builder; diff --git a/java/rules.bzl b/java/rules.bzl index d97f011a3fc19..5b73bdf7563f4 100644 --- a/java/rules.bzl +++ b/java/rules.bzl @@ -1,14 +1,17 @@ -def _gen_build_info(name, maven_coords): +def _gen_build_info(name, maven_coords, multi_release_jar): if not (maven_coords): return [] rev = native.read_config("selenium", "rev", "unknown") time = native.read_config("selenium", "timestamp", "unknown") + multi_release = "false" + if multi_release_jar: + multi_release = "true" native.genrule( name = "%s-gen-manifest" % name, out = "manifest", - cmd = 'python -c "print(\'\\n\\nName: Build-Info\\nBuild-Revision: {}\\nBuild-Time: {}\\n\\n\')" >> $OUT'.format(rev, time), + cmd = 'python -c "print(\'Multi-Release: {}\\n\\nName: Build-Info\\nBuild-Revision: {}\\nBuild-Time: {}\\n\\n\')" >> $OUT'.format(multi_release_jar, rev, time), ) native.java_library( @@ -35,7 +38,7 @@ def java_library(name, maven_coords = None, module_info = None, deps = [], **kwa all_deps += [":%s-module-info" % name] - all_deps += _gen_build_info(name, maven_coords) + all_deps += _gen_build_info(name, maven_coords, module_info != None) native.java_library( name = name, diff --git a/java/server/src/com/thoughtworks/selenium/webdriven/BUCK b/java/server/src/com/thoughtworks/selenium/webdriven/BUCK index 4a2f4083ba688..8c1fa2a9c42cb 100644 --- a/java/server/src/com/thoughtworks/selenium/webdriven/BUCK +++ b/java/server/src/com/thoughtworks/selenium/webdriven/BUCK @@ -12,7 +12,7 @@ java_library( "//java/client/src/org/openqa/selenium/opera:opera", "//java/client/src/org/openqa/selenium/remote:remote", "//java/client/src/org/openqa/selenium/safari:safari", - "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/src/org/openqa/selenium/remote/server:server", "//java/server/src/org/openqa/selenium/remote/server:sessions", "//java/server/src/org/openqa/selenium/remote/server:webdriver-servlet", diff --git a/java/server/src/org/openqa/grid/BUCK b/java/server/src/org/openqa/grid/BUCK index 268807f4615a9..3fc24dab8a181 100644 --- a/java/server/src/org/openqa/grid/BUCK +++ b/java/server/src/org/openqa/grid/BUCK @@ -21,12 +21,10 @@ java_library( "//java/client/src/org/openqa/selenium/remote:remote", "//java/client/src/org/openqa/selenium/firefox:firefox", "//java/client/src/org/openqa/selenium/safari:safari", - "//java/server/src/org/openqa/selenium/grid/config:config", - "//java/server/src/org/openqa/selenium/grid/server:server", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/src/org/openqa/selenium/remote/server:server", "//java/server/src/org/openqa/selenium/remote/server:webdriver-servlet", "//java/server/src/org/openqa/selenium/remote/server/log:log", - "//java/server/src/org/openqa/selenium/remote/server/jmx:jmx", "//third_party/java/beust:jcommander", "//third_party/java/guava:guava", "//third_party/java/jcip:jcip-annotations", diff --git a/java/server/src/org/openqa/grid/selenium/BUCK b/java/server/src/org/openqa/grid/selenium/BUCK index 3f1bdd1ec9f08..c87f12a1f0133 100644 --- a/java/server/src/org/openqa/grid/selenium/BUCK +++ b/java/server/src/org/openqa/grid/selenium/BUCK @@ -1,4 +1,5 @@ load("//java:version.bzl", "SE_VERSION") +load("//java:rules.bzl", "java_library") # Force a rebuild every time we're parsed. @@ -18,6 +19,7 @@ java_library( name = "classes", maven_coords = "org.seleniumhq.selenium:selenium-server:" + SE_VERSION, maven_pom_template = "//java/client/src/org/openqa/selenium:template-pom", + module_info = "module-info.txt", srcs = glob( ["**/*.java"], exclude = ["node/**"], @@ -26,19 +28,15 @@ java_library( "//java/client/src/org/openqa/selenium:selenium", "//java/client/src/org/openqa/selenium:client-combined", "//java/server/src/org/openqa/grid:grid", - "//java/server/src/org/openqa/selenium/grid/server:server", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/src/org/openqa/selenium/remote/server/log:log", "//java/server/src/org/openqa/selenium/remote/server:standalone-server-lib", "//java/server/src/org/openqa/selenium/remote/server:server", - "//java/server/src/org/openqa/selenium/remote/server/jmx:jmx", "//third_party/java/guava:guava", "//third_party/java/servlet:javax.servlet-api", "//third_party/java/beust:jcommander", ], - visibility = [ - "//java/server/test/org/openqa/grid/e2e:tests", - "//java/server/test/org/openqa/grid/selenium/proxy:proxy", - ], + visibility = [ "PUBLIC" ], ) # This isn't very elegant, but we can build a dist zip like this: diff --git a/java/server/src/org/openqa/grid/selenium/module-info.txt b/java/server/src/org/openqa/grid/selenium/module-info.txt new file mode 100644 index 0000000000000..5d1e4d46cf4db --- /dev/null +++ b/java/server/src/org/openqa/grid/selenium/module-info.txt @@ -0,0 +1,69 @@ +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you 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. + + +module org.openqa.grid.selenium { + requires java.desktop; + requires jcip.annotations; + requires org.openqa.selenium.chrome; + requires org.openqa.selenium.edge; + requires org.openqa.selenium.firefox; + requires org.openqa.selenium.ie; + requires org.openqa.selenium.safari; + requires org.openqa.selenium.support; + requires org.seleniumhq.jetty9; + requires org.openqa.selenium.grid; + + requires transitive com.google.common; + requires transitive java.logging; + requires transitive java.management; + requires transitive javax.servlet.api; + requires transitive jcommander; + requires transitive jeromq; + requires transitive org.openqa.selenium.core; + requires transitive org.openqa.selenium.remote; + + exports org.openqa.grid.common; + exports org.openqa.grid.common.exception; + exports org.openqa.grid.internal; + exports org.openqa.grid.internal.cli; + exports org.openqa.grid.internal.exception; + exports org.openqa.grid.internal.listeners; + exports org.openqa.grid.internal.utils; + exports org.openqa.grid.internal.utils.configuration; + exports org.openqa.grid.internal.utils.configuration.json; + exports org.openqa.grid.selenium; + exports org.openqa.grid.selenium.node; + exports org.openqa.grid.selenium.proxy; + exports org.openqa.grid.shared; + exports org.openqa.grid.web; + exports org.openqa.grid.web.servlet; + exports org.openqa.grid.web.servlet.console; + exports org.openqa.grid.web.servlet.handler; + exports org.openqa.grid.web.utils; + exports org.openqa.selenium.remote.server; + exports org.openqa.selenium.remote.server.commandhandler; + exports org.openqa.selenium.remote.server.handler; + exports org.openqa.selenium.remote.server.handler.html5; + exports org.openqa.selenium.remote.server.handler.interactions; + exports org.openqa.selenium.remote.server.handler.interactions.touch; + exports org.openqa.selenium.remote.server.handler.internal; + exports org.openqa.selenium.remote.server.handler.mobile; + exports org.openqa.selenium.remote.server.log; + exports org.openqa.selenium.remote.server.rest; + exports org.openqa.selenium.remote.server.xdrpc; +} diff --git a/java/server/src/org/openqa/selenium/events/zeromq/BUCK b/java/server/src/org/openqa/selenium/events/zeromq/BUCK index b5dff05035c41..405fd74cfd578 100644 --- a/java/server/src/org/openqa/selenium/events/zeromq/BUCK +++ b/java/server/src/org/openqa/selenium/events/zeromq/BUCK @@ -12,6 +12,7 @@ java_library( "//third_party/java/guava:guava", ], visibility = [ + "//java/server/src/org/openqa/selenium/grid:", "//java/server/src/org/openqa/selenium/grid/server:server", "//java/server/test/org/openqa/selenium/...", ], diff --git a/java/server/src/org/openqa/selenium/grid/BUCK b/java/server/src/org/openqa/selenium/grid/BUCK index 9511eb0fe2e49..5d17eae787d0d 100644 --- a/java/server/src/org/openqa/selenium/grid/BUCK +++ b/java/server/src/org/openqa/selenium/grid/BUCK @@ -48,12 +48,10 @@ java_binary( name = "selenium", main_class = "org.openqa.selenium.grid.Main", deps = [ - ":module", + ":grid", # Force slf4j logging to go through java.util.logging "//third_party/java/slf4j:slf4j-jdk14", ], - visibility = [ - ], ) java_library( @@ -65,10 +63,33 @@ java_library( ) java_library( - name = "module", + name = "grid", maven_coords = "org.seleniumhq.selenium:grid:" + SE_VERSION, maven_pom_template = "//java/client/src/org/openqa/selenium:template-pom", module_info = "module-info.txt", + exported_deps = [ + "//java/server/src/org/openqa/selenium/events:events", + "//java/server/src/org/openqa/selenium/events/local:local", + "//java/server/src/org/openqa/selenium/events/zeromq:zeromq", + "//java/server/src/org/openqa/selenium/grid/commands:commands", + "//java/server/src/org/openqa/selenium/grid/config:config", + "//java/server/src/org/openqa/selenium/grid/data:data", + "//java/server/src/org/openqa/selenium/grid/distributor:distributor", + "//java/server/src/org/openqa/selenium/grid/distributor/local:local", + "//java/server/src/org/openqa/selenium/grid/distributor/remote:remote", + "//java/server/src/org/openqa/selenium/grid/node:node", + "//java/server/src/org/openqa/selenium/grid/node/local:local", + "//java/server/src/org/openqa/selenium/grid/node/remote:remote", + "//java/server/src/org/openqa/selenium/grid/router:router", + "//java/server/src/org/openqa/selenium/grid/server:server", + "//java/server/src/org/openqa/selenium/grid/session:session", + "//java/server/src/org/openqa/selenium/grid/session/remote:remote", + "//java/server/src/org/openqa/selenium/grid/sessionmap:sessionmap", + "//java/server/src/org/openqa/selenium/grid/sessionmap/local:local", + "//java/server/src/org/openqa/selenium/grid/sessionmap/remote:remote", + "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/remote/server/jmx:jmx", + ], deps = [ ":lib", "//java/client/src/org/openqa/selenium/chrome:chrome", @@ -82,4 +103,5 @@ java_library( "//java/server/src/org/openqa/selenium/grid/router/httpd:httpd", "//java/server/src/org/openqa/selenium/grid/sessionmap/httpd:httpd", ], + visibility = [ "PUBLIC" ], ) diff --git a/java/server/src/org/openqa/selenium/grid/component/BUCK b/java/server/src/org/openqa/selenium/grid/component/BUCK index ada0f0a5ec268..12c2444510814 100644 --- a/java/server/src/org/openqa/selenium/grid/component/BUCK +++ b/java/server/src/org/openqa/selenium/grid/component/BUCK @@ -4,7 +4,7 @@ java_library( deps = [ ], visibility = [ - "//java/server/src/org/openqa/...", + "//java/server/src/org/openqa/selenium/grid/...", "//java/server/test/org/openqa/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/config/BUCK b/java/server/src/org/openqa/selenium/grid/config/BUCK index 3cb1b0843e8c0..e6a46a31f0205 100644 --- a/java/server/src/org/openqa/selenium/grid/config/BUCK +++ b/java/server/src/org/openqa/selenium/grid/config/BUCK @@ -5,6 +5,7 @@ java_library( "//third_party/java/guava:guava", ], visibility = [ - "//java/server/...", + "//java/server/src/org/openqa/selenium/events/...", + "//java/server/src/org/openqa/selenium/grid/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/log/BUCK b/java/server/src/org/openqa/selenium/grid/log/BUCK index 1b627e1c697dd..e502e07809139 100644 --- a/java/server/src/org/openqa/selenium/grid/log/BUCK +++ b/java/server/src/org/openqa/selenium/grid/log/BUCK @@ -7,7 +7,7 @@ java_library( "//java/server/src/org/openqa/selenium/grid/config:config", ], visibility = [ - "//java/server/src/org/openqa/...", + "//java/server/src/org/openqa/selenium/grid/...", "//java/server/test/org/openqa/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/module-info.txt b/java/server/src/org/openqa/selenium/grid/module-info.txt index 4263f41967a00..5dc612b72b82e 100644 --- a/java/server/src/org/openqa/selenium/grid/module-info.txt +++ b/java/server/src/org/openqa/selenium/grid/module-info.txt @@ -18,17 +18,16 @@ module org.openqa.selenium.grid { requires com.google.common; - requires jetty.maven; - requires opentracing.noop; - requires opentracing.tracerresolver; + requires io.opentracing.noop; + // requires io.opentracing.tracerresolver; requires org.openqa.selenium.support; + requires org.seleniumhq.jetty9; requires transitive java.logging; requires transitive javax.servlet.api; requires transitive jcommander; requires transitive jeromq; - requires transitive opencensus.api; - requires transitive opentracing.api; + requires transitive io.opentracing.api; requires transitive org.openqa.selenium.core; requires transitive org.openqa.selenium.remote; @@ -36,6 +35,7 @@ module org.openqa.selenium.grid { exports org.openqa.selenium.concurrent; exports org.openqa.selenium.docker; exports org.openqa.selenium.events; + exports org.openqa.selenium.events.local; exports org.openqa.selenium.events.zeromq; exports org.openqa.selenium.grid; exports org.openqa.selenium.grid.commands; @@ -44,22 +44,28 @@ module org.openqa.selenium.grid { exports org.openqa.selenium.grid.data; exports org.openqa.selenium.grid.distributor; exports org.openqa.selenium.grid.distributor.config; + exports org.openqa.selenium.grid.distributor.httpd; exports org.openqa.selenium.grid.distributor.local; exports org.openqa.selenium.grid.distributor.remote; exports org.openqa.selenium.grid.docker; exports org.openqa.selenium.grid.log; exports org.openqa.selenium.grid.node; exports org.openqa.selenium.grid.node.config; + exports org.openqa.selenium.grid.node.httpd; exports org.openqa.selenium.grid.node.local; exports org.openqa.selenium.grid.node.remote; exports org.openqa.selenium.grid.router; + exports org.openqa.selenium.grid.router.httpd; exports org.openqa.selenium.grid.server; + exports org.openqa.selenium.grid.session; + exports org.openqa.selenium.grid.session.remote; exports org.openqa.selenium.grid.sessionmap; exports org.openqa.selenium.grid.sessionmap.config; + exports org.openqa.selenium.grid.sessionmap.httpd; exports org.openqa.selenium.grid.sessionmap.local; exports org.openqa.selenium.grid.sessionmap.remote; exports org.openqa.selenium.grid.web; - exports org.openqa.selenium.remote.tracing; + exports org.openqa.selenium.remote.server.jmx; provides org.openqa.selenium.cli.CliCommand with org.openqa.selenium.grid.commands.Hub, diff --git a/java/server/src/org/openqa/selenium/grid/server/BUCK b/java/server/src/org/openqa/selenium/grid/server/BUCK index b33d5ad6d881e..6605810086bc0 100644 --- a/java/server/src/org/openqa/selenium/grid/server/BUCK +++ b/java/server/src/org/openqa/selenium/grid/server/BUCK @@ -20,6 +20,7 @@ java_library( "//third_party/java/jetty:jetty", ], visibility = [ - "//java/server/...", + "//java/server/src/org/openqa/selenium/grid/...", + "//java/server/test/org/openqa/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/session/BUCK b/java/server/src/org/openqa/selenium/grid/session/BUCK index 36c0f68605e1a..62ca2c320d995 100644 --- a/java/server/src/org/openqa/selenium/grid/session/BUCK +++ b/java/server/src/org/openqa/selenium/grid/session/BUCK @@ -10,7 +10,7 @@ java_library( "//third_party/java/guava:guava", ], visibility = [ - "//java/server/src/org/openqa/selenium/...", + "//java/server/src/org/openqa/selenium/grid/...", "//java/server/test/org/openqa/selenium/grid/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/session/remote/BUCK b/java/server/src/org/openqa/selenium/grid/session/remote/BUCK index ea9961249226e..4a64fdb652742 100644 --- a/java/server/src/org/openqa/selenium/grid/session/remote/BUCK +++ b/java/server/src/org/openqa/selenium/grid/session/remote/BUCK @@ -9,7 +9,7 @@ java_library( "//third_party/java/guava:guava", ], visibility = [ - "//java/server/src/org/openqa/selenium/...", + "//java/server/src/org/openqa/selenium/grid/...", "//java/server/test/org/openqa/selenium/grid/session/remote:remote", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/web/BUCK b/java/server/src/org/openqa/selenium/grid/web/BUCK index 699e1fe2f103e..8971edb0aab36 100644 --- a/java/server/src/org/openqa/selenium/grid/web/BUCK +++ b/java/server/src/org/openqa/selenium/grid/web/BUCK @@ -8,6 +8,7 @@ java_library( "//third_party/java/guava:guava", ], visibility = [ - "//java/server/...", + "//java/server/src/org/openqa/selenium/grid/...", + "//java/server/test/org/openqa/...", ], ) diff --git a/java/server/src/org/openqa/selenium/grid/web/ProtocolConverter.java b/java/server/src/org/openqa/selenium/grid/web/ProtocolConverter.java index e51f175fe99fe..3687ef85c2f6f 100644 --- a/java/server/src/org/openqa/selenium/grid/web/ProtocolConverter.java +++ b/java/server/src/org/openqa/selenium/grid/web/ProtocolConverter.java @@ -32,7 +32,7 @@ import org.openqa.selenium.remote.http.HttpClient; import org.openqa.selenium.remote.http.HttpRequest; import org.openqa.selenium.remote.http.HttpResponse; -import org.openqa.selenium.remote.internal.JsonToWebElementConverter; +import org.openqa.selenium.remote.JsonToWebElementConverter; import java.io.IOException; import java.util.Map; diff --git a/java/server/src/org/openqa/selenium/remote/server/BUCK b/java/server/src/org/openqa/selenium/remote/server/BUCK index e11c09c4668de..506b93baddd39 100644 --- a/java/server/src/org/openqa/selenium/remote/server/BUCK +++ b/java/server/src/org/openqa/selenium/remote/server/BUCK @@ -50,7 +50,7 @@ java_library( "//java/client/src/org/openqa/selenium/json:json", "//java/client/src/org/openqa/selenium/remote:remote", "//java/client/src/org/openqa/selenium/support/events:events", - "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/src/org/openqa/selenium/remote/server/log:log", "//third_party/java/guava:guava", ], @@ -78,17 +78,14 @@ java_library( "//third_party/java/servlet:javax.servlet-api", ], exported_deps = [ - "//java/server/src/org/openqa/selenium/grid/session:session", - "//java/server/src/org/openqa/selenium/grid/session/remote:remote", - "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/grid:grid", ], deps = [ ":server", ":sessions", "//java/client/src/org/openqa/selenium/remote:remote", - "//java/server/src/org/openqa/selenium/grid/server:server", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/src/org/openqa/selenium/remote/server/log:log", - "//java/server/src/org/openqa/selenium/remote/server/jmx:jmx", "//third_party/java/guava:guava", ], visibility = [ @@ -137,10 +134,7 @@ java_library( "//java/client/src/org/openqa/selenium/safari:safari", "//java/server/src/org/openqa/grid:grid", "//java/server/src/org/openqa/grid/selenium/node:node", - "//java/server/src/org/openqa/selenium/grid/config:config", - "//java/server/src/org/openqa/selenium/grid/server:server", - "//java/server/src/org/openqa/selenium/grid/web:web", - "//java/server/src/org/openqa/selenium/remote/server/jmx:jmx", + "//java/server/src/org/openqa/selenium/grid:grid", "//third_party/java/beust:jcommander", "//third_party/java/jetty:jetty", "//third_party/java/servlet:javax.servlet-api", diff --git a/java/server/src/org/openqa/selenium/remote/server/jmx/BUCK b/java/server/src/org/openqa/selenium/remote/server/jmx/BUCK index a2967225373a6..f1f600f5a4144 100644 --- a/java/server/src/org/openqa/selenium/remote/server/jmx/BUCK +++ b/java/server/src/org/openqa/selenium/remote/server/jmx/BUCK @@ -4,7 +4,7 @@ java_library( deps = [ ], visibility = [ - "//java/server/src/...", + "//java/server/src/org/openqa/selenium/grid/...", "//java/server/test/...", ], ) diff --git a/java/server/src/org/openqa/selenium/remote/server/log/BUCK b/java/server/src/org/openqa/selenium/remote/server/log/BUCK index ea47660c87f30..b5028ee48a003 100644 --- a/java/server/src/org/openqa/selenium/remote/server/log/BUCK +++ b/java/server/src/org/openqa/selenium/remote/server/log/BUCK @@ -4,7 +4,7 @@ java_library( deps = [ "//java/client/src/org/openqa/selenium:selenium", "//java/client/src/org/openqa/selenium/remote:remote", - "//java/server/src/org/openqa/selenium/grid/log:log", + "//java/server/src/org/openqa/selenium/grid:grid", "//third_party/java/guava:guava", ], visibility = [ diff --git a/java/server/test/org/openqa/selenium/grid/config/BUCK b/java/server/test/org/openqa/selenium/grid/config/BUCK index 6112beba5351c..462d59fb2bbdc 100644 --- a/java/server/test/org/openqa/selenium/grid/config/BUCK +++ b/java/server/test/org/openqa/selenium/grid/config/BUCK @@ -5,7 +5,7 @@ java_test( "small", ], deps = [ - "//java/server/src/org/openqa/selenium/grid/config:config", + "//java/server/src/org/openqa/selenium/grid:grid", "//third_party/java/beust:jcommander", "//third_party/java/guava:guava", "//third_party/java/junit:junit", diff --git a/java/server/test/org/openqa/selenium/grid/router/BUCK b/java/server/test/org/openqa/selenium/grid/router/BUCK index 90f60e4abf544..ae2f693e79c48 100644 --- a/java/server/test/org/openqa/selenium/grid/router/BUCK +++ b/java/server/test/org/openqa/selenium/grid/router/BUCK @@ -7,21 +7,7 @@ java_test( deps = [ "//java/client/src/org/openqa/selenium/remote/tracing:tracing", "//java/client/src/org/openqa/selenium/support:support", - "//java/server/src/org/openqa/selenium/events/local:local", - "//java/server/src/org/openqa/selenium/events/zeromq:zeromq", - "//java/server/src/org/openqa/selenium/grid/config:config", - "//java/server/src/org/openqa/selenium/grid/distributor:distributor", - "//java/server/src/org/openqa/selenium/grid/distributor/local:local", - "//java/server/src/org/openqa/selenium/grid/distributor/remote:remote", - "//java/server/src/org/openqa/selenium/grid/node:node", - "//java/server/src/org/openqa/selenium/grid/node/local:local", - "//java/server/src/org/openqa/selenium/grid/node/remote:remote", - "//java/server/src/org/openqa/selenium/grid/router:router", - "//java/server/src/org/openqa/selenium/grid/server:server", - "//java/server/src/org/openqa/selenium/grid/sessionmap:sessionmap", - "//java/server/src/org/openqa/selenium/grid/sessionmap/local:local", - "//java/server/src/org/openqa/selenium/grid/sessionmap/remote:remote", - "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/test/org/openqa/selenium/grid/testing:testing", "//third_party/java/assertj:assertj", "//third_party/java/guava:guava", diff --git a/java/server/test/org/openqa/selenium/grid/server/BUCK b/java/server/test/org/openqa/selenium/grid/server/BUCK index a58973e65d27c..239898efa102a 100644 --- a/java/server/test/org/openqa/selenium/grid/server/BUCK +++ b/java/server/test/org/openqa/selenium/grid/server/BUCK @@ -6,9 +6,7 @@ java_test( ], deps = [ "//java/client/src/org/openqa/selenium/remote:remote", - "//java/server/src/org/openqa/selenium/grid/config:config", - "//java/server/src/org/openqa/selenium/grid/server:server", - "//java/server/src/org/openqa/selenium/grid/web:web", + "//java/server/src/org/openqa/selenium/grid:grid", "//java/server/test/org/openqa/testing:test-base", "//third_party/java/assertj:assertj", "//third_party/java/guava:guava", diff --git a/third_party/java/jetty/BUCK b/third_party/java/jetty/BUCK index d11efc7ef832e..9c93d288af579 100644 --- a/third_party/java/jetty/BUCK +++ b/third_party/java/jetty/BUCK @@ -1,14 +1,19 @@ +load("//java:rules.bzl", "java_library") + JETTY_VERSION = "9.4.12.v20180830" +MAVEN_VERSION = "%s.1" % JETTY_VERSION java_library( name = "jetty", - maven_coords = "org.seleniumhq.selenium:jetty-repacked:%s" % JETTY_VERSION, + maven_coords = "org.seleniumhq.selenium:jetty-repacked:%s" % MAVEN_VERSION, maven_pom_template = "jetty.pom", + module_info = "module-info.txt", exported_deps = [ ":repackage", ], deps = [ "//third_party/java/servlet:javax.servlet-api", + "//third_party/java/slf4j:slf4j-api", ], visibility = [ "//java/client/test/com/thoughtworks/selenium:tests", @@ -32,14 +37,14 @@ java_library( # prebuilt_jar we avoid that problem. prebuilt_jar( name = "repackage", - binary_jar = ":strip-services", + binary_jar = ":move-services", ) genrule( - name = "strip-services", - out = "stripped-bundle.jar", - cmd = "mkdir tmp && cd tmp && jar xf $(location :bundle-jars) && rm -rf META-INF/services && jar cvf $OUT *", - cmd_exe = "mkdir tmp && cd tmp && jar xf $(location :bundle-jars) && rmdir /s /q META-INF\\services && jar cvf $OUT *" + name = "move-services", + out = "moved-bundle.jar", + cmd = "mkdir tmp && cd tmp && jar xf $(location :bundle-jars) && rm -rf META-INF/services/* && echo org.seleniumhq.jetty9.http.Http1FieldPreEncoder > META-INF/services/org.seleniumhq.jetty9.http.HttpFieldPreEncoder && jar cvf $OUT *", + cmd_exe = "md tmp && cd tmp && jar xf $(location :bundle-jars) && del META-INF/services/* && echo org.seleniumhq.jetty9.http.Http1FieldPreEncoder > META-INF\\services\\org.seleniumhq.jetty9.http.HttpFieldPreEncoder && jar cvf $OUT *", ) diff --git a/third_party/java/jetty/module-info.txt b/third_party/java/jetty/module-info.txt new file mode 100644 index 0000000000000..1511d323287f6 --- /dev/null +++ b/third_party/java/jetty/module-info.txt @@ -0,0 +1,50 @@ +module org.seleniumhq.jetty9 { + requires java.desktop; + requires java.rmi; + requires java.security.jgss; + requires slf4j.api; + + requires transitive java.logging; + requires transitive java.management; + requires transitive java.naming; + requires transitive java.sql; + requires transitive java.xml; + requires transitive javax.servlet.api; + + exports org.seleniumhq.jetty9.http; + exports org.seleniumhq.jetty9.http.pathmap; + exports org.seleniumhq.jetty9.io; + exports org.seleniumhq.jetty9.io.ssl; + exports org.seleniumhq.jetty9.jmx; + exports org.seleniumhq.jetty9.security; + exports org.seleniumhq.jetty9.security.authentication; + exports org.seleniumhq.jetty9.server; + exports org.seleniumhq.jetty9.server.handler; + exports org.seleniumhq.jetty9.server.handler.gzip; + exports org.seleniumhq.jetty9.server.handler.jmx; + exports org.seleniumhq.jetty9.server.jmx; + exports org.seleniumhq.jetty9.server.nio; + exports org.seleniumhq.jetty9.server.session; + exports org.seleniumhq.jetty9.servlet; + exports org.seleniumhq.jetty9.servlet.jmx; + exports org.seleniumhq.jetty9.servlet.listener; + exports org.seleniumhq.jetty9.util; + exports org.seleniumhq.jetty9.util.annotation; + exports org.seleniumhq.jetty9.util.component; + exports org.seleniumhq.jetty9.util.log; + exports org.seleniumhq.jetty9.util.log.jmx; + exports org.seleniumhq.jetty9.util.preventers; + exports org.seleniumhq.jetty9.util.resource; + exports org.seleniumhq.jetty9.util.security; + exports org.seleniumhq.jetty9.util.ssl; + exports org.seleniumhq.jetty9.util.statistic; + exports org.seleniumhq.jetty9.util.thread; + exports org.seleniumhq.jetty9.util.thread.strategy; + exports org.seleniumhq.jetty9.xml; + + uses org.seleniumhq.jetty9.http.HttpFieldPreEncoder; + + provides org.seleniumhq.jetty9.http.HttpFieldPreEncoder with + org.seleniumhq.jetty9.http.Http1FieldPreEncoder; + +} diff --git a/third_party/java/slf4j/BUCK b/third_party/java/slf4j/BUCK index 490dceac80206..a011840def448 100644 --- a/third_party/java/slf4j/BUCK +++ b/third_party/java/slf4j/BUCK @@ -4,7 +4,7 @@ prebuilt_jar( binary_jar = "slf4j-api-1.7.25.jar", source_jar = "slf4j-api-1.7.25-sources.jar", visibility = [ - "//third_party/java/jetty:jetty-util", + "//third_party/java/jetty:", "//third_party/java/littleshoot:littleproxy", "//third_party/java/netty:netty-all", ],