Repository navigation
[java] publish selenium-devtools-latest alias artifact #17492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
java/src/org/openqa/selenium/devtools/latest/BUILD.bazel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| load("@rules_jvm_external//:defs.bzl", "artifact") | ||
| load("//common:defs.bzl", "copy_file") | ||
| load("//java:defs.bzl", "java_export", "java_library") | ||
| load("//java:version.bzl", "SE_VERSION") | ||
| load("//java/src/org/openqa/selenium/devtools:versions.bzl", "LATEST_CDP_VERSION") | ||
|
|
||
| # Publishes the most recent supported CDP version under the stable | ||
| # `org.openqa.selenium.devtools.latest` package, so downstream consumers can | ||
| # depend on a single coordinate that always tracks the newest CDP release | ||
| # instead of bumping their pom each time Chrome ships a new major version. | ||
| cdp_version = "latest" | ||
|
|
||
| java_export( | ||
| name = cdp_version, | ||
| srcs = [":create-shim-srcs"], | ||
| maven_coordinates = "org.seleniumhq.selenium:selenium-devtools-%s:%s" % (cdp_version, SE_VERSION), | ||
| opens_to = [ | ||
| "org.seleniumhq.selenium.json", | ||
| ], | ||
| pom_template = "//java/src/org/openqa/selenium:template-pom", | ||
| tags = [ | ||
| "release-artifact", | ||
| ], | ||
| visibility = [ | ||
| "//visibility:public", | ||
| ], | ||
| exports = [ | ||
| ":cdp", | ||
| ], | ||
| deps = [ | ||
| ":cdp", | ||
| "//java:auto-service", | ||
| "//java/src/org/openqa/selenium:core", | ||
| "//java/src/org/openqa/selenium/json", | ||
| "//java/src/org/openqa/selenium/remote", | ||
| artifact("org.jspecify:jspecify"), | ||
| ], | ||
| ) | ||
|
|
||
| java_library( | ||
| name = "cdp", | ||
| srcs = [ | ||
| ":create-cdp-srcs", | ||
| ], | ||
| tags = [ | ||
| "no-lint", | ||
| ], | ||
| deps = [ | ||
| "//java/src/org/openqa/selenium:core", | ||
| "//java/src/org/openqa/selenium/json", | ||
| "//java/src/org/openqa/selenium/remote", | ||
| artifact("org.jspecify:jspecify"), | ||
| ], | ||
| ) | ||
|
|
||
| genrule( | ||
| name = "create-cdp-srcs", | ||
| srcs = [ | ||
| ":browser_protocol", | ||
| ":js_protocol", | ||
| ], | ||
| outs = ["cdp.srcjar"], | ||
| cmd = "$(location //java/src/org/openqa/selenium/devtools:cdp-client-generator) $(location :browser_protocol) $(location :js_protocol) %s $@" % cdp_version, | ||
| tools = [ | ||
| "//java/src/org/openqa/selenium/devtools:cdp-client-generator", | ||
| ], | ||
| ) | ||
|
|
||
| copy_file( | ||
| name = "browser_protocol", | ||
| src = "//common/devtools/chromium/%s:browser_protocol" % LATEST_CDP_VERSION, | ||
| out = "browser_protocol.json", | ||
| ) | ||
|
|
||
| copy_file( | ||
| name = "js_protocol", | ||
| src = "//common/devtools/chromium/%s:js_protocol" % LATEST_CDP_VERSION, | ||
| out = "js_protocol.json", | ||
| ) | ||
|
|
||
| # Derives the hand-written shim classes for the "latest" alias by rewriting | ||
| # every occurrence of the latest CDP version slug (e.g. "v148") to "latest" | ||
| # in the corresponding files from that version's package. This keeps the | ||
| # alias in lockstep with the newest version without any source duplication. | ||
| genrule( | ||
| name = "create-shim-srcs", | ||
| srcs = ["//java/src/org/openqa/selenium/devtools/%s:shim-sources" % LATEST_CDP_VERSION], | ||
| outs = [ | ||
| "latestCdpInfo.java", | ||
| "latestDomains.java", | ||
| "latestEvents.java", | ||
| "latestJavascript.java", | ||
| "latestLog.java", | ||
| "latestNetwork.java", | ||
| "latestTarget.java", | ||
| "package-info.java", | ||
| ], | ||
| cmd = ("for src in $(SRCS); do " + | ||
| "base=$$(basename $$src); " + | ||
| "out=$$(echo $$base | sed -e 's/" + LATEST_CDP_VERSION + "/latest/g'); " + | ||
| "sed -e 's/" + LATEST_CDP_VERSION + "/latest/g' $$src > $(RULEDIR)/$$out; " + | ||
| "done"), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Nondeterministic cdp provider
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools