summaryrefslogtreecommitdiff
path: root/xmake/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-27 17:57:41 +0800
committerruki <[email protected]>2017-03-27 17:58:56 +0800
commit71d627e4aa9b5780e63fc6b679c74548844c5feb (patch)
tree46d8e8c874d045ca1f4d492b6edf82f5d716ae54 /xmake/tools
parent235bb967883ab0686bab731c8e94a4a0bb7677ab (diff)
fix io.read and io.write raw lua api
Diffstat (limited to 'xmake/tools')
-rw-r--r--xmake/tools/ar.lua2
-rw-r--r--xmake/tools/cl.lua2
-rw-r--r--xmake/tools/dmd.lua2
-rw-r--r--xmake/tools/gcc.lua4
-rw-r--r--xmake/tools/gccgo.lua2
-rw-r--r--xmake/tools/go.lua2
-rw-r--r--xmake/tools/lib.lua2
-rw-r--r--xmake/tools/link.lua4
-rw-r--r--xmake/tools/ml.lua2
-rw-r--r--xmake/tools/rustc.lua2
10 files changed, 12 insertions, 12 deletions
diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua
index 4c82a7c5b..281055c40 100644
--- a/xmake/tools/ar.lua
+++ b/xmake/tools/ar.lua
@@ -119,7 +119,7 @@ function check(flags)
local libraryfile = path.join(os.tmpdir(), "xmake.ar.a")
local objectfile = path.join(os.tmpdir(), "xmake.ar.o")
local sourcefile = path.join(os.tmpdir(), "xmake.ar.c")
- io.write(sourcefile, "int test(void)\n{return 0;}")
+ io.writefile(sourcefile, "int test(void)\n{return 0;}")
-- make flags
local arflags = table.concat(_g.arflags, " ")
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua
index f67f072ab..68881995e 100644
--- a/xmake/tools/cl.lua
+++ b/xmake/tools/cl.lua
@@ -322,7 +322,7 @@ function check(flags)
-- make an stub source file
local objectfile = os.tmpfile() .. ".obj"
local sourcefile = os.tmpfile() .. ".c"
- io.write(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
+ io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
-- check it
os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/dmd.lua b/xmake/tools/dmd.lua
index 844c94e92..10fb28342 100644
--- a/xmake/tools/dmd.lua
+++ b/xmake/tools/dmd.lua
@@ -201,7 +201,7 @@ function check(flags)
local sourcefile = os.tmpfile() .. ".d"
-- make stub code
- io.write(sourcefile, "void main() {\n}")
+ io.writefile(sourcefile, "void main() {\n}")
-- check it
os.run("%s -c %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua
index a3f40b4b0..d4dc2d930 100644
--- a/xmake/tools/gcc.lua
+++ b/xmake/tools/gcc.lua
@@ -340,7 +340,7 @@ function _compile1(sourcefile, objectfile, incdepfile, flags)
-- translate it
local results = {}
- local incdeps = io.read(tmpfile)
+ local incdeps = io.readfile(tmpfile)
for includefile in string.gmatch(incdeps, "%s+([%w/%.%-%+_%$%.]+)") do
-- save it if belong to the project
@@ -385,7 +385,7 @@ function check(flags)
local sourcefile = os.tmpfile() .. ".c" .. ifelse(_g.kind == "cxx", "pp", "")
-- make stub code
- io.write(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
+ io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
-- check it
os.run("%s -c %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/gccgo.lua b/xmake/tools/gccgo.lua
index 48bb5ee19..1254130d4 100644
--- a/xmake/tools/gccgo.lua
+++ b/xmake/tools/gccgo.lua
@@ -40,7 +40,7 @@ function check(flags)
local sourcefile = os.tmpfile() .. ".go"
-- make stub code
- io.write(sourcefile, "package main\nfunc main() {\n}")
+ io.writefile(sourcefile, "package main\nfunc main() {\n}")
-- check it
os.run("%s -c %s -o %s %s", _super._g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/go.lua b/xmake/tools/go.lua
index 0d9bd00f4..3e7afe80d 100644
--- a/xmake/tools/go.lua
+++ b/xmake/tools/go.lua
@@ -164,7 +164,7 @@ function check(flags)
local sourcefile = os.tmpfile() .. ".go"
-- make stub code
- io.write(sourcefile, "package main\nfunc main() {\n}")
+ io.writefile(sourcefile, "package main\nfunc main() {\n}")
-- check it
os.run("%s tool compile %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/lib.lua b/xmake/tools/lib.lua
index 62787b405..7b0a851e8 100644
--- a/xmake/tools/lib.lua
+++ b/xmake/tools/lib.lua
@@ -80,7 +80,7 @@ function check(flags)
local libfile = os.tmpfile() .. ".lib"
local objfile = os.tmpfile() .. ".obj"
local srcfile = os.tmpfile() .. ".c"
- io.write(srcfile, "int test(void)\n{return 0;}")
+ io.writefile(srcfile, "int test(void)\n{return 0;}")
-- check it
os.run("cl -c -Fo%s %s", objfile, srcfile)
diff --git a/xmake/tools/link.lua b/xmake/tools/link.lua
index 7d4ae9f56..aa99377fb 100644
--- a/xmake/tools/link.lua
+++ b/xmake/tools/link.lua
@@ -147,9 +147,9 @@ function check(flags)
-- main entry
if flags and flags:lower():find("subsystem:windows") then
- io.write(sourcefile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}")
+ io.writefile(sourcefile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}")
else
- io.write(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
+ io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
end
-- check it
diff --git a/xmake/tools/ml.lua b/xmake/tools/ml.lua
index 874d0be78..d8ddaee29 100644
--- a/xmake/tools/ml.lua
+++ b/xmake/tools/ml.lua
@@ -152,7 +152,7 @@ function check(flags)
-- make an stub source file
local objectfile = os.tmpfile() .. ".obj"
local sourcefile = os.tmpfile() .. ".asm"
- io.write(sourcefile, "end")
+ io.writefile(sourcefile, "end")
-- check it
os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
diff --git a/xmake/tools/rustc.lua b/xmake/tools/rustc.lua
index 6456e7a3a..5727544d2 100644
--- a/xmake/tools/rustc.lua
+++ b/xmake/tools/rustc.lua
@@ -148,7 +148,7 @@ function check(flags)
local sourcefile = os.tmpfile() .. ".rs"
-- make stub code
- io.write(sourcefile, "fn main() {\n}")
+ io.writefile(sourcefile, "fn main() {\n}")
-- check it
os.run("%s --emit obj %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)