Skip to content

Commit e57914a

Browse files
committed
Introduce basic JPMS support
Because we build with and target java 8, we can't use the normal toolchain to compile `module-info` classes. One solution to this is to ask everyone to install the latest java toolchain and use that, but java 10 (which is the latest) isn't an LTS, so will go pretty soon. Instead, we use `javaparser` to read `module-info.java` files and then use the latest version of `byte buddy` to emit the correct class. To allow simple globbing of java classes, I've chosen to use a `.txt` file name ending for the module-info files. Once Java 11 ships and Buck supports it, we'll rejig the toolchain to remove this particular hack.
1 parent dff7251 commit e57914a

File tree

21 files changed

+459
-2
lines changed

21 files changed

+459
-2
lines changed

java/client/src/org/openqa/selenium/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# BUILD FILE SYNTAX: SKYLARK
22
load("//:selenium-version.bzl", "SE_VERSION")
3+
load("//java:rules.bzl", "java_library")
34

45
java_library(name = 'selenium',
56
exported_deps = [
@@ -22,6 +23,7 @@ java_library(
2223
name = 'core',
2324
maven_coords = 'org.seleniumhq.selenium:selenium-api:' + SE_VERSION,
2425
maven_pom_template = ':template-pom',
26+
module_info = 'module-info.txt',
2527
srcs = glob([
2628
'*.java',
2729
'html5/*.java',

java/client/src/org/openqa/selenium/chrome/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# BUILD FILE SYNTAX: SKYLARK
22
load("//:selenium-version.bzl", "SE_VERSION")
3+
load("//java:rules.bzl", "java_library")
34

45
java_library(
56
name = 'chrome',
67
maven_coords = 'org.seleniumhq.selenium:selenium-chrome-driver:' + SE_VERSION,
78
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
9+
module_info = 'module-info.txt',
810
srcs = glob(['*.java']),
911
exported_deps = [
1012
'//java/client/src/org/openqa/selenium/remote:remote',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
module org.openqa.selenium.chrome {
19+
requires transitive com.google.common;
20+
requires transitive org.openqa.selenium.core;
21+
requires transitive org.openqa.selenium.remote;
22+
23+
exports org.openqa.selenium.chrome;
24+
25+
provides org.openqa.selenium.remote.service.DriverService$Builder with
26+
org.openqa.selenium.chrome.ChromeDriverService$Builder;
27+
28+
}

java/client/src/org/openqa/selenium/edge/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# BUILD FILE SYNTAX: SKYLARK
22
load("//:selenium-version.bzl", "SE_VERSION")
3+
load("//java:rules.bzl", "java_library")
34

45
java_library(
56
name = 'edge',
67
maven_coords = 'org.seleniumhq.selenium:selenium-edge-driver:' + SE_VERSION,
78
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
9+
module_info = 'module-info.txt',
810
srcs = glob(['*.java']),
911
exported_deps = [
1012
'//java/client/src/org/openqa/selenium/remote:remote',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
module org.openqa.selenium.edge {
19+
requires transitive com.google.common;
20+
requires transitive org.openqa.selenium.core;
21+
requires transitive org.openqa.selenium.remote;
22+
23+
exports org.openqa.selenium.edge;
24+
25+
provides org.openqa.selenium.remote.service.DriverService$Builder with
26+
org.openqa.selenium.edge.EdgeDriverService$Builder;
27+
28+
}

java/client/src/org/openqa/selenium/firefox/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# BUILD FILE SYNTAX: SKYLARK
22
load("//:selenium-version.bzl", "SE_VERSION")
3+
load("//java:rules.bzl", "java_library")
34

45
java_library(name = 'firefox',
56
maven_coords = 'org.seleniumhq.selenium:selenium-firefox-driver:jar:' + SE_VERSION,
67
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
8+
module_info = "module-info.txt",
79
srcs = glob(['*.java', 'internal/*.java']),
810
resources = [
911
':amd64',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
module org.openqa.selenium.firefox {
19+
requires java.xml;
20+
21+
requires transitive com.google.common;
22+
requires transitive java.logging;
23+
requires transitive org.openqa.selenium.core;
24+
requires transitive org.openqa.selenium.remote;
25+
26+
exports org.openqa.selenium.firefox;
27+
exports org.openqa.selenium.firefox.internal;
28+
29+
provides org.openqa.selenium.remote.service.DriverService$Builder with
30+
org.openqa.selenium.firefox.GeckoDriverService$Builder,
31+
org.openqa.selenium.firefox.XpiDriverService$Builder;
32+
33+
}

java/client/src/org/openqa/selenium/ie/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# BUILD FILE SYNTAX: SKYLARK
22
load("//:selenium-version.bzl", "SE_VERSION")
3+
load("//java:rules.bzl", "java_library")
34

45
java_library(name = 'ie',
56
maven_coords = 'org.seleniumhq.selenium:selenium-ie-driver:' + SE_VERSION,
67
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
8+
module_info = 'module-info.txt',
79
srcs = glob(['*.java']),
810
exported_deps = [
911
'//java/client/src/org/openqa/selenium/remote:remote',
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
module org.openqa.selenium.ie {
19+
requires transitive com.google.common;
20+
requires transitive org.openqa.selenium.core;
21+
requires transitive org.openqa.selenium.remote;
22+
23+
exports org.openqa.selenium.ie;
24+
25+
provides org.openqa.selenium.remote.service.DriverService$Builder with
26+
org.openqa.selenium.ie.InternetExplorerDriverService$Builder;
27+
28+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
module org.openqa.selenium.core {
19+
requires transitive java.logging;
20+
21+
exports org.openqa.selenium;
22+
exports org.openqa.selenium.html5;
23+
exports org.openqa.selenium.interactions;
24+
exports org.openqa.selenium.interactions.internal;
25+
exports org.openqa.selenium.interactions.touch;
26+
exports org.openqa.selenium.internal;
27+
exports org.openqa.selenium.logging;
28+
exports org.openqa.selenium.logging.profiler;
29+
exports org.openqa.selenium.mobile;
30+
31+
}

0 commit comments

Comments
 (0)