Raise error on packages.config conflict

This commit is contained in:
Aleksi Juvani 2017-04-06 17:55:26 +03:00
parent 77463534c9
commit 39720da733

View File

@ -39,6 +39,7 @@
return {
m.workspaceHasConfigs,
m.uniqueProjectIds,
m.uniqueProjectLocationsWithNuGet,
}
end
@ -233,6 +234,29 @@
end
function m.uniqueProjectLocationsWithNuGet(wks)
local locations = {}
for prj in p.workspace.eachproject(wks) do
local function fail()
p.error("projects '%s' and '%s' cannot have the same location when using NuGet with different packages (packages.config conflict)", locations[prj.location].name, prj.name)
end
if locations[prj.location] and #locations[prj.location].nuget > 0 and #prj.nuget > 0 then
if #locations[prj.location].nuget ~= #prj.nuget then
fail()
end
for i, package in ipairs(locations[prj.location].nuget) do
if prj.nuget[i] ~= package then
fail()
end
end
end
locations[prj.location] = prj
end
end
function m.workspaceHasConfigs(wks)
if not wks.configurations or #wks.configurations == 0 then
p.error("workspace '%s' does not contain any configurations", wks.name)