yonaskolb / yonaskolb/XcodeGen

Improving support for ${target_name} expansion

Open
#780 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

I have found there are times when it is helpful to have some variable expansion. In particular, I have a postBuildScripts that I'd like to execute. In this case it is copying some files and would be great if I could use ${target_name} in this case to expand the name to use the target name so I can cut and paste this into files.

Right now it doesn't do anything, so it remains ${target_name}.

This is what I'd like to ideally do:

    postBuildScripts:
      - script: |
          cp ${DERIVED_FILES_DIR}/${target_name}-Swift.h ${BUILT_PRODUCTS_DIR}/${target_name}.framework/Headers
          cp -rv ${BUILT_PRODUCTS_DIR}/${target_name}.swiftmodule ${BUILT_PRODUCTS_DIR}/${target_name}.framework/Modules
        name: Copy SWIFT_OBJC_INTERFACE_HEADER_NAME and swiftmodule   

Note that I have improved the above script by assigning the target name to a single variable first and then using that internally. But it will still be a nice to have.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how XcodeGen handles the postBuildScripts entry and how the generated script receives variables. Use the example in the issue to check whether ${target_name} is expanded in post-build commands, and consider the work complete when the shown copy commands receive the target name instead of the literal placeholder.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.