summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-24 22:40:01 +0800
committerruki <[email protected]>2025-04-24 10:24:45 +0800
commitd75240a009a7f295e31568c83fe9e93de1be431d (patch)
tree06bf5f1da864c1f993c2f7926a507ff43221690d /xmake/core
parent9a69d05a1087691899587da2aeb1c37cea54c354 (diff)
rename more buildir
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/package/package.lua20
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua24
2 files changed, 25 insertions, 19 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 8f09e741e..df2be796c 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -824,19 +824,25 @@ function _instance:sourcedir()
end
-- get the build directory
-function _instance:buildir()
- local buildir = self._BUILDIR
- if not buildir then
+function _instance:builddir()
+ local builddir = self._BUILDDIR
+ if not builddir then
if self:is_local() then
local name = self:name():lower():gsub("::", "_")
local rootdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, self:version_str())
- buildir = path.join(rootdir, "cache", "build_" .. self:buildhash():sub(1, 8))
+ builddir = path.join(rootdir, "cache", "build_" .. self:buildhash():sub(1, 8))
else
- buildir = "build_" .. self:buildhash():sub(1, 8)
+ builddir = "build_" .. self:buildhash():sub(1, 8)
end
- self._BUILDIR = buildir
+ self._BUILDDIR = builddir
end
- return buildir
+ return builddir
+end
+
+-- get the build directory (deprecated)
+function _instance:buildir()
+ utils.warning("package:buildir() has been deprecated, please use package:builddir()")
+ return self:builddir()
end
-- get the cached directory of this package
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index df1d31240..7c8a77735 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -204,21 +204,21 @@ function core_sandbox_module._native_moduleinfo(module_fullpath, modulekind)
local programdir = path.normalize(os.programdir())
local modulename = path.basename(module_fullpath)
local modulehash = hash.strhash32(projectdir)
- local buildir
+ local builddir
local is_global = false
local modulepath
if projectdir:startswith(programdir) then
is_global = true
- buildir = path.join(global.directory(), "cache", "modules", modulehash)
+ builddir = path.join(global.directory(), "cache", "modules", modulehash)
modulepath = path.join("@programdir", path.relative(projectdir, programdir))
elseif os.isfile(os.projectfile()) then
- buildir = path.join(config.directory(), "cache", "modules", modulehash)
+ builddir = path.join(config.directory(), "cache", "modules", modulehash)
modulepath = path.relative(projectdir, os.projectdir())
else
- buildir = path.join(projectdir, "cache", "modules", modulehash)
+ builddir = path.join(projectdir, "cache", "modules", modulehash)
modulepath = projectdir
end
- return {buildir = buildir, projectdir = projectdir, is_global = is_global, modulename = modulename, modulekind = modulekind, modulepath = modulepath}
+ return {builddir = builddir, projectdir = projectdir, is_global = is_global, modulename = modulename, modulekind = modulekind, modulepath = modulepath}
end
-- build module
@@ -232,10 +232,10 @@ function core_sandbox_module._build_module(moduleinfo)
return nil, "unknown module kind!"
end
utils.cprint("${color.build.target}building native %s module(%s) in %s ...", modulekind_str, moduleinfo.modulename, moduleinfo.modulepath)
- local buildir = moduleinfo.buildir
+ local builddir = moduleinfo.builddir
local projectdir = moduleinfo.projectdir
- local envs = {XMAKE_CONFIGDIR = buildir}
- local argv = {"config", "-o", buildir, "-a", xmake.arch()}
+ local envs = {XMAKE_CONFIGDIR = builddir}
+ local argv = {"config", "-o", builddir, "-a", xmake.arch()}
core_sandbox_module._add_builtin_argv(argv, projectdir)
local ok, errors = os.execv(os.programfile(), argv, {envs = envs, curdir = projectdir})
if ok ~= 0 then
@@ -254,7 +254,7 @@ end
function core_sandbox_module._load_from_binary(module_fullpath, opt)
opt = opt or {}
local moduleinfo = core_sandbox_module._native_moduleinfo(module_fullpath, MODULE_KIND_BINARY)
- local binaryfiles = os.files(path.join(moduleinfo.buildir, "module_*"))
+ local binaryfiles = os.files(path.join(moduleinfo.builddir, "module_*"))
if #binaryfiles == 0 or (not moduleinfo.is_global and opt.always_build) then
local ok, errors = core_sandbox_module._build_module(moduleinfo)
if not ok then
@@ -264,7 +264,7 @@ function core_sandbox_module._load_from_binary(module_fullpath, opt)
end
local module
if #binaryfiles == 0 then
- binaryfiles = os.files(path.join(moduleinfo.buildir, "module_*"))
+ binaryfiles = os.files(path.join(moduleinfo.builddir, "module_*"))
end
if #binaryfiles > 0 then
module = {}
@@ -297,7 +297,7 @@ end
function core_sandbox_module._load_from_shared(module_fullpath, opt)
opt = opt or {}
local moduleinfo = core_sandbox_module._native_moduleinfo(module_fullpath, MODULE_KIND_SHARED)
- local libraryfiles = os.files(path.join(moduleinfo.buildir, "*module_*"))
+ local libraryfiles = os.files(path.join(moduleinfo.builddir, "*module_*"))
if #libraryfiles == 0 or (not moduleinfo.is_global and opt.always_build) then
local ok, errors = core_sandbox_module._build_module(moduleinfo)
if not ok then
@@ -307,7 +307,7 @@ function core_sandbox_module._load_from_shared(module_fullpath, opt)
end
local module
if #libraryfiles == 0 then
- libraryfiles = os.files(path.join(moduleinfo.buildir, "*module_*"))
+ libraryfiles = os.files(path.join(moduleinfo.builddir, "*module_*"))
end
if #libraryfiles > 0 then
local script, errors1, errors2