From f521478576b23f13ec6b7e02af3cd213a28a6091 Mon Sep 17 00:00:00 2001 From: Aapo Talvensaari Date: Thu, 30 May 2024 22:16:33 +0300 Subject: [PATCH] feat(deps): add ada - whatwg-compliant and fast url parser ### Summary Adds libada as a dependency. This is needed for: https://github.com/Kong/kong/pull/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 --- .requirements | 2 ++ build/BUILD.bazel | 5 +++-- build/openresty/ada/BUILD.bazel | 18 +++++++++++++++++ build/openresty/ada/ada_repositories.bzl | 20 +++++++++++++++++++ build/openresty/repositories.bzl | 2 ++ changelog/unreleased/kong/feat-add-ada.yml | 4 ++++ .../fixtures/amazonlinux-2-amd64.txt | 8 +++++++- .../fixtures/amazonlinux-2023-amd64.txt | 7 +++++++ .../fixtures/amazonlinux-2023-arm64.txt | 7 +++++++ .../fixtures/debian-10-amd64.txt | 7 +++++++ .../fixtures/debian-11-amd64.txt | 7 +++++++ .../fixtures/debian-12-amd64.txt | 7 +++++++ .../explain_manifest/fixtures/el7-amd64.txt | 7 +++++++ .../explain_manifest/fixtures/el8-amd64.txt | 7 +++++++ .../explain_manifest/fixtures/el9-amd64.txt | 7 +++++++ .../explain_manifest/fixtures/el9-arm64.txt | 7 +++++++ .../fixtures/ubuntu-20.04-amd64.txt | 7 +++++++ .../fixtures/ubuntu-22.04-amd64.txt | 7 +++++++ .../fixtures/ubuntu-22.04-arm64.txt | 7 +++++++ 19 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 build/openresty/ada/BUILD.bazel create mode 100644 build/openresty/ada/ada_repositories.bzl create mode 100644 changelog/unreleased/kong/feat-add-ada.yml diff --git a/.requirements b/.requirements index cb1e6e4b6f90..684734d555e4 100644 --- a/.requirements +++ b/.requirements @@ -8,6 +8,8 @@ OPENSSL=3.2.1 OPENSSL_SHA256=83c7329fe52c850677d75e5d0b0ca245309b97e8ecbcfdc1dfdc4ab9fac35b39 PCRE=10.43 PCRE_SHA256=889d16be5abb8d05400b33c25e151638b8d4bac0e2d9c76e9d6923118ae8a34e +ADA=2.8.0 +ADA_SHA256=b621bdc61655c44e018c936a925fe87a01b1aaa18ea199ed19738b123f600c6d LIBEXPAT=2.6.2 LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3 diff --git a/build/BUILD.bazel b/build/BUILD.bazel index 3af4f65ac45a..10e70e0ac432 100644 --- a/build/BUILD.bazel +++ b/build/BUILD.bazel @@ -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 ] diff --git a/build/openresty/ada/BUILD.bazel b/build/openresty/ada/BUILD.bazel new file mode 100644 index 000000000000..9a157965e6b3 --- /dev/null +++ b/build/openresty/ada/BUILD.bazel @@ -0,0 +1,18 @@ +cc_library( + name = "ada-lib", + srcs = ["ada.cpp"], + hdrs = [ + "ada.h", + "ada_c.h", + ], + copts = [ + "-std=c++17", + ], + linkstatic = True, +) + +cc_shared_library( + name = "ada", + visibility = ["//visibility:public"], + deps = [":ada-lib"], +) diff --git a/build/openresty/ada/ada_repositories.bzl b/build/openresty/ada/ada_repositories.bzl new file mode 100644 index 000000000000..a2d356d0abc5 --- /dev/null +++ b/build/openresty/ada/ada_repositories.bzl @@ -0,0 +1,20 @@ +"""A module defining the third party dependency Ada""" + +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", + ) diff --git a/build/openresty/repositories.bzl b/build/openresty/repositories.bzl index 0d992fd3fd99..2d32dd6f642b 100644 --- a/build/openresty/repositories.bzl +++ b/build/openresty/repositories.bzl @@ -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 = """ @@ -35,6 +36,7 @@ def openresty_repositories(): wasm_filters_repositories() brotli_repositories() snappy_repositories() + ada_repositories() openresty_version = KONG_VAR["OPENRESTY"] diff --git a/changelog/unreleased/kong/feat-add-ada.yml b/changelog/unreleased/kong/feat-add-ada.yml new file mode 100644 index 000000000000..891d77fa3dab --- /dev/null +++ b/changelog/unreleased/kong/feat-add-ada.yml @@ -0,0 +1,4 @@ +message: | + **Core**: Added Ada dependency - WHATWG-compliant and fast URL parser. +type: feature +scope: Core diff --git a/scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt b/scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt index b5e263650957..5ba74f91bb28 100644 --- a/scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt +++ b/scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 @@ -213,4 +220,3 @@ - libc.so.6 - ld-linux-x86-64.so.2 - libstdc++.so.6 - diff --git a/scripts/explain_manifest/fixtures/amazonlinux-2023-amd64.txt b/scripts/explain_manifest/fixtures/amazonlinux-2023-amd64.txt index b940c8e8889f..d7d18e034032 100644 --- a/scripts/explain_manifest/fixtures/amazonlinux-2023-amd64.txt +++ b/scripts/explain_manifest/fixtures/amazonlinux-2023-amd64.txt @@ -43,6 +43,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/amazonlinux-2023-arm64.txt b/scripts/explain_manifest/fixtures/amazonlinux-2023-arm64.txt index 193dd354ecd7..0bb9ad7e7b9b 100644 --- a/scripts/explain_manifest/fixtures/amazonlinux-2023-arm64.txt +++ b/scripts/explain_manifest/fixtures/amazonlinux-2023-arm64.txt @@ -45,6 +45,13 @@ - libc.so.6 Rpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libm.so.6 diff --git a/scripts/explain_manifest/fixtures/debian-10-amd64.txt b/scripts/explain_manifest/fixtures/debian-10-amd64.txt index 15367259a797..c144c0f9d98e 100644 --- a/scripts/explain_manifest/fixtures/debian-10-amd64.txt +++ b/scripts/explain_manifest/fixtures/debian-10-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/debian-11-amd64.txt b/scripts/explain_manifest/fixtures/debian-11-amd64.txt index 846b95ad5a6d..9edee73ea3dd 100644 --- a/scripts/explain_manifest/fixtures/debian-11-amd64.txt +++ b/scripts/explain_manifest/fixtures/debian-11-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/debian-12-amd64.txt b/scripts/explain_manifest/fixtures/debian-12-amd64.txt index 1ab0eabe5b16..3262495487bc 100644 --- a/scripts/explain_manifest/fixtures/debian-12-amd64.txt +++ b/scripts/explain_manifest/fixtures/debian-12-amd64.txt @@ -43,6 +43,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/el7-amd64.txt b/scripts/explain_manifest/fixtures/el7-amd64.txt index 2d8ff671eddd..f4460b588de2 100644 --- a/scripts/explain_manifest/fixtures/el7-amd64.txt +++ b/scripts/explain_manifest/fixtures/el7-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/el8-amd64.txt b/scripts/explain_manifest/fixtures/el8-amd64.txt index ca3351b3a11a..619ba39c7c2f 100644 --- a/scripts/explain_manifest/fixtures/el8-amd64.txt +++ b/scripts/explain_manifest/fixtures/el8-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/el9-amd64.txt b/scripts/explain_manifest/fixtures/el9-amd64.txt index 7457649228b5..fa6c869012ca 100644 --- a/scripts/explain_manifest/fixtures/el9-amd64.txt +++ b/scripts/explain_manifest/fixtures/el9-amd64.txt @@ -43,6 +43,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/el9-arm64.txt b/scripts/explain_manifest/fixtures/el9-arm64.txt index 193dd354ecd7..0bb9ad7e7b9b 100644 --- a/scripts/explain_manifest/fixtures/el9-arm64.txt +++ b/scripts/explain_manifest/fixtures/el9-arm64.txt @@ -45,6 +45,13 @@ - libc.so.6 Rpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libm.so.6 diff --git a/scripts/explain_manifest/fixtures/ubuntu-20.04-amd64.txt b/scripts/explain_manifest/fixtures/ubuntu-20.04-amd64.txt index 41172c077810..d4ff8c766aba 100644 --- a/scripts/explain_manifest/fixtures/ubuntu-20.04-amd64.txt +++ b/scripts/explain_manifest/fixtures/ubuntu-20.04-amd64.txt @@ -47,6 +47,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/ubuntu-22.04-amd64.txt b/scripts/explain_manifest/fixtures/ubuntu-22.04-amd64.txt index bee32048e1f7..8ac96a98c6c8 100644 --- a/scripts/explain_manifest/fixtures/ubuntu-22.04-amd64.txt +++ b/scripts/explain_manifest/fixtures/ubuntu-22.04-amd64.txt @@ -43,6 +43,13 @@ - libc.so.6 Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libstdc++.so.6 diff --git a/scripts/explain_manifest/fixtures/ubuntu-22.04-arm64.txt b/scripts/explain_manifest/fixtures/ubuntu-22.04-arm64.txt index 916b90bf1d39..87b1d8523871 100644 --- a/scripts/explain_manifest/fixtures/ubuntu-22.04-arm64.txt +++ b/scripts/explain_manifest/fixtures/ubuntu-22.04-arm64.txt @@ -31,6 +31,13 @@ - Path : /usr/local/kong/lib/engines-3/padlock.so Runpath : /usr/local/kong/lib +- Path : /usr/local/kong/lib/libada.so + Needed : + - libstdc++.so.6 + - libm.so.6 + - libgcc_s.so.1 + - libc.so.6 + - Path : /usr/local/kong/lib/libcrypto.so.3 Needed : - libc.so.6