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

[Privacy Manifest] Adjust resource layout for SPM and CocoaPods #1

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

ncooke3
Copy link

@ncooke3 ncooke3 commented Jan 12, 2024

The path we provide here is relative to the sources within the target. This would be ./Sources/FBLPromises/. So we need to jump one directory back and into Resources. Otherwise, there will be a warning that the resource is specified but not found.

warning: 'promises': Invalid Resource 'Sources/Resources/PrivacyInfo.xcprivacy': File not found.
-        .process("Sources/Resources/PrivacyInfo.xcprivacy")
+        .process("../Resources/PrivacyInfo.xcprivacy")

But, although the above resolves, SPM doesn't actually bundle the resource in the target's build directory when the resource paths are relative like this 😖 .

What does work is copying the Resources directory into both the FBLPromises and Promises. I tried symlinking Sources/FBLPromises/Resources and Sources/Promises/Resources to Sources/Resources so we could avoid duplicating the manifest contents since the contents is the same for both modules. Unfortunately, SPM won't pick up the symlink even though readlink output looks right.

So, the only path that leads to a working outcome is to remove the Sources/Resources/ and add a Resources/ to both Sources/Promises/ and Sources/FBLPromises/. This is a good learning for cases where targets share the same manifest contents–– it appears that they cannot point to a shared location.

cc: @thomasvl

I updated the podspec to reflect these changes.


Verification

All of the below cases generate an empty Privacy Report which is expected. The important part was making sure the xcprivacy file ends up in a name spaced part of the app bundle.

  • App depending via SPM
PrivacyApp.app
├── Info.plist
├── PkgInfo
├── PrivacyApp
├── Promises_FBLPromises.bundle
│   ├── Info.plist
│   └── PrivacyInfo.xcprivacy  ← ✅
├── Promises_Promises.bundle
│   ├── Info.plist
│   └── PrivacyInfo.xcprivacy  ← ✅
├── _CodeSignature
│   └── CodeResources
└── embedded.mobileprovision
  • App depending on Promises via CocoaPods (dynamically linked)
/PrivacyAppCocoaPods.app
├── Frameworks
│   ├── FBLPromises.framework
│   │   ├── FBLPromises
│   │   ├── FBLPromises_Privacy.bundle
│   │   │   ├── Info.plist
│   │   │   └── PrivacyInfo.xcprivacy  ← ✅
│   │   ├── Info.plist
│   │   └── _CodeSignature
│   │       └── CodeResources
│   └── Promises.framework
│       ├── Info.plist
│       ├── Promises
│       ├── Promises_Privacy.bundle
│       │   ├── Info.plist
│       │   └── PrivacyInfo.xcprivacy  ← ✅
│       └── _CodeSignature
│           └── CodeResources
├── Info.plist
├── PkgInfo
├── PrivacyAppCocoaPods
├── _CodeSignature
│   └── CodeResources
└── embedded.mobileprovision
  • App depending on Promises via CocoaPods (statically linked)
PrivacyAppCocoaPods.app
├── FBLPromises_Privacy.bundle
│   ├── Info.plist
│   └── PrivacyInfo.xcprivacy  ← ✅
├── Info.plist
├── PkgInfo
├── PrivacyAppCocoaPods
├── Promises_Privacy.bundle
│   ├── Info.plist
│   └── PrivacyInfo.xcprivacy  ← ✅
├── _CodeSignature
│   └── CodeResources
└── embedded.mobileprovision

@ncooke3 ncooke3 changed the title Nc/privacy [Privacy Manifest] Adjust resource layout for SPM and CocoaPods Jan 12, 2024
@ykjchen
Copy link
Owner

ykjchen commented Jan 16, 2024

Thank you for your help in getting this right, and the detailed explanation!

@ykjchen ykjchen merged commit d992d4d into ykjchen:privacy Jan 16, 2024
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 this pull request may close these issues.

2 participants