Add 'premake.isSemVer' method.
This commit is contained in:
parent
1268d8eb4c
commit
c235647f16
@ -149,8 +149,7 @@
|
|||||||
|
|
||||||
-- try to parse semver, if it fails, it's not semver compatible and we cannot compare, in which case
|
-- try to parse semver, if it fails, it's not semver compatible and we cannot compare, in which case
|
||||||
-- we're going to ignore the checkVersion entirely, but warn.
|
-- we're going to ignore the checkVersion entirely, but warn.
|
||||||
local sMajor, sMinor, sPatch, sPrereleaseAndBuild = version:match("^(%d+)%.?(%d*)%.?(%d*)(.-)$")
|
if not premake.isSemVer(version) then
|
||||||
if (type(sMajor) ~= 'string') then
|
|
||||||
p.warn("'" .. version .. "' is not semver compatible, and cannot be compared against '" .. checks .. "'.");
|
p.warn("'" .. version .. "' is not semver compatible, and cannot be compared against '" .. checks .. "'.");
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -403,3 +402,13 @@
|
|||||||
return string.format("%s(%d)", info.short_src, info.currentline)
|
return string.format("%s(%d)", info.short_src, info.currentline)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- check if version is semver.
|
||||||
|
---
|
||||||
|
|
||||||
|
function premake.isSemVer(version)
|
||||||
|
local sMajor, sMinor, sPatch, sPrereleaseAndBuild = version:match("^(%d+)%.?(%d*)%.?(%d*)(.-)$")
|
||||||
|
return (type(sMajor) == 'string')
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user