Split xcodeembedlibraries into embed and embedAndSign

This commit is contained in:
Nick Gravelyn 2021-04-16 07:50:04 -07:00
parent 4ed74246b5
commit 626eedbc46
4 changed files with 39 additions and 46 deletions

View File

@ -47,9 +47,15 @@
}
p.api.register {
name = "xcodeembedlibraries",
name = "embed",
scope = "config",
kind = "key-string",
kind = "list",
}
p.api.register {
name = "embedAndSign",
scope = "config",
kind = "list",
}
--

View File

@ -73,10 +73,7 @@
kind "SharedLib"
project "MyProject"
xcodeembedlibraries
{
["MyProject2"] = "embed"
}
embed { "MyProject2" }
prepare()
xcode.PBXBuildFile(tr)
@ -92,10 +89,7 @@
kind "SharedLib"
project "MyProject"
xcodeembedlibraries
{
["MyProject2"] = "embed-and-sign"
}
embedAndSign { "MyProject2" }
prepare()
xcode.PBXBuildFile(tr)
@ -212,10 +206,7 @@
kind "SharedLib"
project "MyProject"
xcodeembedlibraries
{
["MyProject2"] = "embed"
}
embed { "MyProject2" }
prepare()
xcode.PBXCopyFilesBuildPhaseForEmbedFrameworks(tr)

View File

@ -128,12 +128,15 @@
"../D.framework",
"../E.framework",
}
xcodeembedlibraries
embedAndSign
{
["libA.dylib"] = "embed-and-sign",
["libB.dylib"] = "embed",
["D.framework"] = "embed-and-sign",
["E.framework"] = "embed",
"libA.dylib",
"D.framework",
}
embed
{
"libB.dylib",
"E.framework",
}
prepare()
xcode.PBXBuildFile(tr)
@ -586,11 +589,8 @@
"../libA.dylib",
"../D.framework",
}
xcodeembedlibraries
{
["libA.dylib"] = "embed",
["D.framework"] = "embed-and-sign",
}
embed { "libA.dylib" }
embedAndSign { "D.framework" }
prepare()
xcode.PBXCopyFilesBuildPhaseForEmbedFrameworks(tr)
test.capture [[

View File

@ -617,44 +617,40 @@
end
function xcode.embedsetting(cfg, node)
if type(cfg.xcodeembedlibraries) == 'table' then
-- Frameworks and dylibs referenced by path are expected
-- to provide the file name (but not path). Project
-- references are expected to provide the project name.
if xcode.isframeworkordylib(node.name) then
local tablekey = node.name
if node.parent.project then
tablekey = node.parent.project.name
end
return cfg.xcodeembedlibraries[tablekey]
end
function xcode.embedListContains(list, node)
-- Frameworks and dylibs referenced by path are expected
-- to provide the file name (but not path). Project
-- references are expected to provide the project name.
local entryname = node.name
if node.parent.project then
entryname = node.parent.project.name
end
return nil
return table.contains(list, entryname)
end
function xcode.shouldembed(tr, node)
if not xcode.isframeworkordylib(node.name) then
return false
end
for _, cfg in ipairs(tr.configs) do
local setting = xcode.embedsetting(cfg, node)
if setting == "embed" or setting == "embed-and-sign" then
if xcode.embedListContains(cfg.embed, node) or xcode.embedListContains(cfg.embedAndSign, node) then
return true
end
end
return false
end
function xcode.shouldembedandsign(tr, node)
if not xcode.isframeworkordylib(node.name) then
return false
end
for _, cfg in ipairs(tr.configs) do
local setting = xcode.embedsetting(cfg, node)
if setting == "embed-and-sign" then
if xcode.embedListContains(cfg.embedAndSign, node) then
return true
end
end
return false
end