Skip to content

Commit

Permalink
feat(dev): add //build:dev-make-openresty target to invoke make
Browse files Browse the repository at this point in the history
directory for openresty build for development
  • Loading branch information
fffonion committed May 15, 2024
1 parent b906efc commit 57adeb4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ kong_install(
],
)

# Use this target when developing with nginx modules and want to
# avoid rebuilding a clean OpenResty every time.
kong_genrule(
name = "dev-make-openresty",
srcs = [
"@openresty//:dev-just-make",
],
outs = [
"openresty.dev.nop",
],
cmd = """
rm -rf ${BUILD_DESTDIR}/openresty
cp -r $(location @openresty//:dev-just-make) ${BUILD_DESTDIR}/openresty
chmod -R "u+rw" ${BUILD_DESTDIR}/openresty
touch ${BUILD_DESTDIR}/openresty.dev.nop
""",
visibility = ["//visibility:public"],
)

# Lua Libraries

lualib_deps = [
Expand Down
27 changes: 27 additions & 0 deletions build/openresty/BUILD.openresty.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,30 @@ configure_make(
"//conditions:default": [],
}),
)

genrule(
name = "dev-just-make",
srcs = [
"@lua-kong-nginx-module//:all_srcs",
"@lua-resty-events//:all_srcs",
"@lua-resty-lmdb//:all_srcs",
"@ngx_brotli//:all_srcs",
] + select({
"@kong//:wasmx_flag": [
"@ngx_wasmx_module//:all_srcs",
# wasm_runtime has to be a "data" (target) instead of "build_data" (exec)
# to be able to lookup by its path (relative to INSTALLDIR)
":wasm_runtime",
],
"//conditions:default": [],
}),
outs = ["dev-builddir"],
cmd = """
pushd $(RULEDIR)/openresty.build_tmpdir >/dev/null
make -j%s
make install
popd >/dev/null
cp -r $(RULEDIR)/openresty.build_tmpdir/openresty $@
""" % KONG_VAR["NPROC"],
visibility = ["//visibility:public"],
)

0 comments on commit 57adeb4

Please sign in to comment.