From 0e82b0084f3abbcbabc376b6681bba08cf47074a Mon Sep 17 00:00:00 2001 From: TitanSnow Date: Mon, 8 May 2017 10:49:20 +0800 Subject: add script "build_configuration.lua" --- xmake/plugins/lua/scripts/build_configuration.lua | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 xmake/plugins/lua/scripts/build_configuration.lua (limited to 'xmake/plugins/lua/scripts') diff --git a/xmake/plugins/lua/scripts/build_configuration.lua b/xmake/plugins/lua/scripts/build_configuration.lua new file mode 100644 index 000000000..ec040f405 --- /dev/null +++ b/xmake/plugins/lua/scripts/build_configuration.lua @@ -0,0 +1,4 @@ +function main() + table.dump(os.build_configuration()) +end +return main -- cgit v1.3.1 From c1bccef85b8a73b8a324373764006086ce82b58c Mon Sep 17 00:00:00 2001 From: TitanSnow Date: Mon, 8 May 2017 13:58:51 +0800 Subject: build_configuration -> versioninfo --- core/src/xmake/machine.c | 4 +- core/src/xmake/makefile | 2 +- core/src/xmake/os/build_configuration.c | 71 ----------------------- core/src/xmake/os/versioninfo.c | 71 +++++++++++++++++++++++ xmake/core/sandbox/modules/os.lua | 6 +- xmake/plugins/lua/scripts/build_configuration.lua | 4 -- xmake/plugins/lua/scripts/versioninfo.lua | 3 + 7 files changed, 80 insertions(+), 81 deletions(-) delete mode 100644 core/src/xmake/os/build_configuration.c create mode 100644 core/src/xmake/os/versioninfo.c delete mode 100644 xmake/plugins/lua/scripts/build_configuration.lua create mode 100644 xmake/plugins/lua/scripts/versioninfo.lua (limited to 'xmake/plugins/lua/scripts') diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index 09ed217f0..b0e86fd00 100644 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -80,7 +80,7 @@ tb_int_t xm_os_getenv(lua_State* lua); tb_int_t xm_os_emptydir(lua_State* lua); tb_int_t xm_os_strerror(lua_State* lua); tb_int_t xm_os_getwinsize(lua_State* lua); -tb_int_t xm_os_build_configuration(lua_State* lua); +tb_int_t xm_os_versioninfo(lua_State* lua); // the path functions tb_int_t xm_path_relative(lua_State* lua); @@ -132,7 +132,7 @@ static luaL_Reg const g_os_functions[] = , { "emptydir", xm_os_emptydir } , { "strerror", xm_os_strerror } , { "getwinsize", xm_os_getwinsize} -, { "build_configuration", xm_os_build_configuration} +, { "versioninfo", xm_os_versioninfo} , { tb_null, tb_null } }; diff --git a/core/src/xmake/makefile b/core/src/xmake/makefile index b3b90f965..0d41f4439 100644 --- a/core/src/xmake/makefile +++ b/core/src/xmake/makefile @@ -36,7 +36,7 @@ xmake_C_FILES += \ os/emptydir \ os/strerror \ os/getwinsize \ - os/build_configuration \ + os/versioninfo \ path/relative \ path/absolute \ path/translate \ diff --git a/core/src/xmake/os/build_configuration.c b/core/src/xmake/os/build_configuration.c deleted file mode 100644 index 55dc837c4..000000000 --- a/core/src/xmake/os/build_configuration.c +++ /dev/null @@ -1,71 +0,0 @@ -/*!The Make-like Build Utility based on Lua - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright (C) 2015 - 2017, TBOOX Open Source Group. - * - * @author TitanSnow - * @file build_configuration.c - * - */ - -/* ////////////////////////////////////////////////////////////////////////////////////// - * trace - */ -#define TB_TRACE_MODULE_NAME "build_configuration" -#define TB_TRACE_MODULE_DEBUG (0) - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "prefix.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ - -// get build_configuration -tb_int_t xm_os_build_configuration(lua_State* lua) -{ - // features - const char* features_table[] = { -# ifdef XM_CONFIG_API_HAVE_READLINE - "readline", -# endif - tb_null - }; - - // configuration table - lua_newtable(lua); - lua_pushstring(lua, "features"); - - // array for features - lua_newtable(lua); - - // insert - for (const char** p = features_table; *p; ++p) - { - lua_pushstring(lua, *p); - lua_rawseti(lua, -2, p - features_table + 1); - } - - // set back to table - lua_settable(lua, -3); - - // ok - return 1; -} diff --git a/core/src/xmake/os/versioninfo.c b/core/src/xmake/os/versioninfo.c new file mode 100644 index 000000000..9cb80ddae --- /dev/null +++ b/core/src/xmake/os/versioninfo.c @@ -0,0 +1,71 @@ +/*!The Make-like Build Utility based on Lua + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright (C) 2015 - 2017, TBOOX Open Source Group. + * + * @author TitanSnow + * @file versioninfo.c + * + */ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * trace + */ +#define TB_TRACE_MODULE_NAME "versioninfo" +#define TB_TRACE_MODULE_DEBUG (0) + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "prefix.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ + +// get versioninfo +tb_int_t xm_os_versioninfo(lua_State* lua) +{ + // features + const char* features_table[] = { +# ifdef XM_CONFIG_API_HAVE_READLINE + "readline", +# endif + tb_null + }; + + // configuration table + lua_newtable(lua); + lua_pushstring(lua, "features"); + + // array for features + lua_newtable(lua); + + // insert + for (const char** p = features_table; *p; ++p) + { + lua_pushstring(lua, *p); + lua_rawseti(lua, -2, p - features_table + 1); + } + + // set back to table + lua_settable(lua, -3); + + // ok + return 1; +} diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index e374143fa..b2a41aa31 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -514,9 +514,9 @@ function sandbox_os.sudol(runner, luafile, luaargv) sandbox_os.sudov(runner, path.join(sandbox_os.programdir(), "xmake"), table.join(argv, luafile, luaargv)) end --- get build_configuration -function sandbox_os.build_configuration() - return os.build_configuration() +-- get versioninfo +function sandbox_os.versioninfo() + return os.versioninfo() end -- return module diff --git a/xmake/plugins/lua/scripts/build_configuration.lua b/xmake/plugins/lua/scripts/build_configuration.lua deleted file mode 100644 index ec040f405..000000000 --- a/xmake/plugins/lua/scripts/build_configuration.lua +++ /dev/null @@ -1,4 +0,0 @@ -function main() - table.dump(os.build_configuration()) -end -return main diff --git a/xmake/plugins/lua/scripts/versioninfo.lua b/xmake/plugins/lua/scripts/versioninfo.lua new file mode 100644 index 000000000..c6d01667b --- /dev/null +++ b/xmake/plugins/lua/scripts/versioninfo.lua @@ -0,0 +1,3 @@ +function main() + table.dump(os.versioninfo()) +end -- cgit v1.3.1