diff options
| author | ruki <[email protected]> | 2024-02-20 00:46:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-02-20 00:46:48 +0800 |
| commit | f133d021740ed0a41be6bff1c70a0a8fae5c6690 (patch) | |
| tree | d96f4274e27658353d7d0248ac0066e66819c1fb | |
| parent | e2d97525e241901004606f85cf7af881874468b9 (diff) | |
add build.always_update_configfiles policy #4747
| -rw-r--r-- | xmake/actions/config/configfiles.lua | 10 | ||||
| -rw-r--r-- | xmake/core/project/policy.lua | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua index 2b30f53af..60b313abb 100644 --- a/xmake/actions/config/configfiles.lua +++ b/xmake/actions/config/configfiles.lua @@ -62,6 +62,13 @@ function _get_configfiles() srcinfo.dependfile = target:dependfile(srcfile) end + -- always update? + local always_update = target:policy("build.always_update_configfiles") + if always_update == nil then + always_update = project.policy("build.always_update_configfiles") + end + srcinfo.always_update = always_update + -- save targets srcinfo.targets = srcinfo.targets or {} table.insert(srcinfo.targets, target) @@ -320,6 +327,7 @@ function main(opt) opt = opt or {} local oldir = os.cd(project.directory()) + -- generate all configuration files local configfiles = _get_configfiles() for dstfile, srcinfo in pairs(configfiles) do @@ -328,7 +336,7 @@ function main(opt) end, {files = srcinfo.srcfile, lastmtime = os.mtime(dstfile), dependfile = srcinfo.dependfile, - changed = opt.force}) + changed = opt.force or srcinfo.always_update}) end -- leave project directory diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 64fc23883..e99f02caf 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -48,6 +48,8 @@ function policy.policies() ["build.ccache"] = {description = "Enable C/C++ build cache.", type = "boolean"}, -- Use global storage if build.ccache is enabled ["build.ccache.global_storage"] = {description = "Use global storge if build.ccache is enabled.", type = "boolean"}, + -- Always update configfiles when building + ["build.always_update_configfiles"] = {description = "Always update configfiles when building.", type = "boolean"}, -- Enable build warning output, it's enabled by default. ["build.warning"] = {description = "Enable build warning output.", default = true, type = "boolean"}, -- Enable LTO linker-time optimization for c/c++ building. |
