Skip to content

xcode: add xcodepostbuildinputs/xcodepostbuildoutputs API for Postbuild script phase - #595

Open
mrpuzzler wants to merge 2 commits into
bkaradzic:masterfrom
mrpuzzler:fix/xcode-postbuild-input-output-paths
Open

xcode: add xcodepostbuildinputs/xcodepostbuildoutputs API for Postbuild script phase#595
mrpuzzler wants to merge 2 commits into
bkaradzic:masterfrom
mrpuzzler:fix/xcode-postbuild-input-output-paths

Conversation

@mrpuzzler

Copy link
Copy Markdown

Problem

GENie's postbuildcommands generates a PBXShellScriptBuildPhase with empty inputPaths and outputPaths. Xcode 15+ warns on every build:

"Run script build phase 'Postbuild' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking 'Based on dependency analysis'."

The workaround in the previous PR (#594) was alwaysOutOfDate = 1, which silences the warning but means the script always runs even when nothing changed.

Solution

Add two new Xcode-specific Lua API fields, mirroring the pattern of xcodescriptphases:

xcodepostbuildinputs  { ... }   -- fills inputPaths  for the Postbuild phase
xcodepostbuildoutputs { ... }   -- fills outputPaths for the Postbuild phase

When xcodepostbuildoutputs is non-empty, alwaysOutOfDate is omitted and Xcode uses its dependency analysis (stamp-file pattern). When no outputs are declared the previous alwaysOutOfDate = 1 behaviour is preserved for full backward compatibility.

Usage — stamp-file pattern

postbuildcommands {
    '"${SRCROOT}/../../scripts/copy_game_data.sh"'
}
-- Xcode skips the script entirely when runtime/ hasn't changed since last build.
xcodepostbuildinputs  { '"$(SRCROOT)/../../runtime/mundus/"' }
xcodepostbuildoutputs { '"$(DERIVED_FILE_DIR)/game_data.stamp"' }

The copy script creates the stamp at the end:

touch "${DERIVED_FILE_DIR}/game_data.stamp"

Changes

  • src/base/api.lua — register xcodepostbuildinputs (list) and xcodepostbuildoutputs (list)
  • src/actions/xcode/xcode_common.lua:
    • doblock gains an outputfiles parameter, populates outputPaths, and only emits alwaysOutOfDate when no outputs are declared
    • dobuildblock gains inputswhich/outputswhich parameters and reads those config fields
    • Postbuild call passes "xcodepostbuildinputs" / "xcodepostbuildoutputs"

Made with Cursor

…ld script phase

Adds two new Lua API fields:
  xcodepostbuildinputs  { ... }   -- inputPaths for the Postbuild script phase
  xcodepostbuildoutputs { ... }   -- outputPaths for the Postbuild script phase

When outputPaths is non-empty, alwaysOutOfDate is omitted and Xcode uses proper
dependency analysis (stamp-file pattern). When no outputs are declared the
previous alwaysOutOfDate=1 behaviour is preserved for backward compatibility.

Example: postbuildcommands     { '"scripts/copy.sh"' }
  xcodepostbuildinputs  { '"$(SRCROOT)/../../runtime/"' }
  xcodepostbuildoutputs { '"$(DERIVED_FILE_DIR)/copy.stamp"' }
Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant