diff options
| author | ruki <[email protected]> | 2022-04-03 22:43:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-03 22:43:11 +0800 |
| commit | fcc1554497bb0b3c1d59e96b5bbb16829233f7ab (patch) | |
| tree | f47e47ca675ae1eba2c5abb1f9e5bb8b3fa45f47 | |
| parent | 1cc3a8d9a50b5272b4cbf34aa40b656ccd685227 (diff) | |
improve pattern
| -rw-r--r-- | tests/apis/add_configfiles/config2.h.in | 2 | ||||
| -rw-r--r-- | tests/apis/add_configfiles/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/config/configfiles.lua | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/tests/apis/add_configfiles/config2.h.in b/tests/apis/add_configfiles/config2.h.in index 0fa222906..a2c94fc44 100644 --- a/tests/apis/add_configfiles/config2.h.in +++ b/tests/apis/add_configfiles/config2.h.in @@ -1,4 +1,4 @@ -#define HAVE_@module@_H +#define HAVE_@module@_H #define HELLO2 "@hello@ @ARCH@ @PLAT@" @define FOO_ENABLE@ diff --git a/tests/apis/add_configfiles/xmake.lua b/tests/apis/add_configfiles/xmake.lua index 7342954b7..4f4b75936 100644 --- a/tests/apis/add_configfiles/xmake.lua +++ b/tests/apis/add_configfiles/xmake.lua @@ -37,7 +37,7 @@ target("test2") set_configvar("module", "test2") set_configdir("$(buildir)/config2") add_configfiles("test.c.in", {filename = "mytest.c"}) - add_configfiles("config2.h.in", {variables = {hello = "xmake2"}, pattern = "@(.-)@", prefixdir = "header"}) + add_configfiles("config2.h.in", {variables = {hello = "xmake2"}, pattern = "@([^\n]-)@", prefixdir = "header"}) add_configfiles("*.man", {onlycopy = true, prefixdir = "man"}) add_includedirs("$(buildir)/config2/header") diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua index 72891136a..ae3a4f0f1 100644 --- a/xmake/actions/config/configfiles.lua +++ b/xmake/actions/config/configfiles.lua @@ -214,7 +214,7 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets) end -- replace all variables - local pattern = fileinfo.pattern or "%${(.-)}" + local pattern = fileinfo.pattern or "%${([^\n]-)}" io.gsub(dstfile_tmp, "(" .. pattern .. ")", function(_, variable) -- get variable name |
