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

Fix integration of SPM dependencies with resources #5945

Merged
merged 10 commits into from
Feb 17, 2024

Conversation

fortmarek
Copy link
Member

Resolves #3785

Short description 📝

Based on an original attempt at fixing this: #4902

This PR synthesizes the SWIFTPM_MODULE_BUNDLE for Objc external targets.

We use the fork of NYTPhotoViewer not because the accessors are wrong, but they have two targets that point to the same directory, one using a symlink. We then generate two different modulemaps pointing technically to the same dir. I believe this is currently not worth solving unless we find more dependencies this imho awkward setup.

How to test the changes locally 🧐

You should be able to build app_with_spm_dependencies fixture.

Contributor checklist ✅

  • The code has been linted using run mise run lint:fix
  • The change is tested via unit testing or acceptance testing, or both
  • The title of the PR is formulated in a way that is usable as a changelog entry
  • In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist ✅

  • The code architecture and patterns are consistent with the rest of the codebase
  • Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

@fortmarek fortmarek added the changelog:fixed PR will be listed in the Fixed section of CHANGELOG label Feb 17, 2024

let gccPrefixHeader = "$(SRCROOT)/\(headerFile.path.relative(to: project.path).pathString)"
var settings = modifiedTarget.settings?.base ?? SettingsDictionary()
settings["GCC_PREFIX_HEADER"] = .string(gccPrefixHeader)
Copy link
Member Author

@fortmarek fortmarek Feb 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution is not ideal as we're overriding this setting: #4902 (comment)

However, this setting is not really used by SPM targets (I couldn't find any that would and it's generally discouraged to use this setting unless for very special purpose) and we don't apply this for internal targets. If this becomes an issue, we can rethink this. I did try using the -include C flag but that caused issues due to import of Foundation and I haven't explored this further.

Base automatically changed from fix/appcenter to main February 17, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:fixed PR will be listed in the Fixed section of CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dependencies.swift][SPM] Use of undeclared identifier 'SWIFTPM_MODULE_BUNDLE'
3 participants