diff options
| author | ruki <[email protected]> | 2026-01-16 00:39:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-16 00:39:38 +0800 |
| commit | 28b4ef6eaeac47cc1f7b5b40723d11d1578876d3 (patch) | |
| tree | 5642dc2ac04eee1481a1c2583075816d7798da01 | |
| parent | 2b5e122d83f3759340565acb753095a5370f676b (diff) | |
improve to project generator
| -rw-r--r-- | xmake/actions/config/main.lua | 51 | ||||
| -rw-r--r-- | xmake/plugins/project/main.lua | 5 |
2 files changed, 31 insertions, 25 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index fa9ab6782..6908e21c3 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -326,7 +326,9 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) localcache.clear("package") localcache.clear("toolchain") localcache.set("config", "recheck", true) - localcache.save() + if not opt.loadonly then + localcache.save() + end -- check platform instance_plat:check() @@ -390,31 +392,34 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) _export_configs() end - -- we need to save it and enable external working mode - -- if we configure the given project directory - -- - -- @see https://github.com/xmake-io/xmake/issues/3342 - -- - local projectdir = option.get("project") - local projectfile = option.get("file") - if projectdir or projectfile then - localcache.set("project", "projectdir", projectdir) - localcache.set("project", "projectfile", projectfile) - localcache.save("project") - end + -- save configs and caches + if not opt.loadonly then + -- we need to save it and enable external working mode + -- if we configure the given project directory + -- + -- @see https://github.com/xmake-io/xmake/issues/3342 + -- + local projectdir = option.get("project") + local projectfile = option.get("file") + if projectdir or projectfile then + localcache.set("project", "projectdir", projectdir) + localcache.set("project", "projectfile", projectfile) + localcache.save("project") + end - -- save options and config cache - localcache.set("config", "recheck", false) - localcache.set("config", "mtimes", project.mtimes()) - config.save() - localcache.set("config", "options", options) - localcache.save("config") + -- save options and config cache + localcache.set("config", "recheck", false) + localcache.set("config", "mtimes", project.mtimes()) + config.save() + localcache.set("config", "options", options) + localcache.save("config") - -- save toolchain cache - toolchain.save() + -- save toolchain cache + toolchain.save() - -- save detect cache - detectcache:save() + -- save detect cache + detectcache:save() + end -- unlock the whole project project.unlock() diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua index d48f6662d..d6741a711 100644 --- a/xmake/plugins/project/main.lua +++ b/xmake/plugins/project/main.lua @@ -87,8 +87,9 @@ function main() -- in project generator? os.setenv("XMAKE_IN_PROJECT_GENERATOR", "true") - -- config it first - task.run("config") + -- load config first + -- @note When generating project configuration files, we should not modify the configuration and cache. + task.run("config", {}, {loadonly = true}) -- post statistics statistics.post() |
