-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feature: remove lua
dir.
#1351
feature: remove lua
dir.
#1351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to update the t/APISIX.pm
too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@membphis @moonming This PR's code seems install the apisix
code in directory $PKG_ROOT/apisix/
, not $PKG_ROOT/
(I just use PKG_ROOT to represent the root package search path), is this right?
We should confirm which method is better.
I prefer treat apisix
as a regular rocks lib and the target to be installed in $PKG_ROOT
:
$ tree -L 1 deps/share/lua/5.1/
deps/share/lua/5.1/
├── apisix
├── apisix.lua
├── jsonschema
├── jsonschema.lua
├── net
├── opentracing
├── protoc.lua
├── resty
├── tinyyaml.lua
└── typeof.lua
Take this for example: the apisix.lua
and apisix
directory under this directory, not add a directory level named apisix
, which would look like:
deps/share/lua/5.1/
├── apisix
│ ├── apisix
│ └── apisix.lua
│......
bin/apisix
Outdated
local pkg_path = apisix_home .. "/deps/share/lua/5.1/apisix/lua/?.lua;" | ||
.. "/usr/local/share/lua/5.1/apisix/lua/?.lua;" | ||
local pkg_path = apisix_home .. "/deps/share/lua/5.1/apisix/?.lua;" | ||
.. "/usr/local/share/lua/5.1/apisix/?.lua;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All packages begin at apisix_home
, this line looks redundant.
I agree with you ^_^ |
Will this conflict with other luarocks libraries?
YuanSheng Wang <notifications@github.com>于2020年3月28日 周六下午12:58写道:
I prefer treat apisix as a regular rocks lib and the target to be
installed in $PKG_ROOT:
I agree with you ^_^
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJZBK55QXMASGQJBYRL4SDRJV7V5ANCNFSM4LU5SKRQ>
.
--
Thanks,
Ming Wen
Twitter: _WenMing
|
No conflict. |
5f46cb5
to
17f730a
Compare
How about |
good idea |
f0b1309
to
2f4f2f3
Compare
that's good.
88786912@qq.com
From: Wen Ming
Date: 2020-03-29 10:08
To: apache/incubator-apisix
CC: Subscribed
Subject: Re: [apache/incubator-apisix] [WIP]feature: remove `lua` dir. (#1351)
lua/apisix.lua → apisix.lua
How about lua/apisix.lua → apisix/init.lua ?
good idea
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
f290920
to
1e93f11
Compare
t/admin/balancer.t
Outdated
@@ -25,7 +25,7 @@ add_block_preprocessor(sub { | |||
|
|||
my $init_by_lua_block = <<_EOC_; | |||
require "resty.core" | |||
apisix = require("apisix") | |||
apisix = require("init") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, we should use the original name "apisix".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./?/init.lua;
is the standard Lua source code search path.
please take a look at this:
$ cat ../mm.patch
diff --git a/bin/apisix b/bin/apisix
index e27da893..c393536e 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -132,7 +132,7 @@ stream {
init_by_lua_block {
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
apisix.stream_init()
}
@@ -261,7 +261,7 @@ http {
init_by_lua_block {
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
local dns_resolver = { {% for _, dns_addr in ipairs(dns_resolver or {}) do %} "{*dns_addr*}", {% end %} }
local args = {
diff --git a/dashboard b/dashboard
index cfb3ee7b..5ce7c37c 160000
--- a/dashboard
+++ b/dashboard
@@ -1 +1 @@
-Subproject commit cfb3ee7b8721076975c1deaff3e52da3ea4a312a
+Subproject commit 5ce7c37c758f6365da042333d7909c12c0ab6714-dirty
diff --git a/t/APISIX.pm b/t/APISIX.pm
index e1a336a8..6b191524 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -107,7 +107,7 @@ _EOC_
my $stream_enable = $block->stream_enable;
my $stream_config = $block->stream_config // <<_EOC_;
- lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;;";
+ lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;";
lua_package_cpath "$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
lua_socket_log_errors off;
@@ -127,7 +127,7 @@ _EOC_
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
apisix.stream_init()
}
@@ -177,7 +177,7 @@ _EOC_
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
local args = {
dns_resolver = $dns_addrs_tbl_str,
}
@@ -186,7 +186,7 @@ _EOC_
my $http_config = $block->http_config // '';
$http_config .= <<_EOC_;
- lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;;";
+ lua_package_path "$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/apisix/?.lua;$apisix_home/t/?.lua;./?.lua;./?/init.lua;;";
lua_package_cpath "$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
lua_shared_dict plugin-limit-req 10m;
@@ -216,7 +216,7 @@ _EOC_
}
init_worker_by_lua_block {
- require("init").http_init_worker()
+ require("apisix").http_init_worker()
}
# fake server, only for test
diff --git a/t/admin/balancer.t b/t/admin/balancer.t
index d88f19bf..0be70dbd 100644
--- a/t/admin/balancer.t
+++ b/t/admin/balancer.t
@@ -25,7 +25,7 @@ add_block_preprocessor(sub {
my $init_by_lua_block = <<_EOC_;
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
apisix.http_init()
function test(route, ctx, count)
diff --git a/t/admin/health-check.t b/t/admin/health-check.t
index 1020a30d..8680768e 100644
--- a/t/admin/health-check.t
+++ b/t/admin/health-check.t
@@ -27,7 +27,7 @@ add_block_preprocessor(sub {
my $init_by_lua_block = <<_EOC_;
require "resty.core"
- apisix = require("init")
+ apisix = require("apisix")
apisix.http_init()
json = require("cjson.safe")
f53623e
to
5f9546d
Compare
@moonming you can make a try with this patch: diff --git a/bin/apisix b/bin/apisix
index e00e9af6..871de12d 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -39,9 +39,7 @@ local pkg_path_org = package.path
local apisix_home = "/usr/local/apisix"
local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
.. apisix_home .. "/deps/lib/lua/5.1/?.so;;"
-local pkg_path = apisix_home .. "/deps/share/lua/5.1/apisix/?.lua;"
- .. "/usr/local/share/lua/5.1/apisix/?.lua;"
- .. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
+local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;"
-- only for developer, use current folder as working space
local is_root_path = false
@@ -58,7 +56,7 @@ if script_path:sub(1, 2) == './' then
pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
.. apisix_home .. "/deps/lib/lua/5.1/?.so;"
- pkg_path = apisix_home .. "/apisix/?.lua;"
+ pkg_path = apisix_home .. "/?/init.lua;"
.. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
end
-- print("apisix_home: ", apisix_home)
@@ -114,7 +112,7 @@ env APISIX_PROFILE;
{% if stream_proxy then %}
stream {
lua_package_path "$prefix/deps/share/lua/5.1/?.lua;]=]
- .. [=[{*apisix_lua_home*}/apisix/?.lua;;{*lua_path*};";
+ .. [=[{*apisix_lua_home*}/?.lua;;{*lua_path*};";
lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;]=]
.. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
.. [=[{*lua_cpath*};";
@@ -167,7 +165,7 @@ stream {
http {
lua_package_path "$prefix/deps/share/lua/5.1/?.lua;]=]
- .. [=[{*apisix_lua_home*}/apisix/?.lua;;{*lua_path*};";
+ .. [=[{*apisix_lua_home*}/?.lua;;{*lua_path*};";
lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;]=]
.. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
.. [=[{*lua_cpath*};"; |
discuss thread: https://lists.apache.org/thread.html/r10155c0ba784c25de54bd8e19355e5f517cade98af006ed2ef69dd25%40%3Cdev.apisix.apache.org%3E