Build: Remake exclusion system

Allows to excludes pretty much everything and now also excludes projects
relying on an excluded dependency


Former-commit-id: abb175217d473b85f4add760e13fde3f2c6ff9fa [formerly 27ee2d61414ed907c8d828e5862b97ee40008f85]
Former-commit-id: 48bce8d17f8f6c3e761eff000724c60735541ebe
This commit is contained in:
Lynix 2016-06-12 10:03:05 +02:00
parent 4841a1d7d4
commit 3a1498b9a4
2 changed files with 58 additions and 55 deletions

View File

@ -519,14 +519,6 @@ function NazaraBuild:Initialize()
local moduleName = v:match(".*/(.*).lua")
local moduleNameLower = moduleName:lower()
if (moduleNameLower ~= "core") then -- exclure le noyau n'aurait aucun sens
newoption({
trigger = "exclude-" .. moduleNameLower,
description = "Exclude the " .. moduleName .. " module from the build system"
})
end
if (not _OPTIONS["exclude-" .. moduleNameLower]) then
local f, err = loadfile(v)
if (f) then
MODULE = {}
@ -542,7 +534,6 @@ function NazaraBuild:Initialize()
print("Unable to load module file: " .. err)
end
end
end
MODULE = nil
-- Continue with the tools (ex: SDK)
@ -551,12 +542,6 @@ function NazaraBuild:Initialize()
local toolName = v:match(".*/(.*).lua")
local toolNameLower = toolName:lower()
newoption({
trigger = "exclude-" .. toolNameLower,
description = "Exclude the " .. toolName .. " tool from the build system"
})
if (not _OPTIONS["exclude-" .. toolNameLower]) then
local f, err = loadfile(v)
if (f) then
TOOL = {}
@ -572,7 +557,6 @@ function NazaraBuild:Initialize()
print("Unable to load tool file: " .. err)
end
end
end
TOOL = nil
-- Examples
@ -618,7 +602,7 @@ function NazaraBuild:Initialize()
if (self:Process(projectTable)) then
table.insert(orderedTables[k], projectTable)
else
print("Rejected client-only " .. projectTable.Name .. " " .. projectTable.Type)
print("Rejected " .. projectTable.Name .. " " .. string.lower(projectTable.Type) .. ": " .. projectTable.ExcludeReason)
end
end
@ -780,20 +764,17 @@ local PosixOSes = {
}
function NazaraBuild:Process(infoTable)
if (infoTable.ClientOnly and _OPTIONS["server"]) then
return false
end
local libraries = {}
for k, library in pairs(infoTable.Libraries) do
local moduleName = library:match("Nazara(%w+)")
local moduleTable = moduleName and self.Modules[moduleName:lower()]
local toolTable = moduleName and self.Tools[moduleName:lower()]
local projectName = library:match("Nazara(%w+)")
local moduleTable = projectName and self.Modules[projectName:lower()]
local toolTable = projectName and self.Tools[projectName:lower()]
if (moduleTable) then
if (moduleTable.ClientOnly and _OPTIONS["server"]) then
infoTable.ClientOnly = true
return false -- We depend on a client-only library
if (moduleTable.Excluded) then
infoTable.Excluded = true
infoTable.ExcludeReason = "depends on excluded " .. projectName .. " module"
return false
end
if (_OPTIONS["united"]) then
@ -811,9 +792,10 @@ function NazaraBuild:Process(infoTable)
else
local extLibTable = self.ExtLibs[library:lower()]
if (extLibTable) then
if (extLibTable.ClientOnly and _OPTIONS["server"]) then
infoTable.ClientOnly = true
return false -- We depend on a client-only library
if (extLibTable.Excluded) then
infoTable.Excluded = true
infoTable.ExcludeReason = "depends on excluded " .. extLibTable.Name .. " external library"
return false
end
library = extLibTable.Name
@ -824,9 +806,10 @@ function NazaraBuild:Process(infoTable)
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library .. "-s")
else
if (toolTable and toolTable.Kind == "library") then
if (toolTable.ClientOnly and _OPTIONS["server"]) then
infoTable.ClientOnly = true
return false -- We depend on a client-only library
if (toolTable.Excluded) then
infoTable.Excluded = true
infoTable.ExcludeReason = "depends on excluded " .. toolTable.Name .. " tool"
return false
end
library = "Nazara" .. toolTable.Name
@ -894,6 +877,24 @@ function NazaraBuild:Process(infoTable)
end
function NazaraBuild:Resolve(infoTable)
if (infoTable.ClientOnly and _OPTIONS["server"]) then
infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by command-line options (client-only)"
end
if (infoTable.Excludable) then
local optionName = "excludes-" .. string.lower(infoTable.Type .. "-" .. infoTable.Name)
newoption({
trigger = optionName,
description = "Excludes the " .. infoTable.Name .. " " .. string.lower(infoTable.Type) .. " and projects relying on it"
})
if (_OPTIONS[optionName]) then
infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by command-line options"
end
end
if (type(infoTable.Libraries) == "function") then
infoTable.Libraries = infoTable.Libraries()
end
@ -932,6 +933,7 @@ function NazaraBuild:MakeCopyAfterBuild(infoTable)
end
function NazaraBuild:SetupInfoTable(infoTable)
infoTable.Excludable = true
infoTable.ConfigurationLibraries = {}
infoTable.ConfigurationLibraries.DebugStatic = {}
infoTable.ConfigurationLibraries.ReleaseStatic = {}

View File

@ -1,6 +1,7 @@
MODULE.Name = "Core"
MODULE.Excludable = false -- Excluding the core makes no sense as everything relies on it
MODULE.Files = { -- Les autres fichiers seront ajoutés automatiquement
MODULE.Files = { -- Other files will be automatically added
"../include/Nazara/Prerequesites.hpp",
"../include/Nazara/Math/**.hpp",
"../include/Nazara/Math/**.inl",