diff options
| -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 |
