Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xcodesystemcapabilities in xcode4 #1161

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/xcode/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
kind = "string",
}

p.api.register {
name = "xcodesystemcapabilities",
scope = "project",
kind = "key-boolean",
}

p.api.register {
name = "iosfamily",
scope = "config",
Expand Down
44 changes: 44 additions & 0 deletions modules/xcode/tests/test_xcode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,50 @@
end


function suite.PBXProject_OnSystemCapabilities()
xcodesystemcapabilities {
["com.apple.InAppPurchase"] = "ON",
["com.apple.iCloud"] = "ON",
["com.apple.GameCenter.iOS"] = "OFF",
}
prepare()
xcode.PBXProject(tr)
test.capture [[
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
TargetAttributes = {
[MyProject:target] = {
SystemCapabilities = {
com.apple.GameCenter.iOS = {
enabled = 0;
};
com.apple.InAppPurchase = {
enabled = 1;
};
com.apple.iCloud = {
enabled = 1;
};
};
};
};
};
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "MyProject" */;
compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = [MyProject] /* MyProject */;
projectDirPath = "";
projectRoot = "";
targets = (
[MyProject:target] /* MyProject */,
);
};
/* End PBXProject section */
]]
end


---------------------------------------------------------------------------
-- PBXResourceBuildPhase tests
---------------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,25 @@
_p('/* Begin PBXProject section */')
_p(2,'08FB7793FE84155DC02AAC07 /* Project object */ = {')
_p(3,'isa = PBXProject;')
local capabilities = tr.project.xcodesystemcapabilities
if not table.isempty(capabilities) then
local keys = table.keys(capabilities)
table.sort(keys)
_p(3, 'attributes = {')
_p(4, 'TargetAttributes = {')
_p(5, '%s = {', tr.project.xcode.projectnode.targetid)
_p(6, 'SystemCapabilities = {')
for _, key in pairs(keys) do
_p(7, '%s = {', key)
_p(8, 'enabled = %d;', iif(capabilities[key], 1, 0))
_p(7, '};')
end
_p(6, '};')
_p(5, '};')
_p(4, '};')
_p(3, '};')
end

_p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "%s" */;', tr.name)
_p(3,'compatibilityVersion = "Xcode 3.2";')
_p(3,'hasScannedForEncodings = 1;')
Expand Down