tuist icon indicating copy to clipboard operation
tuist copied to clipboard

tuist build --generate causes linting issues as of 4.38.0

Open lilidotshi opened this issue 11 months ago • 5 comments

What happened?

I have a project that has a bunch of firebase dependencies, and as of 4.38.0, running tuist build --generate generates a bunch of issues (listed in the error log)

Running tuist build does not have the same issue, and I can confirm that going down to 4.37.0 does not have the same issue.

How do we reproduce it?

Have firebase-ios-sdk as a dependency, and run tuist build --generate.

Error log

Target GoogleAppMeasurementTarget which depends on nanopb does not support the required platforms: watchos, tvos, macos, visionos. The dependency on nanopb must have a dependency condition constraining to at most: ios.
Target GoogleAppMeasurementTarget which depends on GoogleUtilities-NSData does not support the required platforms: watchos, macos, visionos, tvos. The dependency on GoogleUtilities-NSData must have a dependency condition constraining to at most: ios.
Target GoogleUtilities-Network which depends on GoogleUtilities-NSData does not support the required platforms: visionos, watchos, macos, tvos. The dependency on GoogleUtilities-NSData must have a dependency condition constraining to at most: ios.
Target GoogleUtilities-Network which depends on GoogleUtilities-Logger does not support the required platforms: macos, watchos, visionos, tvos. The dependency on GoogleUtilities-Logger must have a dependency condition constraining to at most: ios.
Target FirebaseDatabase which depends on FirebaseSharedSwift does not support the required platforms: watchos, tvos, macos, visionos. The dependency on FirebaseSharedSwift must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on FirebaseInstallations does not support the required platforms: watchos, macos, visionos, tvos. The dependency on FirebaseInstallations must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on GoogleUtilities-Environment does not support the required platforms: watchos, tvos, macos, visionos. The dependency on GoogleUtilities-Environment must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on GoogleDataTransport does not support the required platforms: visionos, macos, tvos, watchos. The dependency on GoogleDataTransport must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on GoogleUtilities-UserDefaults does not support the required platforms: visionos, macos, tvos, watchos. The dependency on GoogleUtilities-UserDefaults must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on FirebaseCore does not support the required platforms: watchos, tvos, macos, visionos. The dependency on FirebaseCore must have a dependency condition constraining to at most: ios.
Target FirebaseMessaging which depends on nanopb does not support the required platforms: visionos, macos, tvos, watchos. The dependency on nanopb must have a dependency condition constraining to at most: ios.
Target AppCheckCore which depends on GoogleUtilities-Environment does not support the required platforms: watchos, tvos, macos, visionos. The dependency on GoogleUtilities-Environment must have a dependency condition constraining to at most: ios.
Target AppCheckCore which depends on FBLPromises does not support the required platforms: visionos, macos, tvos, watchos. The dependency on FBLPromises must have a dependency condition constraining to at most: ios.
Target AppCheckCore which depends on GoogleUtilities-UserDefaults does not support the required platforms: watchos, macos, visionos, tvos. The dependency on GoogleUtilities-UserDefaults must have a dependency condition constraining to at most: ios.
Target FirebaseAppCheck which depends on FirebaseCore does not support the required platforms: watchos, macos, visionos, tvos. The dependency on FirebaseCore must have a dependency condition constraining to at most: ios.
Target FirebaseAppCheck which depends on GoogleUtilities-Environment does not support the required platforms: visionos, macos, tvos, watchos. The dependency on GoogleUtilities-Environment must have a dependency condition constraining to at most: ios.
Target FirebaseAppCheck which depends on GoogleUtilities-UserDefaults does not support the required platforms: watchos, tvos, macos, visionos. The dependency on GoogleUtilities-UserDefaults must have a dependency condition constraining to at most: ios.
Fatal linting issues found

macOS version

15.1.1

Tuist version

4.38.2

Xcode version

16.1

lilidotshi avatar Jan 03 '25 19:01 lilidotshi

Hey @lilidotshi! I'm here to assist with any bugs, questions, or becoming a contributor. Let's squash those bugs together! 🐛

The issues you're encountering with tuist build --generate in version 4.38.0 are related to platform constraints for dependencies. In this version, Tuist introduced stricter linting checks for platform support, which means that dependencies must explicitly declare the platforms they support. This is why you're seeing errors indicating that certain dependencies do not support platforms like watchOS, tvOS, macOS, and visionOS, and need to be constrained to iOS.

To resolve these issues, you need to update your project's dependency configurations to include platform constraints. For each dependency that is causing an error, specify the platforms it supports using the condition option. Here's an example of how you can define a dependency with platform constraints:

dependencies: [
    .external(name: "Firebase", condition: .when(platforms: [.iOS])),
]

This ensures that the dependency is only linked when building for iOS, which should resolve the linting issues you're experiencing. You will need to apply similar constraints to all the dependencies listed in the error log.

These changes are necessary due to the updates in Tuist 4.38.0, which enforce stricter platform checks to ensure compatibility and prevent runtime issues [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

dosubot[bot] avatar Jan 03 '25 19:01 dosubot[bot]

The solution above doesn't work if there are deps within the deps (like the errors say, it seems to be a problem with firebase's dependencies on other libraries)

lilidotshi avatar Jan 03 '25 21:01 lilidotshi

Interestingly, running tuist build (no --generate flag) locally works fine, but once I run tuist build as part of a github runner workflow (what we use for CI), it fails with the same error.

running tuist generate followed by tuist build does NOT produce the error in CI. It seems to be related to generation in conjunction with tuist build

lilidotshi avatar Jan 03 '25 21:01 lilidotshi

This appears to be still an issue as of 4.50.1

Hais avatar Jun 03 '25 09:06 Hais

Hey 👋🏼 Would you mind sharing a small reproducible project?

pepicrft avatar Jun 11 '25 14:06 pepicrft