diff options
| author | ruki <[email protected]> | 2022-04-19 00:55:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-19 00:55:54 +0800 |
| commit | 618a5511f0a3b87b157e921359332b69bb409a3b (patch) | |
| tree | ec84b44e08a26f39bc7a67d128e16cac1d97eb0e | |
| parent | 63b5e5e661cd5bf6d5eff074c1c1d0c54c5204ac (diff) | |
fix config
| -rw-r--r-- | xmake/actions/config/main.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/config.lua | 7 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/config.lua | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index b1c59fd51..bd8b6f8dd 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -307,7 +307,7 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) -- override configuration from the options or cache local options_history = {} - if not option.get("clean") and not autogen then + if not option.get("clean") and not autogen and not option.get("import") then options_history = localcache.get("config", "options") or {} options = options or options_history end @@ -324,7 +324,8 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) local importfile = option.get("import") if importfile then assert(os.isfile(importfile), "%s not found!", importfile) - if config.load(importfile) then + -- we need use readonly, @see https://github.com/xmake-io/xmake/issues/2278 + if config.load(importfile, {readonly = true}) then options_changed = true end end diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index d6dbcc962..da1ac0ba6 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -134,7 +134,10 @@ function config.directory() end -- load the project configuration -function config.load(filepath) +-- +-- @param opt {readonly = true} +-- +function config.load(filepath, opt) local configs, errors filepath = filepath or config.filepath() if os.isfile(filepath) then @@ -149,7 +152,7 @@ function config.load(filepath) if configs then for name, value in pairs(configs) do if config.get(name) == nil then - config.set(name, value) + config.set(name, value, opt) ok = true end end diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua index f8177871a..8779555f9 100644 --- a/xmake/core/sandbox/modules/import/core/project/config.lua +++ b/xmake/core/sandbox/modules/import/core/project/config.lua @@ -87,8 +87,8 @@ function sandbox_core_project_config.readonly(name) end -- load the configuration -function sandbox_core_project_config.load(filepath) - return config.load(filepath) +function sandbox_core_project_config.load(filepath, opt) + return config.load(filepath, opt) end -- save the configuration |
