Validate NuGet package strings

This commit is contained in:
Aleksi Juvani 2017-04-11 14:08:40 +03:00
parent 8286a7b9b6
commit 87f527c1df

View File

@ -62,6 +62,7 @@
m.projectRulesExist,
m.projectValuesInScope,
m.NuGetHasHTTP,
m.NuGetPackageStrings,
}
end
@ -231,6 +232,17 @@
end
function m.NuGetPackageStrings(prj)
for _, package in ipairs(prj.nuget) do
local components = package:explode(":")
if #components ~= 2 or #components[1] == 0 or #components[2] == 0 then
p.error("NuGet package '%s' in project '%s' is invalid - please give packages in the format 'id:version', e.g. 'NUnit:3.6.1'", package, prj.name)
end
end
end
function m.uniqueProjectIds(wks)
local uuids = {}
for prj in p.workspace.eachproject(wks) do