diff options
| author | ruki <[email protected]> | 2018-05-22 00:28:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-05-21 20:51:03 +0800 |
| commit | 25eab76f405d681b06c93a00e0e9a2b3f5b65644 (patch) | |
| tree | 7d81427fe77472aef17684c245b375470f9ea0fa | |
| parent | e657f348e658d91255fd01d347faf74ccafdfa4e (diff) | |
fix cmd length limit
| -rw-r--r-- | xmake/core/base/os.lua | 16 | ||||
| -rw-r--r-- | xmake/modules/core/tools/ar.lua | 15 | ||||
| -rw-r--r-- | xmake/modules/core/tools/link.lua | 13 |
3 files changed, 26 insertions, 18 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index e5377820f..2cf56e3df 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -586,17 +586,6 @@ function os.execv(program, argv, opt) -- translate arguments for wildcards argv = wildcards and os.argw(argv) or argv - -- too long arguments for windows? - local argsfile = nil - if os.host() == "windows" then - local args = os.args(argv) - if #args > 256 then - argsfile = os.tmpfile(args) .. ".args.txt" - io.writefile(argsfile, args) - argv = {"@" .. argsfile} - end - end - -- is not executable program file? local filename = program if not os.isexec(program) then @@ -646,11 +635,6 @@ function os.execv(program, argv, opt) process.close(proc) end - -- remove arguments file - if argsfile and os.isfile(argsfile) then - os.rm(argsfile) - end - -- ok? return ok end diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua index de70ddc46..2834e111c 100644 --- a/xmake/modules/core/tools/ar.lua +++ b/xmake/modules/core/tools/ar.lua @@ -55,8 +55,21 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags) -- check assert(targetkind == "static") + -- init arguments + local argv = table.join(flags, targetfile, objectfiles) + + -- too long arguments for windows? + if is_host("windows") then + local args = os.args(argv) + if #args > 1024 then + local argsfile = os.tmpfile(args) .. ".args.txt" + io.writefile(argsfile, args) + argv = {"@" .. argsfile} + end + end + -- make it - return self:program(), table.join(flags, targetfile, objectfiles) + return self:program(), argv end -- link the library file diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua index f9cde52ec..ae2112559 100644 --- a/xmake/modules/core/tools/link.lua +++ b/xmake/modules/core/tools/link.lua @@ -90,7 +90,18 @@ end -- make the link arguments list function linkargv(self, objectfiles, targetkind, targetfile, flags) - return self:program(), table.join(flags, "-out:" .. targetfile, objectfiles) + + -- init arguments + local argv = table.join(flags, "-out:" .. targetfile, objectfiles) + + -- too long arguments for windows? + local args = os.args(argv) + if #args > 1024 then + local argsfile = os.tmpfile(args) .. ".args.txt" + io.writefile(argsfile, args) + argv = {"@" .. argsfile} + end + return self:program(), argv end -- link the target file |
