yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.01k stars 818 forks source link

Copy framework/bundle instead of embeding / linking #1102

Open jakubkiermasz-zd opened 3 years ago

jakubkiermasz-zd commented 3 years ago

Hi! I'm working on setting up xcodegen for a quite large app. For the UITests, we use EarlyGrey v2, installed manually, not via pods. To enable white box testing some sketchy setup is required. More here.

Is there a way to create a create Copy files phase with framework/bundle items? (part of target's sources options) Maybe is there a way to specify the absolute path that frameworks will be embedded to? (outside of the current target, like below) (part of target's dependencies options)

image

Please note, in the above picture the script is placed as the part of the UITest bundle, and refers to the main app target.

Any help will be heavily appreciated!

jakubkiermasz-zd commented 3 years ago

@yonaskolb if there is no such feature I'll be happy to implement one, with a little help and tips :)

shakfu commented 2 years ago

Is it possible to drop the requirement that embed is set to true. This is not a requirement of Xcode. Indeed in my case, it will not work if I embed a Framework, but only if I copy it (without embedding it) so I was hoping for the following to work to be consistent with how my curren Xcode project works (see screenshot):

name: demo
options:
  bundleIdPrefix: org.me
settings:
  CODE_SIGN_IDENTITY: "-"
  DEVELOPMENT_TEAM: ""
  GCC_OPTIMIZATION_LEVEL: 0
  GCC_NO_COMMON_BLOCKS: No
  HEADER_SEARCH_PATHS:
    - $(PROJECT_HEADERS)
  INFOPLIST_FILE: $(SRCROOT)/../../../Info.plist
  LIBRARY_SEARCH_PATHS: $(PROJECT_LIBS)
  OTHER_LDFLAGS:
    - $(PROJECT_LDFLAGS)
  PRODUCT_NAME: $(TARGET_NAME)
configFiles:
  Debug: project.xcconfig
  Release: project.xcconfig

targets:
  py:
    type: bundle
    platform: macOS
    sources:
      - ../../py.c
    dependencies:
      - sdk: CoreFoundation.framework
      - framework: ../build/lib/Python.framework
        embed: false
        copy: 
          destination: resources
    settings:
      MACOSX_DEPLOYMENT_TARGET: "10.13"
screenshot
kkiermasz commented 2 years ago

@shakfu hello there. I left zendesk quite a while ago, so I'll use this account. I guess you should open a new issue for what you showed

shakfu commented 2 years ago

@kkiermasz ok will do. Thanks

shakfu commented 1 year ago

@kkiermasz

Incidentally, I think this issue flagged above is fixed in current xcodegen in the sources section by specifying path, buildPhase, and copyFiles. For example, this works for me:

name: py-js
options:
  bundleIdPrefix: org.me
settings:
  CODE_SIGN_IDENTITY: "-"
  DEVELOPMENT_TEAM: ""
  GCC_OPTIMIZATION_LEVEL: 0
  GCC_NO_COMMON_BLOCKS: No
  HEADER_SEARCH_PATHS:
    - $(C74SUPPORT)/max-includes
    - $(C74SUPPORT)/msp-includes
    - $(C74SUPPORT)/jit-includes
    - $(PROJECT_HEADERS)
  INFOPLIST_FILE: $(SRCROOT)/../../../Info.plist
  LIBRARY_SEARCH_PATHS: $(PROJECT_LIBS)
  OTHER_LDFLAGS:
    - $(C74_SYM_LINKER_FLAGS)
    - $(MSP_JIT_LDFLAGS)
    - $(PROJECT_LDFLAGS)
  PRODUCT_NAME: $(TARGET_NAME)
configFiles:
  Debug: project.xcconfig
  Release: project.xcconfig

targets:
  py:
    type: bundle
    platform: macOS
    sources:
      - $(SRCROOT)/../../py.c
      - $(SRCROOT)/../../api.c
      - path: $(SRCROOT)/../build/lib/python-static/lib/python311.zip
        buildPhase:
          copyFiles:
            destination: resources
            subpath: lib
      - path: $(SRCROOT)/../build/lib/python-static/lib/python3.11
        type: folder
        buildPhase:
          copyFiles:
            destination: resources
            subpath: lib
    dependencies:
      - sdk: CoreFoundation.framework
    settings:
      MACOSX_DEPLOYMENT_TARGET: "10.13"