Skip to content

Commit

Permalink
Modularise the java build slightly better than before
Browse files Browse the repository at this point in the history
It should be possible to start Grid TNG using a module-path.
  • Loading branch information
shs96c committed Apr 2, 2019
1 parent b0b69e6 commit 49fb9d0
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 14 deletions.
3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ 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',
'//third_party/java/jetty:jetty'
]




# Notice that because we're using rake, anything you can do in a normal rake
# build can also be done here. For example, here we set the default task
task :default => [:test]
Expand Down
2 changes: 2 additions & 0 deletions java/client/src/org/openqa/selenium/support/BUCK
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("//java:version.bzl", "SE_VERSION")
load("//java:rules.bzl", "java_library")

java_library(
name = "support",
Expand All @@ -9,6 +10,7 @@ java_library(
],
maven_coords = "org.seleniumhq.selenium:selenium-support:" + SE_VERSION,
maven_pom_template = "//java/client/src/org/openqa/selenium:template-pom",
module_info = "module-info.txt",
exported_deps = [
":page-factory",
"//java/client/src/org/openqa/selenium/support/events:events",
Expand Down
15 changes: 15 additions & 0 deletions java/client/src/org/openqa/selenium/support/module-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module org.openqa.selenium.support {
requires java.logging;
requires org.openqa.selenium.remote;

requires transitive com.google.common;
requires transitive java.desktop;
requires transitive org.openqa.selenium.core;

exports org.openqa.selenium.support;
exports org.openqa.selenium.support.events;
exports org.openqa.selenium.support.events.internal;
exports org.openqa.selenium.support.pagefactory;
exports org.openqa.selenium.support.pagefactory.internal;
exports org.openqa.selenium.support.ui;
}
37 changes: 24 additions & 13 deletions java/server/src/org/openqa/selenium/grid/BUCK
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
load("//java:version.bzl", "SE_VERSION")
load("//java:rules.bzl", "java_library")

java_binary(
name = "selenium",
main_class = "org.openqa.selenium.grid.Main",
deps = [
":lib",
"//java/client/src/org/openqa/selenium/chrome:chrome",
"//java/client/src/org/openqa/selenium/edge:edge",
"//java/client/src/org/openqa/selenium/firefox:firefox",
"//java/client/src/org/openqa/selenium/ie:ie",
"//java/client/src/org/openqa/selenium/safari:safari",
"//java/server/src/org/openqa/selenium/grid/commands:commands",
"//java/server/src/org/openqa/selenium/grid/distributor/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/node/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/router/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/sessionmap/httpd:httpd",
":module",
],
visibility = [
],
Expand All @@ -24,6 +17,24 @@ java_library(
deps = [
"//java/server/src/org/openqa/selenium/cli:cli",
],
visibility = [
],
)

java_library(
name = "module",
maven_coords = "org.seleniumhq.selenium:grid:" + SE_VERSION,
maven_pom_template = "//java/client/src/org/openqa/selenium:template-pom",
module_info = "module-info.txt",
deps = [
":lib",
"//java/client/src/org/openqa/selenium/chrome:chrome",
"//java/client/src/org/openqa/selenium/edge:edge",
"//java/client/src/org/openqa/selenium/firefox:firefox",
"//java/client/src/org/openqa/selenium/ie:ie",
"//java/client/src/org/openqa/selenium/safari:safari",
"//java/server/src/org/openqa/selenium/grid/commands:commands",
"//java/server/src/org/openqa/selenium/grid/distributor/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/node/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/router/httpd:httpd",
"//java/server/src/org/openqa/selenium/grid/sessionmap/httpd:httpd",
],
)
72 changes: 72 additions & 0 deletions java/server/src/org/openqa/selenium/grid/module-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// 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.selenium.grid {
requires com.google.common;
requires jetty.maven;
requires opentracing.noop;
requires opentracing.tracerresolver;
requires org.openqa.selenium.support;

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 org.openqa.selenium.core;
requires transitive org.openqa.selenium.remote;

exports org.openqa.selenium.cli;
exports org.openqa.selenium.concurrent;
exports org.openqa.selenium.docker;
exports org.openqa.selenium.events;
exports org.openqa.selenium.events.zeromq;
exports org.openqa.selenium.grid;
exports org.openqa.selenium.grid.commands;
exports org.openqa.selenium.grid.component;
exports org.openqa.selenium.grid.config;
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.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.local;
exports org.openqa.selenium.grid.node.remote;
exports org.openqa.selenium.grid.router;
exports org.openqa.selenium.grid.server;
exports org.openqa.selenium.grid.sessionmap;
exports org.openqa.selenium.grid.sessionmap.config;
exports org.openqa.selenium.grid.sessionmap.local;
exports org.openqa.selenium.grid.sessionmap.remote;
exports org.openqa.selenium.grid.web;
exports org.openqa.selenium.injector;
exports org.openqa.selenium.remote.tracing;

provides org.openqa.selenium.cli.CliCommand with
org.openqa.selenium.grid.commands.Hub,
org.openqa.selenium.grid.commands.Standalone,
org.openqa.selenium.grid.distributor.httpd.DistributorServer,
org.openqa.selenium.grid.node.httpd.NodeServer,
org.openqa.selenium.grid.router.httpd.RouterServer,
org.openqa.selenium.grid.sessionmap.httpd.SessionMapServer;
}
9 changes: 8 additions & 1 deletion third_party/java/jetty/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ java_library(
# prebuilt_jar we avoid that problem.
prebuilt_jar(
name = "repackage",
binary_jar = ":bundle-jars",
binary_jar = ":strip-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 *"
)


java_binary(
name = "bundle-jars",
deps = [
Expand Down

0 comments on commit 49fb9d0

Please sign in to comment.