Skip to content

Commit

Permalink
[java] Moving legacy Firefox driver to a separate package to make Jav…
Browse files Browse the repository at this point in the history
…a 9 module system happy
  • Loading branch information
barancev committed Nov 16, 2018
1 parent 017f2c7 commit 88e056c
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ JAVA_RELEASE_TARGETS = [
'//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/firefox:firefox-legacy',
'//java/client/src/org/openqa/selenium/firefox/xpi:firefox-xpi',
'//java/client/src/org/openqa/selenium/ie:ie',
'//java/client/src/org/openqa/selenium/lift:lift',
'//java/client/src/org/openqa/selenium/opera:opera',
Expand Down
4 changes: 2 additions & 2 deletions cpp/prebuilt/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export_file(
src = 'i386/libnoblur.so',
visibility = [
'//dotnet/src/webdriver:webdriver_deps',
'//java/client/src/org/openqa/selenium/firefox:i386',
'//java/client/src/org/openqa/selenium/firefox/xpi:i386',
],
)

Expand All @@ -14,7 +14,7 @@ export_file(
src = 'amd64/libnoblur64.so',
visibility = [
'//dotnet/src/webdriver:webdriver_deps',
'//java/client/src/org/openqa/selenium/firefox:amd64',
'//java/client/src/org/openqa/selenium/firefox/xpi:amd64',
],
)

2 changes: 1 addition & 1 deletion java/client/src/org/openqa/selenium/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ java_library(
':selenium',
'//java/client/src/org/openqa/selenium/chrome:chrome',
'//java/client/src/org/openqa/selenium/firefox:firefox',
'//java/client/src/org/openqa/selenium/firefox:firefox-legacy',
'//java/client/src/org/openqa/selenium/firefox/xpi:firefox-xpi',
'//java/client/src/org/openqa/selenium/edge:edge',
'//java/client/src/org/openqa/selenium/ie:ie',
'//java/client/src/org/openqa/selenium/opera:opera',
Expand Down
54 changes: 1 addition & 53 deletions java/client/src/org/openqa/selenium/firefox/BUCK
Original file line number Diff line number Diff line change
@@ -1,47 +1,11 @@
load("//:selenium-version.bzl", "SE_VERSION")
load("//java:rules.bzl", "java_library")

LEGACY_SOURCES = [
'XpiDriverInfo.java',
'XpiDriverService.java',
]

java_library(name = 'firefox-legacy',
maven_coords = 'org.seleniumhq.selenium:selenium-firefox-legacy-driver:jar:' + SE_VERSION,
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
module_info = "module-info-legacy.txt",
srcs = LEGACY_SOURCES,
resources = [
':amd64',
':i386',
':webdriver.xpi',
],
exported_deps = [
'//java/client/src/org/openqa/selenium/remote:remote',
],
provided_deps = [
'//third_party/java/service:auto-service',
],
annotation_processor_deps = [
'//third_party/java/auto:auto-common',
'//third_party/java/service:auto-service',
'//third_party/java/guava:guava',
],
annotation_processors = [
'com.google.auto.service.processor.AutoServiceProcessor',
],
deps = [
':firefox',
'//third_party/java/guava:guava',
],
visibility = [ 'PUBLIC' ],
)

java_library(name = 'firefox',
maven_coords = 'org.seleniumhq.selenium:selenium-firefox-driver:jar:' + SE_VERSION,
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
module_info = "module-info.txt",
srcs = glob(['*.java'], exclude = LEGACY_SOURCES),
srcs = glob(['*.java']),
resources = [
':prefs',
],
Expand Down Expand Up @@ -69,19 +33,3 @@ export_file(name = 'prefs',
src = '//javascript/firefox-driver:webdriver_prefs',
out = 'webdriver_prefs.json',
)

export_file(name = 'webdriver.xpi',
src = '//javascript/firefox-driver:webdriver',
)

export_file(
name = 'i386',
src = '//cpp/prebuilt:noblur32',
out = 'x86/x_ignore_nofocus.so'
)

export_file(
name = 'amd64',
src = '//cpp/prebuilt:noblur64',
out = 'amd64/x_ignore_nofocus.so'
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import java.io.OutputStream;
import java.net.URL;

class ClasspathExtension implements Extension {
public class ClasspathExtension implements Extension {
private final Class<?> loadResourcesUsing;
private final String loadFrom;

ClasspathExtension(Class<?> loadResourcesUsing, String loadFrom) {
public ClasspathExtension(Class<?> loadResourcesUsing, String loadFrom) {
this.loadResourcesUsing = loadResourcesUsing;
this.loadFrom = loadFrom;
}
Expand Down
2 changes: 1 addition & 1 deletion java/client/src/org/openqa/selenium/firefox/Extension.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
import java.io.File;
import java.io.IOException;

interface Extension {
public interface Extension {
void writeTo(File parentDirectory) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

class FileExtension implements Extension {
public class FileExtension implements Extension {
private static final String EM_NAMESPACE_URI = "http://www.mozilla.org/2004/em-rdf#";

private final File toInstall;

FileExtension(File toInstall) {
public FileExtension(File toInstall) {
this.toInstall = toInstall;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ void amendOptions(FirefoxOptions options) {
options.addArguments(extraOptions);
}

protected File getFile() {
public File getFile() {
return executable.getFile();
}

protected String getPath() {
public String getPath() {
return executable.getPath();
}

protected List<String> getExtraOptions() {
public List<String> getExtraOptions() {
return extraOptions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public static FirefoxProfile fromJson(String json) throws IOException {
"duplicated"));
}

protected void cleanTemporaryModel() {
public void cleanTemporaryModel() {
clean(model);
}

Expand Down
49 changes: 49 additions & 0 deletions java/client/src/org/openqa/selenium/firefox/xpi/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
load("//:selenium-version.bzl", "SE_VERSION")
load("//java:rules.bzl", "java_library")

java_library(name = 'firefox-xpi',
maven_coords = 'org.seleniumhq.selenium:selenium-firefox-xpi-driver:jar:' + SE_VERSION,
maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
module_info = "module-info.txt",
srcs = glob(['*.java']),
resources = [
':amd64',
':i386',
':webdriver.xpi',
],
exported_deps = [
'//java/client/src/org/openqa/selenium/remote:remote',
],
provided_deps = [
'//third_party/java/service:auto-service',
],
annotation_processor_deps = [
'//third_party/java/auto:auto-common',
'//third_party/java/service:auto-service',
'//third_party/java/guava:guava',
],
annotation_processors = [
'com.google.auto.service.processor.AutoServiceProcessor',
],
deps = [
'//java/client/src/org/openqa/selenium/firefox:firefox',
'//third_party/java/guava:guava',
],
visibility = [ 'PUBLIC' ],
)

export_file(name = 'webdriver.xpi',
src = '//javascript/firefox-driver:webdriver',
)

export_file(
name = 'i386',
src = '//cpp/prebuilt:noblur32',
out = 'x86/x_ignore_nofocus.so'
)

export_file(
name = 'amd64',
src = '//cpp/prebuilt:noblur64',
out = 'amd64/x_ignore_nofocus.so'
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.firefox;
package org.openqa.selenium.firefox.xpi;

import static org.openqa.selenium.firefox.FirefoxDriver.MARIONETTE;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
Expand All @@ -28,6 +28,8 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebDriverInfo;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.BrowserType;

import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.firefox;
package org.openqa.selenium.firefox.xpi;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.openqa.selenium.firefox.FirefoxOptions.FIREFOX_OPTIONS;
Expand All @@ -31,6 +31,14 @@
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.firefox.ClasspathExtension;
import org.openqa.selenium.firefox.Extension;
import org.openqa.selenium.firefox.FileExtension;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriverService;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.io.FileHandler;
import org.openqa.selenium.net.UrlChecker;
import org.openqa.selenium.os.CommandLine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

module org.openqa.selenium.firefox {
module org.openqa.selenium.firefox.xpi {
requires java.xml;

requires transitive com.google.common;
Expand All @@ -26,9 +26,9 @@ module org.openqa.selenium.firefox {
exports org.openqa.selenium.firefox;

provides org.openqa.selenium.remote.service.DriverService$Builder with
org.openqa.selenium.firefox.XpiDriverService$Builder;
org.openqa.selenium.firefox.xpi.XpiDriverService$Builder;

provides org.openqa.selenium.WebDriverInfo with
org.openqa.selenium.firefox.XpiDriverInfo;
org.openqa.selenium.firefox.xpi.XpiDriverInfo;

}
1 change: 1 addition & 0 deletions java/client/test/org/openqa/selenium/firefox/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ java_library(name = 'tests',
deps = [
'//java/client/src/org/openqa/selenium:selenium',
'//java/client/src/org/openqa/selenium/firefox:firefox',
'//java/client/src/org/openqa/selenium/firefox/xpi:firefox-xpi',
'//java/client/src/org/openqa/selenium/remote:remote',
'//java/client/src/org/openqa/selenium/support/ui:wait',
'//java/client/test/org/openqa/selenium:tests',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.openqa.selenium.ParallelTestRunner.Worker;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.xpi.XpiDriverService;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.Command;
import org.openqa.selenium.remote.CommandExecutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ActiveSessionFactory() {

return marionette instanceof Boolean && !(Boolean) marionette;
},
"org.openqa.selenium.firefox.XpiDriverService")
"org.openqa.selenium.firefox.xpi.XpiDriverService")
.put(browserName(CHROME), "org.openqa.selenium.chrome.ChromeDriverService")
.put(containsKey("chromeOptions"), "org.openqa.selenium.chrome.ChromeDriverService")
.put(browserName(EDGE), "org.openqa.selenium.edge.EdgeDriverService")
Expand Down
3 changes: 2 additions & 1 deletion javascript/firefox-driver/BUCK
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


export_file(name = 'webdriver_prefs',
src = 'webdriver.json',
visibility = [
Expand Down Expand Up @@ -36,7 +37,7 @@ mozilla_extension(name = 'webdriver',
chrome = 'extension/chrome.manifest',
install = 'extension/install.rdf',
visibility = [
'PUBLIC',
'//java/client/src/org/openqa/selenium/firefox/xpi:webdriver.xpi',
]
)

Expand Down

0 comments on commit 88e056c

Please sign in to comment.