summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-10-25 21:07:16 +0800
committerruki <[email protected]>2017-10-25 00:43:39 +0800
commit4f296a608150a34b4153c7d17f1367ff11a8099a (patch)
treeab566a005596dce0a93b1d52edb8b3ba951fa982
parent1d8d394240647e595e923d08c9f3cd1ec1881d8c (diff)
improve io flush
-rw-r--r--xmake/actions/build/kinds/binary.lua6
-rw-r--r--xmake/actions/build/kinds/object.lua9
-rw-r--r--xmake/actions/build/kinds/shared.lua6
-rw-r--r--xmake/actions/build/kinds/static.lua6
-rw-r--r--xmake/core/base/os.lua3
-rw-r--r--xmake/core/project/option.lua3
6 files changed, 33 insertions, 0 deletions
diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua
index 58d0a920f..55a5274a3 100644
--- a/xmake/actions/build/kinds/binary.lua
+++ b/xmake/actions/build/kinds/binary.lua
@@ -113,6 +113,9 @@ function _build_from_objects(target, buildinfo)
print(linker_instance:linkcmd(objectfiles, targetfile, {linkflags = linkflags}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
@@ -142,6 +145,9 @@ function _build_from_sources(target, buildinfo, sourcebatch, sourcekind)
print(compiler.buildcmd(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- build it
compiler.build(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind})
end
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 174b8f27c..3b4e78146 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -98,6 +98,9 @@ function _build_from_object(target, sourcefile, objectfile, percent)
print("cp %s %s", sourcefile, objectfile)
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- insert this object file
os.cp(sourcefile, objectfile)
end
@@ -120,6 +123,9 @@ function _build_from_static(target, sourcefile, objectfile, percent)
print("ex %s %s", sourcefile, objectfile)
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- extract the static library to object directory
extractor.extract(sourcefile, path.directory(objectfile))
end
@@ -183,6 +189,9 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache)
print(compiler_instance:compcmd(sourcefile, objectfile, {compflags = compflags}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- complie it
assert(compiler_instance:compile(sourcefile, objectfile, {depinfo = depinfo, compflags = compflags}))
diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua
index 549afd9a4..5a1177953 100644
--- a/xmake/actions/build/kinds/shared.lua
+++ b/xmake/actions/build/kinds/shared.lua
@@ -126,6 +126,9 @@ function _build_from_objects(target, buildinfo)
print(linker_instance:linkcmd(objectfiles, targetfile, {linkflags = linkflags}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
@@ -155,6 +158,9 @@ function _build_from_sources(target, buildinfo, sourcebatch, sourcekind)
print(compiler.buildcmd(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- build it
compiler.build(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind})
end
diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua
index fe1f45c36..6fc4a8b4b 100644
--- a/xmake/actions/build/kinds/static.lua
+++ b/xmake/actions/build/kinds/static.lua
@@ -126,6 +126,9 @@ function _build_from_objects(target, buildinfo)
print(linker_instance:linkcmd(objectfiles, targetfile, {linkflags = linkflags}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- link it
assert(linker_instance:link(objectfiles, targetfile, {linkflags = linkflags}))
@@ -155,6 +158,9 @@ function _build_from_sources(target, buildinfo, sourcebatch, sourcekind)
print(compiler.buildcmd(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind}))
end
+ -- flush io buffer to update progress info
+ io.flush()
+
-- build it
compiler.build(sourcebatch.sourcefiles, targetfile, {target = target, sourcekind = sourcekind})
end
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ed840d02e..20114e2de 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -652,6 +652,9 @@ function os.raise(msg, ...)
-- flush log
log.flush()
+ -- flush io buffer
+ io.flush()
+
-- raise it
if msg then
error(string.tryformat(msg, ...))
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 238d5f937..0005c0bf0 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -151,6 +151,9 @@ function option:_check()
if not ok then
os.raise(errors)
end
+
+ -- flush io buffer to update progress info
+ io.flush()
end
-- attempt to check option