diff --git a/build/BUILD.bazel b/build/BUILD.bazel index 05ea9aa880e0..f4ae1c96d293 100644 --- a/build/BUILD.bazel +++ b/build/BUILD.bazel @@ -1,6 +1,6 @@ load("@kong_bindings//:variables.bzl", "KONG_VAR") load("@bazel_skylib//lib:selects.bzl", "selects") -load("//build:build_system.bzl", "get_workspace_name", "kong_genrule", "kong_install", "kong_rules_group", "kong_template_file") +load("//build:build_system.bzl", "get_clib_deps", "get_workspace_name", "kong_genrule", "kong_install", "kong_rules_group", "kong_template_file") load("@kong//build/openresty/wasmx/filters:variables.bzl", "WASM_FILTERS_TARGETS") exports_files([ @@ -9,28 +9,24 @@ exports_files([ # C libraries -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", "@ada") else "kong", + prefix = "kong/lib" if k in get_clib_deps(select({ + "@kong//:ada_flag": True, + "//conditions:default": False, + })) else "kong", strip_path = "snappy" if k == "@snappy" else "ada" if k == "@ada" else "", ) - for k in clib_deps + for k in get_clib_deps() ] kong_rules_group( name = "install-clibs", propagates = [ ":install-%s" % get_workspace_name(k) - for k in clib_deps + for k in get_clib_deps() ], visibility = ["//visibility:public"], ) diff --git a/build/build_system.bzl b/build/build_system.bzl index 99796a0c030d..9cf6e3b7d277 100644 --- a/build/build_system.bzl +++ b/build/build_system.bzl @@ -355,3 +355,13 @@ kong_install = rule( def get_workspace_name(label): return label.replace("@", "").split("/")[0] + +def get_clib_deps(ada_flag): + base_deps = [ + "@openssl", + "@libexpat", + "@snappy", + ] + if ada_flag: + base_deps.append("@ada") + return base_deps