Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If project name contains "-" and contains bundles, we are changing the project name for bundle #6232

Closed
danibachar opened this issue Apr 23, 2024 · 1 comment · Fixed by #6234
Labels
type:bug Something isn't working

Comments

@danibachar
Copy link
Collaborator

What happened?

We replace the "-" char for the whole bundle name.
While we should replace it only for that target name.

For example if we use https://github.com/braze-inc/braze-swift-sdk which its package - i.e project name contains "-" (dashshses) we replace those too, and as such the bundle name we search for is wrong

Here is an example from my env vs a vanila App Project that uses BrazeUI

Tuist fixture

total 181128
drwxr-xr-x  58 danielbac  staff      1856 Apr 23 12:39 Airship_AirshipCore.bundle
-rwxr-xr-x@  1 danielbac  staff  92728992 Apr 23 12:39 App
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 CocoaLumberjack_CocoaLumberjack.bundle
drwxr-xr-x   5 danielbac  staff       160 Apr 23 12:39 Frameworks
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 GTMSessionFetcher_GTMSessionFetcherCore.bundle
drwxr-xr-x  45 danielbac  staff      1440 Apr 23 12:39 GoogleSignIn_GoogleSignIn.bundle
-rw-r--r--   1 danielbac  staff      1155 Apr 23 12:11 Info.plist
drwxr-xr-x  10 danielbac  staff       320 Apr 23 12:39 LocalSwiftPackage_Styles.bundle
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 NYTPhotoViewer_NYTPhotoViewer.bundle
-rw-r--r--   9 danielbac  staff         8 Apr 23 12:11 PkgInfo
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 Realm_Realm.bundle
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 Realm_RealmSwift.bundle
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 SVProgressHUD_SVProgressHUD.bundle
drwxr-xr-x   4 danielbac  staff       128 Apr 23 12:39 ZipArchive_ZipArchive.bundle
drwxr-xr-x   3 danielbac  staff        96 Apr 23 12:39 _CodeSignature
drwxr-xr-x  45 danielbac  staff      1440 Apr 23 12:39 braze_swift_sdk_BrazeKitResources.bundle
drwxr-xr-x  45 danielbac  staff      1440 Apr 23 12:39 braze_swift_sdk_BrazeUI.bundle

App + Vanila SPM

total 21576
drwxr-xr-x   3 danielbac  staff        96 Apr 23 12:40 Frameworks
-rw-r--r--   1 danielbac  staff      1286 Apr 23 12:36 Info.plist
-rw-r--r--   2 danielbac  staff         8 Apr 23 12:36 PkgInfo
-rwxr-xr-x@  2 danielbac  staff  11035552 Apr 23 12:36 TestinBrazeUI
drwxr-xr-x   3 danielbac  staff        96 Apr 23 12:40 _CodeSignature
drwxr-xr-x  46 danielbac  staff      1472 Apr 23 12:40 braze-swift-sdk_BrazeUI.bundle

How do we reproduce it?

  1. Pull the branch from this PR
  2. Go to fixtures/app_with_spm_dependencies
  3. Run tuist install && tuist generate
  4. In the main app, (i.e App), go to the AppDelegate.swift file
  5. Import the BrazeUI product import BraseUI
  6. Try and use its Resource accessors (the one the package vends, not the one we create) and see it does not find the bundle
    6.1) Something like:
        let brazeUILocalizedString = BrazeUIResources.bundle?.localizedString(
            forKey: "braze.in-app-message.close-button.title",
            value: nil,
            table: nil
        )
        precondition(brazeUILocalizedString == "Close", "Failed to fetch localized resource from BrazeUI")

You'd see that the precondition failes

Error log

No specific error, its just when we will try and reach the bundle through SPM it will not be there, as it will look for the wrong name

macOS version

14.4.1

Tuist version

4.9.0

Xcode version

15.3

@danibachar
Copy link
Collaborator Author

I created a PR chain between this fix and this PR, as they are somehow linked (I found the bug while I fixed the fixture for the other)
I think that once we merge #6146 we can just directly merge this PR to main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
1 participant