summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-01 00:37:42 +0800
committerruki <[email protected]>2025-10-01 00:37:42 +0800
commit4ef482175337e64d7bf2fb33abec2917c9e4fd4d (patch)
treed5651cb3495010394e924178d9aa211bec8d2c3e
parente4a2d682015b651adfcf7d7494a295c3276d7f10 (diff)
update some uuid hashes
-rw-r--r--xmake/actions/config/configfiles.lua2
-rw-r--r--xmake/core/project/project.lua4
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua4
-rw-r--r--xmake/rules/c++/unity_build/unity_build.lua2
4 files changed, 7 insertions, 5 deletions
diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua
index ce435d774..60e5ef378 100644
--- a/xmake/actions/config/configfiles.lua
+++ b/xmake/actions/config/configfiles.lua
@@ -292,7 +292,7 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets, preprocessors
end
else
-- generate to the temporary file first
- local dstfile_tmp = path.join(os.tmpdir(), hash.uuid4(srcfile))
+ local dstfile_tmp = os.tmpfile(srcfile)
os.tryrm(dstfile_tmp)
os.cp(srcfile, dstfile_tmp)
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 86050ebec..0f3a83bda 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -25,6 +25,7 @@ local project = project or {}
local os = require("base/os")
local io = require("base/io")
local path = require("base/path")
+local hash = require("base/hash")
local task = require("base/task")
local utils = require("base/utils")
local table = require("base/table")
@@ -1380,7 +1381,8 @@ function project.tmpfile(opt_or_key)
key = opt_or_key.key
opt = opt_or_key
end
- return path.join(project.tmpdir(opt), "_" .. (hash.uuid4(key):gsub("-", "")))
+ local filename = "_" .. (key and hash.strhash128(key) or (hash.random128()))
+ return path.join(project.tmpdir(opt), "_" .. filename)
end
-- get all modes
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index a5ec312cb..ee6493cde 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -1074,7 +1074,7 @@ function _add_target_link_libraries(cmakelists, target, outputdir)
local has_links = #target:objectfiles() > objectfiles_set:size()
- local key = target:name() .. "_" .. hash.uuid():split("-", {plain = true})[1]
+ local key = target:name() .. "_" .. hash.random32()
if has_links then
cmakelists:print("add_library(target_objectfiles_%s OBJECT IMPORTED GLOBAL)", key)
cmakelists:print("set_property(TARGET target_objectfiles_%s PROPERTY IMPORTED_OBJECTS", key)
@@ -1244,7 +1244,7 @@ function _add_target_custom_commands_for_batchcmds(cmakelists, target, outputdir
--
-- @see https://gitlab.kitware.com/cmake/cmake/-/issues/17802
--
- local key = target:name() .. "_" .. hash.uuid():split("-", {plain = true})[1]
+ local key = target:name() .. "_" .. hash.random32()
cmakelists:print("add_custom_command(OUTPUT output_%s", key)
for _, cmd in ipairs(cmds) do
local command = _get_command_string(cmd, outputdir)
diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua
index e8f37f868..1ced33ec8 100644
--- a/xmake/rules/c++/unity_build/unity_build.lua
+++ b/xmake/rules/c++/unity_build/unity_build.lua
@@ -36,7 +36,7 @@ function _merge_unityfile(target, sourcefile_unity, sourcefiles, opt)
sourcefile_unity = path.absolute(sourcefile_unity)
sourcefile = path.relative(sourcefile, path.directory(sourcefile_unity))
if uniqueid then
- unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.uuid():split("-", {plain = true})[1])
+ unityfile:print("#define %s %s", uniqueid, "unity_" .. hash.random32())
end
unityfile:print("#include \"%s\"", sourcefile)
if uniqueid then