Skip to content

Commit

Permalink
feat(deps): add ada - whatwg-compliant and fast URL parser
Browse files Browse the repository at this point in the history
### Summary

Adds libada as a dependency.

This is needed for:
#12758

But it may be great for many other uses too.

The `lua-resty-ada` LuaJIT FFI bindings can be found here:
https://github.com/bungle/lua-resty-ada

Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle committed May 30, 2024
1 parent ffb5ce1 commit 7af3355
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ OPENSSL=3.2.1
OPENSSL_SHA256=83c7329fe52c850677d75e5d0b0ca245309b97e8ecbcfdc1dfdc4ab9fac35b39
PCRE=10.43
PCRE_SHA256=889d16be5abb8d05400b33c25e151638b8d4bac0e2d9c76e9d6923118ae8a34e
ADA=2.7.8
ADA_SHA256=584faf94049e1e7eaae005e58841092893cd5051a13c8b7cbe7e19510bacc705
LIBEXPAT=2.6.2
LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3

Expand Down
5 changes: 3 additions & 2 deletions build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ clib_deps = [
"@openssl",
"@libexpat",
"@snappy",
"@ada",
]

[
kong_install(
name = "install-%s" % get_workspace_name(k),
src = k,
prefix = "kong/lib" if k in ("@passwdqc", "@snappy") else "kong",
strip_path = "snappy" if k == "@snappy" else "",
prefix = "kong/lib" if k in ("@passwdqc", "@snappy", "@ada") else "kong",
strip_path = "snappy" if k == "@snappy" else "ada" if k == "@ada" else "",
)
for k in clib_deps
]
Expand Down
18 changes: 18 additions & 0 deletions build/openresty/ada/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cc_library(

Check failure on line 1 in build/openresty/ada/BUILD.bazel

View workflow job for this annotation

GitHub Actions / Auto-format and Check

Please run buildifier. diff --git a/build/openresty/ada/BUILD.bazel b/build/openresty/ada/BUILD.bazel index 7be0b40..9a15796 100644 --- a/build/openresty/ada/BUILD.bazel +++ b/build/openresty/ada/BUILD.bazel @@ -13,6 +13,6 @@ cc_library( cc_shared_library( name = "ada", - deps = [":ada-lib"], visibility = ["//visibility:public"], + deps = [":ada-lib"], )
name = "ada-lib",
srcs = ["ada.cpp"],
hdrs = [
"ada.h",
"ada_c.h",
],
copts = [
"-std=c++17",
],
linkstatic = True,
)

cc_shared_library(
name = "ada",
deps = [":ada-lib"],
visibility = ["//visibility:public"],
)
20 changes: 20 additions & 0 deletions build/openresty/ada/ada_repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""A module defining the third party dependency Ada"""

Check failure on line 1 in build/openresty/ada/ada_repositories.bzl

View workflow job for this annotation

GitHub Actions / Auto-format and Check

Please run buildifier. diff --git a/build/openresty/ada/ada_repositories.bzl b/build/openresty/ada/ada_repositories.bzl index 3ea2c9c..a2d356d 100644 --- a/build/openresty/ada/ada_repositories.bzl +++ b/build/openresty/ada/ada_repositories.bzl @@ -15,6 +15,6 @@ def ada_repositories(): sha256 = KONG_VAR["ADA_SHA256"], url = "https://github.com/ada-url/ada/releases/download/v" + version + "/singleheader.zip", type = "zip", - visibility = ["//visibility:public"], # let this to be referenced by openresty build + visibility = ["//visibility:public"], # let this to be referenced by openresty build build_file = "//build/openresty/ada:BUILD.bazel", )

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@kong_bindings//:variables.bzl", "KONG_VAR")

def ada_repositories():
"""Defines the ada repository"""

version = KONG_VAR["ADA"]

maybe(
http_archive,
name = "ada",
sha256 = KONG_VAR["ADA_SHA256"],
url = "https://github.com/ada-url/ada/releases/download/v" + version + "/singleheader.zip",
type = "zip",
visibility = ["//visibility:public"], # let this to be referenced by openresty build
build_file = "//build/openresty/ada:BUILD.bazel",
)
2 changes: 2 additions & 0 deletions build/openresty/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load("//build/openresty/wasmx:wasmx_repositories.bzl", "wasmx_repositories")
load("//build/openresty/wasmx/filters:repositories.bzl", "wasm_filters_repositories")
load("//build/openresty/brotli:brotli_repositories.bzl", "brotli_repositories")
load("//build/openresty/snappy:snappy_repositories.bzl", "snappy_repositories")
load("//build/openresty/ada:ada_repositories.bzl", "ada_repositories")

# This is a dummy file to export the module's repository.
_NGINX_MODULE_DUMMY_FILE = """
Expand All @@ -35,6 +36,7 @@ def openresty_repositories():
wasm_filters_repositories()
brotli_repositories()
snappy_repositories()
ada_repositories()

openresty_version = KONG_VAR["OPENRESTY"]

Expand Down

0 comments on commit 7af3355

Please sign in to comment.