summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-11 00:50:22 +0800
committerruki <[email protected]>2026-08-11 00:50:22 +0800
commitc7e176a0674d67e4c6440f2234f730b4ab234c18 (patch)
tree845dd323b31527f439aa013d8a5832525dd02a67
parentd699ee8188196a7e77bc1e2912f9b5dc6bd47416 (diff)
rename to set_sourcedir
-rw-r--r--tests/actions/addon/demo-addon/addon.lua2
-rw-r--r--tests/actions/addon/test.lua2
-rw-r--r--xmake/core/package/addon.lua16
3 files changed, 10 insertions, 10 deletions
diff --git a/tests/actions/addon/demo-addon/addon.lua b/tests/actions/addon/demo-addon/addon.lua
index b676f95ba..546c6a7aa 100644
--- a/tests/actions/addon/demo-addon/addon.lua
+++ b/tests/actions/addon/demo-addon/addon.lua
@@ -1,3 +1,3 @@
addon("demo-addon")
set_description("the demo addon of the tests")
- set_srcdir("src")
+ set_sourcedir("src")
diff --git a/tests/actions/addon/test.lua b/tests/actions/addon/test.lua
index 3929ebb73..a72cc4236 100644
--- a/tests/actions/addon/test.lua
+++ b/tests/actions/addon/test.lua
@@ -52,7 +52,7 @@ function _with_repo(func)
local reponame = "addon-test-repo-" .. suffix
local repodir = os.tmpfile() .. ".addon-repo"
local recipes = {
- -- the addon itself, its manifest sets the payload root directory, e.g. set_srcdir("src")
+ -- the addon itself, its manifest sets the payload root directory, e.g. set_sourcedir("src")
[ADDON] = ("set_sourcedir(%q)"):format(_addondir(ADDON)),
-- the addon which depends on the addon above
[ADDON_DEP] = ("set_sourcedir(%q)\n add_deps(%q, {kind = \"addon\"})"):format(_addondir(ADDON_DEP), ADDON),
diff --git a/xmake/core/package/addon.lua b/xmake/core/package/addon.lua
index bddd5ea45..d6d500e43 100644
--- a/xmake/core/package/addon.lua
+++ b/xmake/core/package/addon.lua
@@ -200,7 +200,7 @@ function addon.apis()
"addon.set_description"
, "addon.set_homepage"
, "addon.set_license"
- , "addon.set_srcdir"
+ , "addon.set_sourcedir"
-- addon.add_xxx
, "addon.add_deps"
}
@@ -211,7 +211,7 @@ end
--
-- @param sourcedir the addon source or install directory, which contains `addon.lua`
--
--- @return the manifest, e.g. {name = "esp32-devel", description = "...", srcdir = "src", deps = {"serial-tools"}}
+-- @return the manifest, e.g. {name = "esp32-devel", description = "...", sourcedir = "src", deps = {"serial-tools"}}
-- it will be nil if this addon does not describe itself
--
function addon.manifest(sourcedir)
@@ -251,7 +251,7 @@ function addon.manifest(sourcedir)
description = addoninfo:get("description"),
homepage = addoninfo:get("homepage"),
license = addoninfo:get("license"),
- srcdir = addoninfo:get("srcdir"),
+ sourcedir = addoninfo:get("sourcedir"),
deps = table.wrap(addoninfo:get("deps"))}
end
if not manifest then
@@ -463,12 +463,12 @@ end
--
function addon.payloadroot(sourcedir)
- -- the addon can set its payload root directory explicitly, e.g. set_srcdir("src")
+ -- the addon can set its payload root directory explicitly, e.g. set_sourcedir("src")
local manifest = addon.manifest(sourcedir)
- if manifest and manifest.srcdir then
- local srcdir = path.join(sourcedir, manifest.srcdir)
- if #addon.payloads_of(srcdir) > 0 then
- return srcdir
+ if manifest and manifest.sourcedir then
+ local payloadroot = path.join(sourcedir, manifest.sourcedir)
+ if #addon.payloads_of(payloadroot) > 0 then
+ return payloadroot
end
return
end