xcodegen framework target that generate it's own sources doesn't generate umbrella header

90 views Asked by At

I'm using xcodegen to create project. I just wanted to create a framework target and app target... Like this...

targets:
  MySecrets:
    platform: iOS
    type: framework
    settings:
      PRODUCT_BUNDLE_IDENTIFIER: com.kapucha.mysecrets
    sources:
      - MySecrets
    preBuildScripts:
      - script: sh generate_secrets.sh
        name: Generate Secrets file for MySecrets
        basedOnDependencyAnalysis: true
        inputFiles:
          - $(SRCROOT)/generate_secrets.sh
        outputFiles:
          - $(SRCROOT)/MySecrets/Secrets.swift
    info:
      path: MySecrets/Info.plist
  MyApp:
    platform: iOS
    type: application
    dependencies:
      - target: MySecrets
        embed: true
        codeSign: true

So dependency graph is... MyApp > MyFramework.

MyFramework in preBuild phase is generating one source file Secrets.swift. It has only one source file. Before first build there is no swift files in this framework.

The problem that I'm facing is during build MyApp when MySecrets is about to build I see that the file Secrets.swift is generated properly but then I'm receiving error message:

warning: DEFINES_MODULE was set, but no umbrella header could be found to generate the module map (in target 'MySecrets' from project 'MyApp')

And then when MyApp is compiling I'm receiving error that:

No such module 'MySecrets'

Can somebody point me to the right direction? I need this one file to be generated and putted into separate framework. Generation should happen only when there is no output or input files changed. After generation module should be compiled including this fresh generated file and then other modules that depends on MySecrets should be build.

What I found so far. It is working but only when there is generated Secrets.swift file in MySecrets directory but after I restart xCode. My thoughts are that the umbrella header is only generated when there is at least one source file in MySecrets folder. When source file is generated then after xCode restarts MyApp is building fine. But when I try to be in clean state without any source files in MySecrets directory then no umbrella header warning occurs and later no such module error is presented.

0

There are 0 answers