diff options
| author | ruki <[email protected]> | 2017-06-19 21:16:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-19 21:23:00 +0800 |
| commit | 1e7d8c44b51528b129c9d600785fd7a84850646b (patch) | |
| tree | b86fcb28091ba83a3f5dc4b0485163a2e3c759f6 /xmake/modules | |
| parent | e2d960162cd7c78eaa86ae3fc474a112ec4ddfbe (diff) | |
impl has_flags and rename detect.xxx to detect.xxxs
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/detect/packages/find_openssl.lua (renamed from xmake/modules/detect/package/find_openssl.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/packages/find_zlib.lua (renamed from xmake/modules/detect/package/find_zlib.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_cross_toolchains.lua (renamed from xmake/modules/detect/sdk/find_cross_toolchains.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_ndk_sdkvers.lua (renamed from xmake/modules/detect/sdk/find_ndk_sdkvers.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_ndk_toolchains.lua (renamed from xmake/modules/detect/sdk/find_ndk_toolchains.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua (renamed from xmake/modules/detect/sdk/find_vstudio.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_xcode_dir.lua (renamed from xmake/modules/detect/sdk/find_xcode_dir.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_xcode_sdkvers.lua (renamed from xmake/modules/detect/sdk/find_xcode_sdkvers.lua) | 2 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_7z.lua (renamed from xmake/modules/detect/tool/find_7z.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ar.lua (renamed from xmake/modules/detect/tool/find_ar.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_brew.lua (renamed from xmake/modules/detect/tool/find_brew.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ccache.lua (renamed from xmake/modules/detect/tool/find_ccache.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_cl.lua (renamed from xmake/modules/detect/tool/find_cl.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_clang.lua (renamed from xmake/modules/detect/tool/find_clang.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_clangxx.lua (renamed from xmake/modules/detect/tool/find_clangxx.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_curl.lua (renamed from xmake/modules/detect/tool/find_curl.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_dmd.lua (renamed from xmake/modules/detect/tool/find_dmd.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_doxygen.lua (renamed from xmake/modules/detect/tool/find_doxygen.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gcc.lua (renamed from xmake/modules/detect/tool/find_gcc.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gccgo.lua (renamed from xmake/modules/detect/tool/find_gccgo.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gdb.lua (renamed from xmake/modules/detect/tool/find_gdb.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gdc.lua (renamed from xmake/modules/detect/tool/find_gdc.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_git.lua (renamed from xmake/modules/detect/tool/find_git.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_go.lua (renamed from xmake/modules/detect/tool/find_go.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gxx.lua (renamed from xmake/modules/detect/tool/find_gxx.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gzip.lua (renamed from xmake/modules/detect/tool/find_gzip.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ldc2.lua (renamed from xmake/modules/detect/tool/find_ldc2.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_lib.lua (renamed from xmake/modules/detect/tool/find_lib.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_link.lua (renamed from xmake/modules/detect/tool/find_link.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_lipo.lua (renamed from xmake/modules/detect/tool/find_lipo.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_lldb.lua (renamed from xmake/modules/detect/tool/find_lldb.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ml.lua (renamed from xmake/modules/detect/tool/find_ml.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ml64.lua (renamed from xmake/modules/detect/tool/find_ml64.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ollydbg.lua (renamed from xmake/modules/detect/tool/find_ollydbg.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_pkg_config.lua (renamed from xmake/modules/detect/tool/find_pkg_config.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_rc.lua (renamed from xmake/modules/detect/tool/find_rc.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_rustc.lua (renamed from xmake/modules/detect/tool/find_rustc.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_sudo.lua (renamed from xmake/modules/detect/tool/find_sudo.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_swiftc.lua (renamed from xmake/modules/detect/tool/find_swiftc.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_tar.lua (renamed from xmake/modules/detect/tool/find_tar.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_unzip.lua (renamed from xmake/modules/detect/tool/find_unzip.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_vsjitdebugger.lua (renamed from xmake/modules/detect/tool/find_vsjitdebugger.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_wget.lua (renamed from xmake/modules/detect/tool/find_wget.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_windbg.lua (renamed from xmake/modules/detect/tool/find_windbg.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_x64dbg.lua (renamed from xmake/modules/detect/tool/find_x64dbg.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_zip.lua (renamed from xmake/modules/detect/tool/find_zip.lua) | 0 | ||||
| -rw-r--r-- | xmake/modules/devel/debugger/run.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/devel/git/checkout.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/devel/git/clean.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/devel/git/clone.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/devel/git/ls_remote.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/devel/git/pull.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/find_tool.lua | 46 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/find_toolname.lua | 11 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/has_flags.lua | 101 | ||||
| -rw-r--r-- | xmake/modules/lib/detect/pkg_config.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/net/http/download.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/privilege/sudo.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/utils/archive/extract.lua | 8 |
59 files changed, 153 insertions, 47 deletions
diff --git a/xmake/modules/detect/package/find_openssl.lua b/xmake/modules/detect/packages/find_openssl.lua index 9efe76370..9efe76370 100644 --- a/xmake/modules/detect/package/find_openssl.lua +++ b/xmake/modules/detect/packages/find_openssl.lua diff --git a/xmake/modules/detect/package/find_zlib.lua b/xmake/modules/detect/packages/find_zlib.lua index 49cc3e83a..49cc3e83a 100644 --- a/xmake/modules/detect/package/find_zlib.lua +++ b/xmake/modules/detect/packages/find_zlib.lua diff --git a/xmake/modules/detect/sdk/find_cross_toolchains.lua b/xmake/modules/detect/sdks/find_cross_toolchains.lua index 0e989d6e7..0e989d6e7 100644 --- a/xmake/modules/detect/sdk/find_cross_toolchains.lua +++ b/xmake/modules/detect/sdks/find_cross_toolchains.lua diff --git a/xmake/modules/detect/sdk/find_ndk_sdkvers.lua b/xmake/modules/detect/sdks/find_ndk_sdkvers.lua index 16ad5eca7..16ad5eca7 100644 --- a/xmake/modules/detect/sdk/find_ndk_sdkvers.lua +++ b/xmake/modules/detect/sdks/find_ndk_sdkvers.lua diff --git a/xmake/modules/detect/sdk/find_ndk_toolchains.lua b/xmake/modules/detect/sdks/find_ndk_toolchains.lua index f7d5b7430..f7d5b7430 100644 --- a/xmake/modules/detect/sdk/find_ndk_toolchains.lua +++ b/xmake/modules/detect/sdks/find_ndk_toolchains.lua diff --git a/xmake/modules/detect/sdk/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 1a06d1e90..1a06d1e90 100644 --- a/xmake/modules/detect/sdk/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua diff --git a/xmake/modules/detect/sdk/find_xcode_dir.lua b/xmake/modules/detect/sdks/find_xcode_dir.lua index 728ba1245..728ba1245 100644 --- a/xmake/modules/detect/sdk/find_xcode_dir.lua +++ b/xmake/modules/detect/sdks/find_xcode_dir.lua diff --git a/xmake/modules/detect/sdk/find_xcode_sdkvers.lua b/xmake/modules/detect/sdks/find_xcode_sdkvers.lua index fb479208c..a8ef1a816 100644 --- a/xmake/modules/detect/sdk/find_xcode_sdkvers.lua +++ b/xmake/modules/detect/sdks/find_xcode_sdkvers.lua @@ -24,7 +24,7 @@ -- imports import("core.project.config") -import("detect.sdk.find_xcode_dir") +import("detect.sdks.find_xcode_dir") -- find xcode sdk versions for the given platform -- diff --git a/xmake/modules/detect/tool/find_7z.lua b/xmake/modules/detect/tools/find_7z.lua index bc5c3d340..bc5c3d340 100644 --- a/xmake/modules/detect/tool/find_7z.lua +++ b/xmake/modules/detect/tools/find_7z.lua diff --git a/xmake/modules/detect/tool/find_ar.lua b/xmake/modules/detect/tools/find_ar.lua index 6bbf840c5..6bbf840c5 100644 --- a/xmake/modules/detect/tool/find_ar.lua +++ b/xmake/modules/detect/tools/find_ar.lua diff --git a/xmake/modules/detect/tool/find_brew.lua b/xmake/modules/detect/tools/find_brew.lua index e4c07403f..e4c07403f 100644 --- a/xmake/modules/detect/tool/find_brew.lua +++ b/xmake/modules/detect/tools/find_brew.lua diff --git a/xmake/modules/detect/tool/find_ccache.lua b/xmake/modules/detect/tools/find_ccache.lua index 9e4fe4aa6..9e4fe4aa6 100644 --- a/xmake/modules/detect/tool/find_ccache.lua +++ b/xmake/modules/detect/tools/find_ccache.lua diff --git a/xmake/modules/detect/tool/find_cl.lua b/xmake/modules/detect/tools/find_cl.lua index 3ab7cf5c1..3ab7cf5c1 100644 --- a/xmake/modules/detect/tool/find_cl.lua +++ b/xmake/modules/detect/tools/find_cl.lua diff --git a/xmake/modules/detect/tool/find_clang.lua b/xmake/modules/detect/tools/find_clang.lua index 5e1dc95d4..5e1dc95d4 100644 --- a/xmake/modules/detect/tool/find_clang.lua +++ b/xmake/modules/detect/tools/find_clang.lua diff --git a/xmake/modules/detect/tool/find_clangxx.lua b/xmake/modules/detect/tools/find_clangxx.lua index 77e80304f..77e80304f 100644 --- a/xmake/modules/detect/tool/find_clangxx.lua +++ b/xmake/modules/detect/tools/find_clangxx.lua diff --git a/xmake/modules/detect/tool/find_curl.lua b/xmake/modules/detect/tools/find_curl.lua index a5ba49e20..a5ba49e20 100644 --- a/xmake/modules/detect/tool/find_curl.lua +++ b/xmake/modules/detect/tools/find_curl.lua diff --git a/xmake/modules/detect/tool/find_dmd.lua b/xmake/modules/detect/tools/find_dmd.lua index f244c0ad0..f244c0ad0 100644 --- a/xmake/modules/detect/tool/find_dmd.lua +++ b/xmake/modules/detect/tools/find_dmd.lua diff --git a/xmake/modules/detect/tool/find_doxygen.lua b/xmake/modules/detect/tools/find_doxygen.lua index 5824c574c..5824c574c 100644 --- a/xmake/modules/detect/tool/find_doxygen.lua +++ b/xmake/modules/detect/tools/find_doxygen.lua diff --git a/xmake/modules/detect/tool/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua index d7cbce7d2..d7cbce7d2 100644 --- a/xmake/modules/detect/tool/find_gcc.lua +++ b/xmake/modules/detect/tools/find_gcc.lua diff --git a/xmake/modules/detect/tool/find_gccgo.lua b/xmake/modules/detect/tools/find_gccgo.lua index a12be3067..a12be3067 100644 --- a/xmake/modules/detect/tool/find_gccgo.lua +++ b/xmake/modules/detect/tools/find_gccgo.lua diff --git a/xmake/modules/detect/tool/find_gdb.lua b/xmake/modules/detect/tools/find_gdb.lua index 3e698022a..3e698022a 100644 --- a/xmake/modules/detect/tool/find_gdb.lua +++ b/xmake/modules/detect/tools/find_gdb.lua diff --git a/xmake/modules/detect/tool/find_gdc.lua b/xmake/modules/detect/tools/find_gdc.lua index a2b2b4c9a..a2b2b4c9a 100644 --- a/xmake/modules/detect/tool/find_gdc.lua +++ b/xmake/modules/detect/tools/find_gdc.lua diff --git a/xmake/modules/detect/tool/find_git.lua b/xmake/modules/detect/tools/find_git.lua index b21455b0c..b21455b0c 100644 --- a/xmake/modules/detect/tool/find_git.lua +++ b/xmake/modules/detect/tools/find_git.lua diff --git a/xmake/modules/detect/tool/find_go.lua b/xmake/modules/detect/tools/find_go.lua index 0b1b9103e..0b1b9103e 100644 --- a/xmake/modules/detect/tool/find_go.lua +++ b/xmake/modules/detect/tools/find_go.lua diff --git a/xmake/modules/detect/tool/find_gxx.lua b/xmake/modules/detect/tools/find_gxx.lua index 5ab35fa44..5ab35fa44 100644 --- a/xmake/modules/detect/tool/find_gxx.lua +++ b/xmake/modules/detect/tools/find_gxx.lua diff --git a/xmake/modules/detect/tool/find_gzip.lua b/xmake/modules/detect/tools/find_gzip.lua index 95d364971..95d364971 100644 --- a/xmake/modules/detect/tool/find_gzip.lua +++ b/xmake/modules/detect/tools/find_gzip.lua diff --git a/xmake/modules/detect/tool/find_ldc2.lua b/xmake/modules/detect/tools/find_ldc2.lua index 8b2f42c5d..8b2f42c5d 100644 --- a/xmake/modules/detect/tool/find_ldc2.lua +++ b/xmake/modules/detect/tools/find_ldc2.lua diff --git a/xmake/modules/detect/tool/find_lib.lua b/xmake/modules/detect/tools/find_lib.lua index 107c33cbb..107c33cbb 100644 --- a/xmake/modules/detect/tool/find_lib.lua +++ b/xmake/modules/detect/tools/find_lib.lua diff --git a/xmake/modules/detect/tool/find_link.lua b/xmake/modules/detect/tools/find_link.lua index d30fe6fbe..d30fe6fbe 100644 --- a/xmake/modules/detect/tool/find_link.lua +++ b/xmake/modules/detect/tools/find_link.lua diff --git a/xmake/modules/detect/tool/find_lipo.lua b/xmake/modules/detect/tools/find_lipo.lua index 27be94c1f..27be94c1f 100644 --- a/xmake/modules/detect/tool/find_lipo.lua +++ b/xmake/modules/detect/tools/find_lipo.lua diff --git a/xmake/modules/detect/tool/find_lldb.lua b/xmake/modules/detect/tools/find_lldb.lua index 8a6e86341..8a6e86341 100644 --- a/xmake/modules/detect/tool/find_lldb.lua +++ b/xmake/modules/detect/tools/find_lldb.lua diff --git a/xmake/modules/detect/tool/find_ml.lua b/xmake/modules/detect/tools/find_ml.lua index da3f026ac..da3f026ac 100644 --- a/xmake/modules/detect/tool/find_ml.lua +++ b/xmake/modules/detect/tools/find_ml.lua diff --git a/xmake/modules/detect/tool/find_ml64.lua b/xmake/modules/detect/tools/find_ml64.lua index d2377c19e..d2377c19e 100644 --- a/xmake/modules/detect/tool/find_ml64.lua +++ b/xmake/modules/detect/tools/find_ml64.lua diff --git a/xmake/modules/detect/tool/find_ollydbg.lua b/xmake/modules/detect/tools/find_ollydbg.lua index 636f52932..636f52932 100644 --- a/xmake/modules/detect/tool/find_ollydbg.lua +++ b/xmake/modules/detect/tools/find_ollydbg.lua diff --git a/xmake/modules/detect/tool/find_pkg_config.lua b/xmake/modules/detect/tools/find_pkg_config.lua index 8bbad9f3f..8bbad9f3f 100644 --- a/xmake/modules/detect/tool/find_pkg_config.lua +++ b/xmake/modules/detect/tools/find_pkg_config.lua diff --git a/xmake/modules/detect/tool/find_rc.lua b/xmake/modules/detect/tools/find_rc.lua index cbd24e82a..cbd24e82a 100644 --- a/xmake/modules/detect/tool/find_rc.lua +++ b/xmake/modules/detect/tools/find_rc.lua diff --git a/xmake/modules/detect/tool/find_rustc.lua b/xmake/modules/detect/tools/find_rustc.lua index d01380d72..d01380d72 100644 --- a/xmake/modules/detect/tool/find_rustc.lua +++ b/xmake/modules/detect/tools/find_rustc.lua diff --git a/xmake/modules/detect/tool/find_sudo.lua b/xmake/modules/detect/tools/find_sudo.lua index 3306f2fd3..3306f2fd3 100644 --- a/xmake/modules/detect/tool/find_sudo.lua +++ b/xmake/modules/detect/tools/find_sudo.lua diff --git a/xmake/modules/detect/tool/find_swiftc.lua b/xmake/modules/detect/tools/find_swiftc.lua index cf9373739..cf9373739 100644 --- a/xmake/modules/detect/tool/find_swiftc.lua +++ b/xmake/modules/detect/tools/find_swiftc.lua diff --git a/xmake/modules/detect/tool/find_tar.lua b/xmake/modules/detect/tools/find_tar.lua index f37843171..f37843171 100644 --- a/xmake/modules/detect/tool/find_tar.lua +++ b/xmake/modules/detect/tools/find_tar.lua diff --git a/xmake/modules/detect/tool/find_unzip.lua b/xmake/modules/detect/tools/find_unzip.lua index c3533cd54..c3533cd54 100644 --- a/xmake/modules/detect/tool/find_unzip.lua +++ b/xmake/modules/detect/tools/find_unzip.lua diff --git a/xmake/modules/detect/tool/find_vsjitdebugger.lua b/xmake/modules/detect/tools/find_vsjitdebugger.lua index 879fd0a5d..879fd0a5d 100644 --- a/xmake/modules/detect/tool/find_vsjitdebugger.lua +++ b/xmake/modules/detect/tools/find_vsjitdebugger.lua diff --git a/xmake/modules/detect/tool/find_wget.lua b/xmake/modules/detect/tools/find_wget.lua index 5f8dd7594..5f8dd7594 100644 --- a/xmake/modules/detect/tool/find_wget.lua +++ b/xmake/modules/detect/tools/find_wget.lua diff --git a/xmake/modules/detect/tool/find_windbg.lua b/xmake/modules/detect/tools/find_windbg.lua index 323855d79..323855d79 100644 --- a/xmake/modules/detect/tool/find_windbg.lua +++ b/xmake/modules/detect/tools/find_windbg.lua diff --git a/xmake/modules/detect/tool/find_x64dbg.lua b/xmake/modules/detect/tools/find_x64dbg.lua index 431fea112..431fea112 100644 --- a/xmake/modules/detect/tool/find_x64dbg.lua +++ b/xmake/modules/detect/tools/find_x64dbg.lua diff --git a/xmake/modules/detect/tool/find_zip.lua b/xmake/modules/detect/tools/find_zip.lua index 71405d3ff..71405d3ff 100644 --- a/xmake/modules/detect/tool/find_zip.lua +++ b/xmake/modules/detect/tools/find_zip.lua diff --git a/xmake/modules/devel/debugger/run.lua b/xmake/modules/devel/debugger/run.lua index a94f7852f..417d104ed 100644 --- a/xmake/modules/devel/debugger/run.lua +++ b/xmake/modules/devel/debugger/run.lua @@ -25,12 +25,12 @@ -- imports import("core.base.option") import("core.project.config") -import("detect.tool.find_gdb") -import("detect.tool.find_lldb") -import("detect.tool.find_windbg") -import("detect.tool.find_x64dbg") -import("detect.tool.find_ollydbg") -import("detect.tool.find_vsjitdebugger") +import("detect.tools.find_gdb") +import("detect.tools.find_lldb") +import("detect.tools.find_windbg") +import("detect.tools.find_x64dbg") +import("detect.tools.find_ollydbg") +import("detect.tools.find_vsjitdebugger") -- run gdb function _run_gdb(program, argv) diff --git a/xmake/modules/devel/git/checkout.lua b/xmake/modules/devel/git/checkout.lua index a69801711..02f6c657e 100644 --- a/xmake/modules/devel/git/checkout.lua +++ b/xmake/modules/devel/git/checkout.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_git") +import("detect.tools.find_git") -- checkout to given branch, tag or commit -- diff --git a/xmake/modules/devel/git/clean.lua b/xmake/modules/devel/git/clean.lua index dcc94c805..d6eff80bd 100644 --- a/xmake/modules/devel/git/clean.lua +++ b/xmake/modules/devel/git/clean.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_git") +import("detect.tools.find_git") -- clean files -- diff --git a/xmake/modules/devel/git/clone.lua b/xmake/modules/devel/git/clone.lua index c717065b8..9e17a69b0 100644 --- a/xmake/modules/devel/git/clone.lua +++ b/xmake/modules/devel/git/clone.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_git") +import("detect.tools.find_git") -- clone url -- diff --git a/xmake/modules/devel/git/ls_remote.lua b/xmake/modules/devel/git/ls_remote.lua index 6ffb77d10..1f41c6e84 100644 --- a/xmake/modules/devel/git/ls_remote.lua +++ b/xmake/modules/devel/git/ls_remote.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_git") +import("detect.tools.find_git") -- ls_remote to given branch, tag or commit -- diff --git a/xmake/modules/devel/git/pull.lua b/xmake/modules/devel/git/pull.lua index 5874ae460..504d64ebd 100644 --- a/xmake/modules/devel/git/pull.lua +++ b/xmake/modules/devel/git/pull.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_git") +import("detect.tools.find_git") -- pull remote commits -- diff --git a/xmake/modules/lib/detect/find_tool.lua b/xmake/modules/lib/detect/find_tool.lua index 0911bea20..3cc07b071 100644 --- a/xmake/modules/lib/detect/find_tool.lua +++ b/xmake/modules/lib/detect/find_tool.lua @@ -25,26 +25,17 @@ -- imports import("lib.detect.find_program") import("lib.detect.find_programver") +import("lib.detect.find_toolname") -- find tool from modules function _find_from_modules(name, opt) - -- strip arguments with spaces - name = name:split("%s+")[1] - - -- replace "+" to "x" - name = name:gsub("%+", "x") - - -- strip suffix on windows - if os.host() == "windows" and name:endswith(".exe") then - name = name:sub(1, #name - 4) - end - - -- "detect.tool.find_xxx" exists? - if os.isfile(path.join(os.programdir(), "modules", "detect", "tool", "find_" .. name .. ".lua")) then - local find_tool = import("detect.tool.find_" .. name) + -- "detect.tools.find_xxx" exists? + if os.isfile(path.join(os.programdir(), "modules", "detect", "tools", "find_" .. name .. ".lua")) then + local find_tool = import("detect.tools.find_" .. name) if find_tool then - return find_tool(opt) + local program, version = find_tool(opt) + return {name = name, program = program, version = version} end end end @@ -54,7 +45,7 @@ end -- @param name the tool name -- @param opt the options, .e.g {program = "xcrun -sdk macosx clang", pathes = {"/usr/bin"}, check = function (tool) os.run("%s -h", tool) end, version = true} -- --- @return the tool name or path, version +-- @return {name = "", program = "", version = ""} -- -- @code -- @@ -65,7 +56,7 @@ end -- local tool = find_tool("clang", {check = function (tool) os.run("%s -h", tool) end}) -- local tool = find_tool("clang", {pathes = {"$(env PATH)", "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}}) -- local tool = find_tool("clang", {pathes = {"$(env PATH)", function () return "/usr/bin"end}}) --- local tool, version = find_tool("ccache", {version = true}) +-- local tool = find_tool("ccache", {version = true}) -- -- @endcode -- @@ -74,21 +65,30 @@ function main(name, opt) -- init options opt = opt or {} + -- find tool name + local toolname = find_toolname(name or opt.program) + if not toolname then + return + end + + -- init program + opt.program = opt.program or name + -- attempt to find tool from modules first - local tool, version = _find_from_modules(name, opt) + local tool = _find_from_modules(toolname, opt) if tool then - return tool, version + return tool end -- find tool - tool = find_program(opt.program or name, opt.pathes, opt.check) + local program = find_program(opt.program, opt.pathes, opt.check) -- find tool version local version = nil - if tool and opt.version then - version = find_programver(tool) + if program and opt.version then + version = find_programver(program) end -- ok? - return tool, version + return {name = toolname, program = program, version = version} end diff --git a/xmake/modules/lib/detect/find_toolname.lua b/xmake/modules/lib/detect/find_toolname.lua index 1d8ce4d04..ce3b4f1f1 100644 --- a/xmake/modules/lib/detect/find_toolname.lua +++ b/xmake/modules/lib/detect/find_toolname.lua @@ -25,6 +25,14 @@ -- find tool name from the given program function _find(program) + -- get tool directory + local tooldir = path.join(os.programdir(), "modules", "detect", "tools") + + -- attempt to find it directly first + if os.isfile(path.join(tooldir, "find_" .. program .. ".lua")) then + return program + end + -- get file name first name = path.filename(program):lower() @@ -40,9 +48,6 @@ function _find(program) -- remove suffix: ".xxx" name = name:gsub("%.%w+", "") - -- get tool directory - local tooldir = path.join(os.programdir(), "modules", "detect", "tool") - -- find_toolname.lua exists? found local toolname = name:gsub("[%+%-]", function (ch) return ifelse(ch == "+", "x", "_") end) if os.isfile(path.join(tooldir, "find_" .. toolname .. ".lua")) then diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua new file mode 100644 index 000000000..6aad9b7a8 --- /dev/null +++ b/xmake/modules/lib/detect/has_flags.lua @@ -0,0 +1,101 @@ +--!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 ruki +-- @file has_flags.lua +-- + +-- imports +import("lib.detect.find_tool") + +-- has this flag? +function _has_flag(name, flag, opt) + + -- find tool program and version first + opt.version = true + local tool = find_tool(name, opt) + if not tool then + return false + end + + -- init program and version + opt.program = tool.program + opt.version = tool.version + + -- init cache and key + local key = opt.program .. "_" .. (opt.version or "") .. "_" .. flag + local results = _g._RESULTS or {} + + -- get result from the cache first + local result = results[key] + if result ~= nil then + return result + end + + -- "detect.tools.find_xxx" exists? + local result = nil + if os.isfile(path.join(os.programdir(), "modules", "detect", "flags", tool.name .. ".lua")) then + local has_flag_for_tool = import("detect.flags." .. tool.name) + if has_flag_for_tool then + result = has_flag_for_tool(flag, opt) + end + end + + -- attempt to check it directly + if result == nil then + result = try { function () os.runv(opt.program, {flag}); return true end } + end + + -- save result to cache + results[key] = ifelse(result, result, false) + _g._RESULTS = results + + -- ok? + return result +end + +-- has the given flags for the current tool? +-- +-- @param name the tool name +-- @param flags the flags +-- @param opt the argument options, .e.g {program = ""} +-- +-- @return true or false +-- +-- @code +-- local ok = has_flags("clang", "-g") +-- local ok = has_flags("clang", {"-g", "-O0"}, {program = "xcrun -sdk macosx clang"}) +-- @endcode +-- +function main(name, flags, opt) + + -- init options + opt = opt or {} + + -- has all flags? + for _, flag in ipairs(flags) do + if not _has_flag(name, flag, opt) then + return false + end + end + + -- ok + return true +end diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua index 5b595b50d..322977dbd 100644 --- a/xmake/modules/lib/detect/pkg_config.lua +++ b/xmake/modules/lib/detect/pkg_config.lua @@ -24,8 +24,8 @@ -- imports import("lib.detect.find_library") -import("detect.tool.find_brew") -import("detect.tool.find_pkg_config") +import("detect.tools.find_brew") +import("detect.tools.find_pkg_config") -- get package info -- diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua index 66e211578..e5cc6c14d 100644 --- a/xmake/modules/net/http/download.lua +++ b/xmake/modules/net/http/download.lua @@ -24,8 +24,8 @@ -- imports import("core.base.option") -import("detect.tool.find_curl") -import("detect.tool.find_wget") +import("detect.tools.find_curl") +import("detect.tools.find_wget") -- download url using curl function _curl_download(program, url, outputfile) diff --git a/xmake/modules/privilege/sudo.lua b/xmake/modules/privilege/sudo.lua index 5116fa29d..0a8816098 100644 --- a/xmake/modules/privilege/sudo.lua +++ b/xmake/modules/privilege/sudo.lua @@ -24,7 +24,7 @@ -- imports import("core.base.option") -import("detect.tool.find_sudo") +import("detect.tools.find_sudo") -- sudo run command with administrator permission -- diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index e350ff636..4672c2442 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -25,10 +25,10 @@ -- imports import("core.base.option") import("lib.detect.find_file") -import("detect.tool.find_7z") -import("detect.tool.find_tar") -import("detect.tool.find_gzip") -import("detect.tool.find_unzip") +import("detect.tools.find_7z") +import("detect.tools.find_tar") +import("detect.tools.find_gzip") +import("detect.tools.find_unzip") -- extract archivefile using tar function _extract_using_tar(archivefile, outputdir, extension) |
