@@ -2,6 +2,10 @@ load("@rules_jvm_external//:defs.bzl", "artifact")
2
2
load ("//java:defs.bzl" , "java_export" )
3
3
load ("//java:version.bzl" , "SE_VERSION" )
4
4
5
+ GENERATOR_SOURCES = [
6
+ "CdpClientGenerator.java" ,
7
+ ]
8
+
5
9
PROTOTYPE_SOURCES = [
6
10
"Command.java" ,
7
11
"ConverterFunctions.java" ,
@@ -12,9 +16,6 @@ PROTOTYPE_SOURCES = [
12
16
java_library (
13
17
name = "devtools-prototypes" ,
14
18
srcs = PROTOTYPE_SOURCES ,
15
- visibility = [
16
- "//java/client/src/org/openqa/selenium/tools/cdp:__pkg__" ,
17
- ],
18
19
deps = [
19
20
"//java/client/src/org/openqa/selenium:core" ,
20
21
"//java/client/src/org/openqa/selenium/json" ,
@@ -26,23 +27,62 @@ java_export(
26
27
name = "devtools" ,
27
28
srcs = glob (
28
29
["*.java" ],
29
- exclude = PROTOTYPE_SOURCES ,
30
+ exclude = PROTOTYPE_SOURCES + GENERATOR_SOURCES ,
30
31
),
31
32
maven_coordinates = "org.seleniumhq.selenium:selenium-devtools:%s" % SE_VERSION ,
32
33
pom_template = "//java/client/src/org/openqa/selenium:template-pom" ,
33
34
visibility = [
34
35
"//visibility:public" ,
35
36
],
36
37
exports = [
38
+ ":cdp" ,
37
39
":devtools-prototypes" ,
38
- "//java/client/src/org/openqa/selenium/tools/cdp" ,
39
40
],
40
41
deps = [
42
+ ":cdp" ,
41
43
":devtools-prototypes" ,
42
44
"//java/client/src/org/openqa/selenium:core" ,
43
45
"//java/client/src/org/openqa/selenium/json" ,
44
46
"//java/client/src/org/openqa/selenium/remote" ,
45
- "//java/client/src/org/openqa/selenium/tools/cdp" ,
47
+ artifact ("com.google.guava:guava" ),
48
+ ],
49
+ )
50
+
51
+ java_binary (
52
+ name = "cdp-client-generator" ,
53
+ srcs = GENERATOR_SOURCES ,
54
+ main_class = "org.openqa.selenium.devtools.CdpClientGenerator" ,
55
+ deps = [
56
+ "//java/client/src/org/openqa/selenium:core" ,
57
+ "//java/client/src/org/openqa/selenium/devtools:devtools-prototypes" ,
58
+ "//java/client/src/org/openqa/selenium/json" ,
59
+ artifact ("com.github.javaparser:javaparser-core" ),
60
+ artifact ("com.google.guava:guava" ),
61
+ ],
62
+ )
63
+
64
+ genrule (
65
+ name = "create-cdp-srcs" ,
66
+ srcs = [
67
+ "browser_protocol.json" ,
68
+ "js_protocol.json" ,
69
+ ],
70
+ outs = ["cdp.srcjar" ],
71
+ cmd = "$(location :cdp-client-generator) $@" ,
72
+ tools = [
73
+ ":cdp-client-generator" ,
74
+ ],
75
+ )
76
+
77
+ java_library (
78
+ name = "cdp" ,
79
+ srcs = [
80
+ ":create-cdp-srcs" ,
81
+ ],
82
+ deps = [
83
+ "//java/client/src/org/openqa/selenium:core" ,
84
+ "//java/client/src/org/openqa/selenium/devtools:devtools-prototypes" ,
85
+ "//java/client/src/org/openqa/selenium/json" ,
46
86
artifact ("com.google.guava:guava" ),
47
87
],
48
88
)
0 commit comments