diff options
| author | ruki <[email protected]> | 2025-11-12 22:45:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-12 22:45:25 +0800 |
| commit | a2bd19bd10182105ac020c1654f241551feec5b3 (patch) | |
| tree | 33a692d4db39cf85ef0bb3dde0961770cead9393 /xmake/plugins/project/vstudio/impl/vsutils.lua | |
| parent | efae9723bd484e50474a7f29b0cd4f84e7346a20 (diff) | |
fix project default config in vsxmake #7014
Diffstat (limited to 'xmake/plugins/project/vstudio/impl/vsutils.lua')
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vsutils.lua | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vsutils.lua b/xmake/plugins/project/vstudio/impl/vsutils.lua index fa78be0f7..c931b7b5b 100644 --- a/xmake/plugins/project/vstudio/impl/vsutils.lua +++ b/xmake/plugins/project/vstudio/impl/vsutils.lua @@ -18,6 +18,13 @@ -- @file vsutils.lua -- +-- imports +import("core.base.option") +import("core.project.config") +import("core.project.project") +import("core.cache.memcache") +import("core.cache.localcache") + -- escape special chars in msbuild file function escape(str) if not str then @@ -56,3 +63,34 @@ end function translate_path(filepath) return (filepath:gsub("::", "#")) end + +function reset_config_and_caches() + -- reload config, project and platform + -- modify config + config.set("as", nil, {force = true}) -- force to re-check as for ml/ml64 + config.set("mode", mode, {readonly = true, force = true}) + config.set("arch", arch, {readonly = true, force = true}) + + -- clear all options + for _, opt in pairs(project.options()) do + if not config.readonly(opt:fullname()) then + opt:clear() + end + end + -- merge the project options after default options + for name, value in pairs(project.get("config")) do + value = table.unwrap(value) + assert(type(value) == "string" or type(value) == "boolean" or type(value) == "number", "set_config(%s): unsupported value type(%s)", name, type(value)) + if not config.readonly(name) then + config.set(name, value) + end + end + + -- clear cache + memcache.clear() + localcache.clear("detect") + localcache.clear("option") + localcache.clear("package") + localcache.clear("toolchain") + localcache.clear("cxxmodules") +end |
