Skip to content

Commit

Permalink
Merge pull request #1231 from LORgames/ssurtees/xcodeFix
Browse files Browse the repository at this point in the history
Fixed issue with per-configuration build commands not returning errors correctly
  • Loading branch information
tdesveauxPKFX authored Jan 21, 2019
2 parents ada0d6c + ab02e3c commit 00c8d53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/xcode/tests/test_xcode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "ls src\ncp \"a\" \"b\"";
shellScript = "set -e\nls src\ncp \"a\" \"b\"";
};
/* End PBXShellScriptBuildPhase section */
]]
Expand Down Expand Up @@ -1100,7 +1100,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n\tls src\n\tcp \"a\" \"b\"\nfi\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n\tls src\n\tcp \"a\" \"b\"\nfi";
shellScript = "set -e\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n\tls src\n\tcp \"a\" \"b\"\nfi\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n\tls src\n\tcp \"a\" \"b\"\nfi";
};
/* End PBXShellScriptBuildPhase section */
]]
Expand All @@ -1127,7 +1127,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "ls src\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\ncp a b\nfi";
shellScript = "set -e\nls src\nif [ \"${CONFIGURATION}\" = \"Debug\" ]; then\ncp a b\nfi";
};
/* End PBXShellScriptBuildPhase section */
]]
Expand Down
6 changes: 6 additions & 0 deletions modules/xcode/xcode_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@
end

if #commands > 0 then
table.insert(commands, 1, 'set -e') -- Tells the shell to exit when any command fails
commands = os.translateCommands(commands, p.MACOSX)
if not wrapperWritten then
_p('/* Begin PBXShellScriptBuildPhase section */')
Expand Down Expand Up @@ -1008,6 +1009,11 @@
end
end
end

if #commands > 0 then
table.insert(commands, 1, 'set -e') -- Tells the shell to exit when any command fails
end

_p(level,'%s /* Build "%s" */ = {', node.buildcommandid, node.name)
_p(level+1,'isa = PBXShellScriptBuildPhase;')
_p(level+1,'buildActionMask = 2147483647;')
Expand Down

0 comments on commit 00c8d53

Please sign in to comment.