Sort buildinputs and buildoutputs on xcode4 (#1631)

* Sort `buildinputs` and `buildoutputs` on xcode4

* Fix `buildinputs` and `buildoutputs` for Xcode4
This commit is contained in:
tempura-sukiyaki 2021-06-08 07:03:59 +09:00 committed by GitHub
parent ebbbb72ab7
commit 38458a3624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 4 deletions

View File

@ -1315,6 +1315,42 @@
end
function suite.PBXShellScriptBuildPhase_OnBuildInputsAnddOutputsOrder()
files { "file.a" }
filter { "files:file.a" }
buildcommands { "buildcmd" }
buildinputs { "file.3", "file.1", "file.2" }
buildoutputs { "file.5", "file.6", "file.4" }
prepare()
xcode.PBXShellScriptBuildPhase(tr)
test.capture [[
/* Begin PBXShellScriptBuildPhase section */
0D594A1D2F24F74F6BDA205D /* Build "file.a" */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"file.a",
"file.3",
"file.1",
"file.2",
);
name = "Build \"file.a\"";
outputPaths = (
"file.5",
"file.6",
"file.4",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n\tbuildcmd\nfi\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n\tbuildcmd\nfi";
};
/* End PBXShellScriptBuildPhase section */
]]
end
---------------------------------------------------------------------------
-- PBXSourcesBuildPhase tests
---------------------------------------------------------------------------

View File

@ -1110,10 +1110,14 @@
end
table.insert(commands, 'fi')
for _, v in ipairs(filecfg.buildinputs) do
inputs[v] = true
if not table.indexof(inputs, v) then
table.insert(inputs, v)
end
end
for _, v in ipairs(filecfg.buildoutputs) do
outputs[v] = true
if not table.indexof(outputs, v) then
table.insert(outputs, v)
end
end
end
end
@ -1129,13 +1133,13 @@
_p(level+1,');')
_p(level+1,'inputPaths = (');
_p(level+2,'"%s",', xcode.escapeSetting(node.relpath))
for v, _ in pairs(inputs) do
for _, v in ipairs(inputs) do
_p(level+2,'"%s",', xcode.escapeSetting(project.getrelative(tr.project, v)))
end
_p(level+1,');')
_p(level+1,'name = %s;', xcode.stringifySetting('Build "' .. node.name .. '"'))
_p(level+1,'outputPaths = (')
for v, _ in pairs(outputs) do
for _, v in ipairs(outputs) do
_p(level+2,'"%s",', xcode.escapeSetting(project.getrelative (tr.project, v)))
end
_p(level+1,');')