Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.8k stars 596 forks source link

Xcode 15: `DEFINES_MODULE` was set, but no umbrella header warning #1077

Closed Blackjacx closed 11 months ago

Blackjacx commented 1 year ago

What did you do?

We install Quick/Nimble using SPM via Tuist. Then we are building the tests with Xcode 15 Beta 6.

To investigate a bit more I created a minimal demo project. Just run ./build.sh in the root of the demo project 👍

What did you expect to happen?

No warnings.

What actually happened instead?

<project-root>/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/CwlCatchException/CwlCatchException.xcodeproj DEFINES_MODULE was set, but no umbrella header could be found to generate the module map

and 

<project-root>/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/Nimble/Nimble.xcodeproj DEFINES_MODULE was set, but no umbrella header could be found to generate the module map

Screenshot 2023-08-11 at 13 36 37

Environment

younata commented 1 year ago

I'm unable to reproduce this. Also Xcode 15, beta 6.

It feels like any project that uses Nimble via SPM should run in to this, right?

Just to double check, you did a clean build & reset your package caches, right?

Blackjacx commented 1 year ago

I upgraded the description above and added a demo project to reproduce this issue. Also we need an update of Quick/Nimble to get rid of a simulator warning.

stherold commented 1 year ago

Do you need the DEFINES_MODULE setting? Can it be set to NO ?

younata commented 1 year ago

Do you need the DEFINES_MODULE setting? Can it be set to NO?

Apparently not, at least not for the NimbleObjectiveC target. This appears to be something that Tuist assumed when it generated the framework targets for the libraries. (Which, to be fair, it appears to need these for the ones you link - I got build errors when I disabled DEFINES_MODULE on Nimble, but not on NimbleObjectiveC or CwlCatchException). It's not something Nimble itself is specifying.

This is not something you get with standard SPM, nor with the Carthage or Cocoapods distributions of Nimble.

If you come up with a solution that fixes this warning, I'll accept the PR, but I'm disinclined to put in the effort myself to figure out what Tuist is doing wrong when it generates frameworks based off the Package.swift declaration.

Blackjacx commented 11 months ago

Hey hey 👋

thanks for your detailed reply. For all the others that come across this:

In the end I set this build setting to "false" in Tuist/Dependencies.swift like so:

let spm = SwiftPackageManagerDependencies(
    [
        .remote(url: "https://github.com/Quick/Quick", requirement: .upToNextMajor(from: "7.2.0")),
        .remote(url: "https://github.com/Quick/Nimble", requirement: .upToNextMajor(from: "12.2.0")),
    ],
    targetSettings: [
        "NimbleObjectiveC": [
                    "DEFINES_MODULE": false
        ]
    ]
)