diff --git a/build/luarocks/BUILD.luarocks.bazel b/build/luarocks/BUILD.luarocks.bazel index 658066651c8..17f8f6fa1c4 100644 --- a/build/luarocks/BUILD.luarocks.bazel +++ b/build/luarocks/BUILD.luarocks.bazel @@ -140,12 +140,21 @@ EOF visibility = ["//visibility:public"], ) +genrule( + name = "prepare_lua_messagepack", + srcs = ["@lua_messagepack_src//file"], + outs = ["lua-messagepack-0.5.2-1.src.rock"], + cmd = "cp $(location @lua_messagepack_src//file) $@", + visibility = ["//visibility:public"], +) + genrule( name = "luarocks_make", srcs = [ "@kong//:rockspec_srcs", ":luarocks_exec", ":luarocks_target", # to avoid concurrency issue, run this after luarocks_target + ":prepare_lua_messagepack", ], outs = ["luarocks_make.log"], cmd = """ @@ -160,7 +169,10 @@ genrule( # alias LDOC command to true(1) command export LDOC=true - $(location :luarocks_exec) make --no-doc 2>&1 >$@.tmp + # Install lua-messagepack + $(location :luarocks_exec) install $(location :prepare_lua_messagepack) >>$@.tmp 2>&1 + + $(location :luarocks_exec) make --no-doc >>$@.tmp 2>&1 # only generate the output when the command succeeds mv $@.tmp $@ diff --git a/build/luarocks/luarocks_repositories.bzl b/build/luarocks/luarocks_repositories.bzl index de37ea9ee07..fcf3f265089 100644 --- a/build/luarocks/luarocks_repositories.bzl +++ b/build/luarocks/luarocks_repositories.bzl @@ -1,6 +1,6 @@ """A module defining the third party dependency luarocks""" -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@kong_bindings//:variables.bzl", "KONG_VAR") @@ -17,3 +17,11 @@ def luarocks_repositories(): "https://luarocks.org/releases/luarocks-" + version + ".tar.gz", ], ) + + http_file( + name = "lua_messagepack_src", + urls = [ + "https://luarocks.org/manifests/fperrad/lua-messagepack-0.5.2-1.src.rock", + ], + sha256 = "cbb1b7b12834b7f49fd20621446ec4d76eff67d324b8182b7988324b10830a43", + )