Xcodegen: Framework dependency always embedded

Created on 6 Aug 2018  路  7Comments  路  Source: yonaskolb/XcodeGen

I'm having this dependency settings on my target section of project.yml file:

dependencies:
      - framework: myFramwork.framework
        embed: false

This produces that the "Embedded Binaries Section" contains "My framework" added when this should not happens. If I set "embed" to "true" the same framework is added twice on the same section. In both scenarios the "Linked Frameworks and Libraries" contains the link to framework just one time.

I only want that the framework is linked but not embedded

It appears that framework is always being added in addtion to my settings. What could be happening?

Most helpful comment

Hi @danicoello. As a side comment, it's always cool to see people's project.yml. Here are some things you could possibly simplify:

  • settings.configs can reference partial config names, to remove debug vs release duplication
  • you can provide a base settings for common settings, and then remove them from all the targets
  • TEST_HOST _shouldn't_ be required
  • INFOPLIST_FILE should be automatically found, unless you have multiple of them in an apps sources

example of settings:

settings:
  base:
    SWIFT_VERSION: "3.3"
    DEVELOPMENT_TEAM: "XXXXXXXXXX"
  configs:
    QA:
      DISPLAY_NAME_CUSTOM: "My App QA"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp-qa"
      ENVIROMENT: "QA"
    PROD:
      DISPLAY_NAME_CUSTOM: "My App"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp"
      ENVIROMENT: "PROD"

@brentleyjones we should also automatically add any custom framework directories to FRAMEWORK_SEARCH_PATHS, if that is required

All 7 comments

Can you post a more complete project.yml (made up names are fine). I鈥檒l take a look at this.

Sent with GitHawk

This is the project.yml that I am using.

name: MyApp
options:
  xcodeVersion: "9.4.1"
  bundleIdPrefix: "com.myapp"
  deploymentTarget: 
    iOS: "9.3"
configs:
  QA Debug: debug
  QA Release: release
  PROD Debug: debug
  PROD Release: release
settings:
  configs:
    QA Debug:
      DISPLAY_NAME_CUSTOM: "My App QA"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp-qa"
      ENVIROMENT: "QA"
    QA Release:
      DISPLAY_NAME_CUSTOM: "My App QA"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp-qa"
      ENVIROMENT: "QA"
    PROD Debug:
      DISPLAY_NAME_CUSTOM: "My App"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp"
      ENVIROMENT: "PROD"
    PROD Release:
      DISPLAY_NAME_CUSTOM: "My App"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp"
      ENVIROMENT: "PROD"
targets:
  MyApp:
    type: application
    platform: iOS
    sources: MyApp
    settings:
      INFOPLIST_FILE: MyApp/Resources/MyApp.plist
      SWIFT_VERSION: "3.3"
      SWIFT_OBJC_BRIDGING_HEADER: MyApp/Resources/MyApp-Bridging-Header.h
      FRAMEWORK_SEARCH_PATHS: [$(inherited), $(PROJECT_DIR), MyApp/AmazonAws]
      CODE_SIGN_ENTITLEMENTS: MyApp/Resources/MyApp.entitlements
      CODE_SIGN_IDENTITY: "iPhone Developer: Developer (XXXXXXXXXX)"
      CODE_SIGN_STYLE: "Manual"
      DEVELOPMENT_TEAM: "XXXXXXXXXX"
      PROVISIONING_PROFILE: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      PROVISIONING_PROFILE_SPECIFIER: "MyApp Development Provisioning"
    dependencies:
      - framework: MyApp/AmazonAws/AWSMobileHubHelper.framework
        embed: false
    scheme:
      testTargets: 
        - MyAppTests
        - MyAppUITests
      configVariants:
        - QA
        - PROD
  MyAppTests:
    type: bundle.unit-test
    platform: iOS
    sources: MyAppTests
    dependencies:
      - target: MyApp
    settings:
      SWIFT_VERSION: "3.3"
      DEVELOPMENT_TEAM: "XXXXXXXXXX"
      INFOPLIST_FILE: MyAppTests/Info.plist
      TEST_HOST: $(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp
  MyAppUITests:
    type: bundle.ui-testing
    platform: iOS
    sources: MyAppUITests
    dependencies:
      - target: MyApp
    settings:
      SWIFT_VERSION: "3.3"
      DEVELOPMENT_TEAM: "XXXXXXXXXX"
      INFOPLIST_FILE: MyAppUITests/Info.plist
      TEST_HOST: $(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp
  MyAppPushNotificationExtension:
    type: app-extension
    platform: iOS
    sources: MyAppPushNotificationExtension
    settings:
      SWIFT_VERSION: "3.3"

Hi @danicoello. As a side comment, it's always cool to see people's project.yml. Here are some things you could possibly simplify:

  • settings.configs can reference partial config names, to remove debug vs release duplication
  • you can provide a base settings for common settings, and then remove them from all the targets
  • TEST_HOST _shouldn't_ be required
  • INFOPLIST_FILE should be automatically found, unless you have multiple of them in an apps sources

example of settings:

settings:
  base:
    SWIFT_VERSION: "3.3"
    DEVELOPMENT_TEAM: "XXXXXXXXXX"
  configs:
    QA:
      DISPLAY_NAME_CUSTOM: "My App QA"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp-qa"
      ENVIROMENT: "QA"
    PROD:
      DISPLAY_NAME_CUSTOM: "My App"
      PRODUCT_BUNDLE_IDENTIFIER: "com.myapp.MyApp"
      ENVIROMENT: "PROD"

@brentleyjones we should also automatically add any custom framework directories to FRAMEWORK_SEARCH_PATHS, if that is required

@danicoello: The issue is that you have AmazonAws under MyApp, which means it gets picked up automatically and is thus being embedded. This wouldn't be an issue if the framework was dynamic and was allowed to be embedded.

A couple ways to fix this:

  1. Exclude the AmazonAws directory
targets:
  MyApp:
    type: application
    platform: iOS
    sources:
      - path: MyApp
        excludes:
          - AmazonAws
  1. Move the AmazonAws directory to be outside of MyApp

@yonaskolb:

TEST_HOST is not set anywhere in the code, so it is needed.

INFOPLIST_FILE was indeed found correctly.

I'll look into the FRAMEWORK_SEARCH_PATHS change. I've noticed needing the same thing on our project.

@yonaskolb Thank you for your project.yml optimizations. I have applied them to my file.

@brentleyjones It works! I use your first approach of excluding the AmazonAws directory and it solved my problem. Framework is linked but not embedded as required.

About Host Application on a testing target:

I removed TEST_HOST on project.yml as you told me but when I opened the target on Xcode there is no host application selected. It display "None" and I have to select the target app by hand.

I'm going to close this since the root issue is technically desired behavior. Opened https://github.com/yonaskolb/XcodeGen/issues/377 for the improvement suggested here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rpassis picture rpassis  路  5Comments

ksulliva picture ksulliva  路  4Comments

thecb4 picture thecb4  路  3Comments

TheInkedEngineer picture TheInkedEngineer  路  4Comments

samedson picture samedson  路  5Comments