Build: Add Category and possibility to excludes whole category with one command

This commit is contained in:
Lynix 2017-12-02 14:24:35 +01:00
parent 5ba0d0dba0
commit 547ad8682f
3 changed files with 31 additions and 7 deletions

View File

@ -463,7 +463,7 @@ function NazaraBuild:Initialize()
if (self:Process(projectTable)) then if (self:Process(projectTable)) then
table.insert(orderedTables[k], projectTable) table.insert(orderedTables[k], projectTable)
else else
print("Rejected " .. projectTable.Name .. " " .. string.lower(projectTable.Type) .. ": " .. projectTable.ExcludeReason) print("Rejected " .. projectTable.Name .. " " .. string.lower(projectTable.Category) .. ": " .. projectTable.ExcludeReason)
end end
end end
@ -664,7 +664,7 @@ function NazaraBuild:Process(infoTable)
if (libraryTable) then if (libraryTable) then
if (libraryTable.Excluded) then if (libraryTable.Excluded) then
infoTable.Excluded = true infoTable.Excluded = true
infoTable.ExcludeReason = "depends on excluded " .. library .. " " .. libraryTable.Type:lower() infoTable.ExcludeReason = "depends on excluded " .. library .. " " .. libraryTable.Category:lower()
return false return false
end end
@ -927,6 +927,8 @@ function NazaraBuild:RegisterExample(exampleTable)
exampleTable.Files = files exampleTable.Files = files
exampleTable.Type = "Example" exampleTable.Type = "Example"
exampleTable.Category = exampleTable.Category or exampleTable.Type
self.Examples[lowerCaseName] = exampleTable self.Examples[lowerCaseName] = exampleTable
return true return true
end end
@ -950,6 +952,8 @@ function NazaraBuild:RegisterExternLibrary(libTable)
end end
libTable.Type = "ExternLib" libTable.Type = "ExternLib"
libTable.Category = libTable.Category or libTable.Type
self.ExtLibs[lowerCaseName] = libTable self.ExtLibs[lowerCaseName] = libTable
return true return true
end end
@ -976,6 +980,8 @@ function NazaraBuild:RegisterModule(moduleTable)
end end
moduleTable.Type = "Module" moduleTable.Type = "Module"
moduleTable.Category = moduleTable.Category or moduleTable.Type
self.Modules[lowerCaseName] = moduleTable self.Modules[lowerCaseName] = moduleTable
return true return true
end end
@ -1006,10 +1012,13 @@ function NazaraBuild:RegisterTool(toolTable)
end end
toolTable.Type = "Tool" toolTable.Type = "Tool"
toolTable.Category = toolTable.Category or toolTable.Type
self.Tools[lowerCaseName] = toolTable self.Tools[lowerCaseName] = toolTable
return true return true
end end
local globalExcludes = {}
function NazaraBuild:Resolve(infoTable) function NazaraBuild:Resolve(infoTable)
if (infoTable.ClientOnly and self.Config["ServerMode"]) then if (infoTable.ClientOnly and self.Config["ServerMode"]) then
infoTable.Excluded = true infoTable.Excluded = true
@ -1017,15 +1026,28 @@ function NazaraBuild:Resolve(infoTable)
end end
if (infoTable.Excludable) then if (infoTable.Excludable) then
local optionName = "excludes-" .. string.lower(infoTable.Type .. "-" .. infoTable.Name) local globalExcludeOption = "excludes-" .. infoTable.Category:lower() .. "s"
if (not globalExcludes[infoTable.Category]) then
newoption({ newoption({
trigger = optionName, trigger = globalExcludeOption,
description = "Excludes the " .. infoTable.Name .. " " .. string.lower(infoTable.Type) .. " and projects relying on it" description = "Excludes all " .. string.lower(infoTable.Category) .. "s and projects relying on it"
}) })
if (_OPTIONS[optionName]) then globalExcludes[infoTable.Category] = true
end
local specificExcludeOption = "excludes-" .. string.lower(infoTable.Category .. "-" .. infoTable.Name)
newoption({
trigger = specificExcludeOption,
description = "Excludes the " .. infoTable.Name .. " " .. string.lower(infoTable.Category) .. " and projects relying on it"
})
if (_OPTIONS[globalExcludeOption]) then
infoTable.Excluded = true infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by command-line options" infoTable.ExcludeReason = "excluded by global command-line options"
elseif (_OPTIONS[specificExcludeOption]) then
infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by specific command-line options"
end end
end end

View File

@ -1,5 +1,6 @@
TOOL.Name = "UnitTests" TOOL.Name = "UnitTests"
TOOL.Category = "Test"
TOOL.Directory = "../tests" TOOL.Directory = "../tests"
TOOL.EnableConsole = true TOOL.EnableConsole = true
TOOL.Kind = "Application" TOOL.Kind = "Application"

View File

@ -1,5 +1,6 @@
TOOL.Name = "UnitTestsServer" TOOL.Name = "UnitTestsServer"
TOOL.Category = "Test"
TOOL.Directory = "../tests" TOOL.Directory = "../tests"
TOOL.EnableConsole = true TOOL.EnableConsole = true
TOOL.Kind = "Application" TOOL.Kind = "Application"