From fa9702bfcf4ba7ed2b599727913444cc3498bfda Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 31 Jul 2017 09:16:31 +0800 Subject: fix rebuild source file when compiling fails --- xmake/modules/core/tools/cl.lua | 3 +++ xmake/modules/core/tools/gcc.lua | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'xmake/modules/core/tools') diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 636bac50c..e9a3682bf 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -310,6 +310,9 @@ function _compile1(self, sourcefile, objectfile, incdepfile, flags) { function (errors) + -- try removing the old object file for forcing to rebuild this source file + os.tryrm(objectfile) + -- get prefix: "Note: including file:", @note maybe not english language local including_file = errors:match("\n(.-: .-:)%s*.-\r*\n") diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 254f3301a..20192cf85 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -397,7 +397,10 @@ function _compile1(self, sourcefile, objectfile, incdepfile, flags) { function (errors) - -- compiling errors + -- try removing the old object file for forcing to rebuild this source file + os.tryrm(objectfile) + + -- raise compiling errors os.raise(errors) end }, -- cgit v1.3.1