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

Resources bundle not generated for SPM dependency #4505

Closed
ffittschen opened this issue May 29, 2022 · 3 comments
Closed

Resources bundle not generated for SPM dependency #4505

ffittschen opened this issue May 29, 2022 · 3 comments

Comments

@ffittschen
Copy link
Contributor

ffittschen commented May 29, 2022

Describe the bug and the expected behavior

When integrating the AppCenter SDK as a SPM dependency via the Dependencies.swift file, the generated product targets in the AppCenter project are missing the resources / resource bundles.

The AppCenter Package.swift file neither explicitly declares sources nor resources, so I'd assume that Tuist would find them via the **/*.lproj glob from the defaultResourcePaths, but this doesn't seem to be the case.

As a result, there are missing strings (see second screenshot).

At first I thought this is related to #3785, as SWIFTPM_MODULE_BUNDLE is used within the AppCenter code, but Tuist isn't even generating the resources bundle that SwiftPM would generate, which is why I don't think the bundle accessor is the problem.

Reproduction steps

Sample project: app_with_spm_dependencies.zip

Steps to reproduce the bug:

  1. Use the attached sample project
  2. Run tuist fetch && tuist generate
  3. Open the AppCenter project in Tuist > Dependencies > SwiftPackageManager > .build > checkouts
  4. See that no resource bundle targets are generated.

Screenshots

Screen Shot 2022-05-29 at 17 26 10@2x

AppCenterDistributeResources_missing

Additional context

  • macOS version: 12.3.1
  • Tuist version: 3.4.0, but also 37af41b (latest main at the time of issue creation)
  • Xcode version: 13.3.1
@danieleformichelli
Copy link
Collaborator

danieleformichelli commented May 29, 2022

It seems there is an issue with automatic lproj resources. Duplicate of #4435

@ffittschen
Copy link
Contributor Author

After following the suggestion in #4435 (comment), I forked AppCenter and added an explicit [.process("Resources"] to the AppCenterDistribute target in the Package.swift file. This results in the AppCenterDistributeResources target being generated. Looks like we can use this as a workaround until Tuist correctly generates the resources target.

Screen Shot 2022-05-29 at 19 45 34@2x

@ffittschen
Copy link
Contributor Author

I just had a look into it with the following findings:

  • The TuistCore.DependenciesGraph returned from the fetch method in the DependenciesController.swift still contains the globs in the resources array of the target
  • After calling converter.convert(manifest: dependenciesManifest, path: path) in the fetchDependencies of the FetchService.swift, the resources array doesn't contain any elements anymore.
  • After adding a few breakpoints, I discovered that *.lproj is not considered being a resource in this method, as it is not a file, and its extension is not part of the Target.validFolderExtensions.

Screen Shot 2022-05-30 at 09 21 34@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants