Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "lua: allow using moonjit (#10265)" #14603

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions bazel/foreign_cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,6 @@ configure_make(
}),
)

configure_make(
name = "moonjit",
configure_command = "build.py",
configure_env_vars = select({
# This shouldn't be needed! See
# https://github.com/envoyproxy/envoy/issues/6084
# TODO(htuch): Remove when #6084 is fixed
"//bazel:asan_build": {"ENVOY_CONFIG_ASAN": "1"},
"//bazel:msan_build": {"ENVOY_CONFIG_MSAN": "1"},
"//conditions:default": {},
}),
lib_source = "@com_github_moonjit_moonjit//:all",
make_commands = [],
out_include_dir = "include/moonjit-2.2",
static_libraries = ["libluajit-5.1.a"],
tags = ["skip_on_windows"],
)

envoy_cmake_external(
name = "ares",
cache_entries = {
Expand Down
89 changes: 0 additions & 89 deletions bazel/foreign_cc/moonjit.patch

This file was deleted.

15 changes: 0 additions & 15 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def envoy_dependencies(skip_targets = []):
_com_github_jbeder_yaml_cpp()
_com_github_libevent_libevent()
_com_github_luajit_luajit()
_com_github_moonjit_moonjit()
_com_github_nghttp2_nghttp2()
_com_github_nodejs_http_parser()
_com_github_tencent_rapidjson()
Expand Down Expand Up @@ -812,20 +811,6 @@ def _com_github_luajit_luajit():
actual = "@envoy//bazel/foreign_cc:luajit",
)

def _com_github_moonjit_moonjit():
external_http_archive(
name = "com_github_moonjit_moonjit",
build_file_content = BUILD_ALL_CONTENT,
patches = ["@envoy//bazel/foreign_cc:moonjit.patch"],
patch_args = ["-p1"],
patch_cmds = ["chmod u+x build.py"],
)

native.bind(
name = "moonjit",
actual = "@envoy//bazel/foreign_cc:moonjit",
)

def _com_github_google_tcmalloc():
external_http_archive(
name = "com_github_google_tcmalloc",
Expand Down
13 changes: 0 additions & 13 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,6 @@ REPOSITORY_LOCATIONS_SPEC = dict(
extensions = ["envoy.filters.http.lua"],
cpe = "cpe:2.3:a:luajit:luajit:*",
),
com_github_moonjit_moonjit = dict(
project_name = "Moonjit",
project_desc = "LuaJIT fork with wider platform support",
project_url = "https://github.com/moonjit/moonjit",
version = "2.2.0",
sha256 = "83deb2c880488dfe7dd8ebf09e3b1e7613ef4b8420de53de6f712f01aabca2b6",
strip_prefix = "moonjit-{version}",
urls = ["https://github.com/moonjit/moonjit/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],
extensions = ["envoy.filters.http.lua"],
release_date = "2020-01-14",
cpe = "cpe:2.3:a:moonjit_project:moonjit:*",
),
com_github_nghttp2_nghttp2 = dict(
project_name = "Nghttp2",
project_desc = "Implementation of HTTP/2 and its header compression algorithm HPACK in Cimplementation of HTTP/2 and its header compression algorithm HPACK in C",
Expand Down
8 changes: 3 additions & 5 deletions docs/root/configuration/http/http_filters/lua_filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ and response flows. `LuaJIT <https://luajit.org/>`_ is used as the runtime. Beca
supported Lua version is mostly 5.1 with some 5.2 features. See the `LuaJIT documentation
<https://luajit.org/extensions.html>`_ for more details.

.. note::

`moonjit <https://github.com/moonjit/moonjit/>`_ is a continuation of LuaJIT development, which
supports more 5.2 features and additional architectures. Envoy can be built with moonjit support
by using the following bazel option: ``--//source/extensions/filters/common/lua:moonjit=1``.
The filter only supports loading Lua code in-line in the configuration. If local filesystem code
is desired, a trivial in-line script can be used to load the rest of the code from the local
environment.

The design of the filter and Lua support at a high level is as follows:

Expand Down
24 changes: 5 additions & 19 deletions source/extensions/filters/common/lua/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,26 @@ load(
"envoy_cc_library",
"envoy_extension_package",
)
load("//bazel:envoy_internal.bzl", "envoy_external_dep_path")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

licenses(["notice"]) # Apache 2

envoy_extension_package()

bool_flag(
name = "moonjit",
build_setting_default = False,
)

config_setting(
name = "with_moonjit",
flag_values = {
":moonjit": "True",
},
)

envoy_cc_library(
name = "lua_lib",
srcs = ["lua.cc"],
hdrs = ["lua.h"],
external_deps = [
"luajit",
],
deps = [
"//include/envoy/thread_local:thread_local_interface",
"//source/common/common:assert_lib",
"//source/common/common:c_smart_ptr_lib",
"//source/common/common:lock_guard_lib",
"//source/common/common:thread_lib",
"//source/common/common:c_smart_ptr_lib",
"//source/common/protobuf",
] + select({
":with_moonjit": [envoy_external_dep_path("moonjit")],
"//conditions:default": [envoy_external_dep_path("luajit")],
}),
],
)

envoy_cc_library(
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/common/lua/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "common/common/c_smart_ptr.h"
#include "common/common/logger.h"

#include "lua.hpp"
#include "luajit-2.1/lua.hpp"

namespace Envoy {
namespace Extensions {
Expand Down