From 38458a362491f11609ad305aa84cc7a63eefe03d Mon Sep 17 00:00:00 2001 From: tempura-sukiyaki <10625603+tempura-sukiyaki@users.noreply.github.com> Date: Tue, 8 Jun 2021 07:03:59 +0900 Subject: [PATCH] Sort `buildinputs` and `buildoutputs` on xcode4 (#1631) * Sort `buildinputs` and `buildoutputs` on xcode4 * Fix `buildinputs` and `buildoutputs` for Xcode4 --- modules/xcode/tests/test_xcode_project.lua | 36 ++++++++++++++++++++++ modules/xcode/xcode_common.lua | 12 +++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/modules/xcode/tests/test_xcode_project.lua b/modules/xcode/tests/test_xcode_project.lua index 275a2d35..fc853a81 100644 --- a/modules/xcode/tests/test_xcode_project.lua +++ b/modules/xcode/tests/test_xcode_project.lua @@ -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 --------------------------------------------------------------------------- diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index 35209d71..b3057d35 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -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,');')