summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-04-01 10:58:21 +0800
committerruki <[email protected]>2017-04-01 10:58:21 +0800
commite7673022575cb315c7f443b79641e08f761bb12b (patch)
tree166b311d80138d3d50b04d98d294a6315ccdbca6
parent42bdac0d7f2a57a91587673d66c6bf1474fbaa1a (diff)
Add user tips when scanning and generating xmake.lua automatically
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/actions/build/main.lua3
-rw-r--r--xmake/actions/config/main.lua22
-rw-r--r--xmake/core/sandbox/modules/os.lua1
4 files changed, 26 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 308ca40b7..6557a9c59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
* [#63](https://github.com/tboox/xmake/pull/63): More safer build and install xmake
* [#61](https://github.com/tboox/xmake/pull/61): Check run command as root
* Improve check toolchains and implement delay checking
+* Add user tips when scanning and generating `xmake.lua` automatically
## Bugs fixed
@@ -252,6 +253,7 @@
* [#63](https://github.com/tboox/xmake/pull/63): 改进安装脚本,实现更加安全的构建和安装xmake
* [#61](https://github.com/tboox/xmake/pull/61): 禁止在root权限下运行xmake命令,增强安全性
* 改进工具链检测,通过延迟延迟检测提升整体检测效率
+* 当自动扫面生成`xmake.lua`时,添加更友好的用户提示,避免用户无操作
### Bugs修复
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 1d5b3b8ba..18df4afb9 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -70,8 +70,7 @@ function main()
function ()
-- build
- builder.build(targetname)
-
+ builder.build(targetname)
end,
catch
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 66bf33404..cf74d1af4 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -138,6 +138,28 @@ function main()
-- scan project and generate it if xmake.lua not exists
if not os.isfile(project.file()) then
+
+ -- need some tips?
+ local autogen = true
+ if not option.get("quiet") then
+
+ -- show tips
+ cprint("${bright yellow}note: ${default yellow}xmake.lua not found, try generating it?")
+ cprint("please input: n (y/n)")
+
+ -- get answer
+ io.flush()
+ if io.read() ~= 'y' then
+ autogen = false
+ end
+ end
+
+ -- do not generate it
+ if not autogen then
+ os.exit()
+ end
+
+ -- scan and generate it automatically
scanner.make()
end
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 12cd89fdb..b0c7741b9 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -34,6 +34,7 @@ local vformat = require("sandbox/modules/vformat")
local sandbox_os = sandbox_os or {}
-- inherit some builtin interfaces
+sandbox_os.exit = os.exit
sandbox_os.date = os.date
sandbox_os.time = os.time
sandbox_os.argv = os.argv