diff options
| author | ruki <[email protected]> | 2019-12-22 21:32:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-12-22 21:32:25 +0800 |
| commit | 0f8eeca545c499c6e018138a93603043ed109eb3 (patch) | |
| tree | 6769acfa7d10f9dcad08fc11104c5508ef1d974e | |
| parent | ce6908e8241190e498b4dd5f06125ef8da894451 (diff) | |
improve to find android sdk
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/semver.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/detect/sdks/find_android_sdk.lua | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/import/core/base/semver.lua b/xmake/core/sandbox/modules/import/core/base/semver.lua index 6e4c78fb2..8ab0844a1 100644 --- a/xmake/core/sandbox/modules/import/core/base/semver.lua +++ b/xmake/core/sandbox/modules/import/core/base/semver.lua @@ -48,6 +48,11 @@ function sandbox_core_base_semver.parse(version) return result end +-- is valid version? +function sandbox_core_base_semver.is_valid(version) + return semver.parse(version) ~= nil +end + -- compare two version strings -- -- semver.compare('1.2.3', '1.3.0') > 0? diff --git a/xmake/modules/detect/sdks/find_android_sdk.lua b/xmake/modules/detect/sdks/find_android_sdk.lua index ba63d74d4..b723c1859 100644 --- a/xmake/modules/detect/sdks/find_android_sdk.lua +++ b/xmake/modules/detect/sdks/find_android_sdk.lua @@ -50,7 +50,7 @@ function _find_sdk_build_toolver(sdkdir) local toolver_max = "0" for _, dir in ipairs(os.dirs(path.join(sdkdir, "build-tools", "*"))) do local toolver = path.filename(dir) - if semver.compare(toolver, toolver_max) > 0 then + if semver.is_valid(toolver) and semver.compare(toolver, toolver_max) > 0 then toolver_max = toolver end end |
