Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
- [ ] Built wrapper: `bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build.sh`
- [ ] Collected SDK xcframeworks: `bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/collect-facebook-xcframeworks.sh`
- [ ] Packed NuGet: `dotnet pack src/Kapusch.FacebookApisForiOSComponents/Kapusch.FacebookApisForiOSComponents.csproj -c Release -o artifacts/nuget`
- [ ] Validated package: `python3 scripts/validate-package.py`
- [ ] Public tree scan: `python3 scripts/verify-public.py`
- [ ] Feature selection: `bash tests/validate-feature-selection.sh`
- [ ] Updated docs if behavior/integration changed
56 changes: 8 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
with:
dotnet-version: "10.0.203"

- name: Scan public tree
run: python3 scripts/verify-public.py

- name: Validate feature selection
run: bash tests/validate-feature-selection.sh

Expand All @@ -34,12 +37,12 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', '**/*.csproj') }}

- name: Cache SwiftPM scratch
- name: Cache pinned Facebook SDK archives
uses: actions/cache@v4
with:
path: |
src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build/spm
key: ${{ runner.os }}-swiftpm-${{ hashFiles('src/Kapusch.FacebookApisForiOSComponents/Native/iOS/KapuschFacebookAuthInterop/Package.resolved') }}
src/Kapusch.FacebookApisForiOSComponents/Native/iOS/.cache/downloads
key: ${{ runner.os }}-facebook-ios-sdk-${{ hashFiles('DependencyLocks/iOS/lockstate.txt') }}

- name: Build iOS wrapper
run: |
Expand All @@ -55,51 +58,8 @@ jobs:
-c Release \
-o artifacts/nuget

- name: Validate nupkg layout
run: |
python3 - <<'PY'
import glob, sys, zipfile

nupkgs = glob.glob("artifacts/nuget/*.nupkg")
if not nupkgs:
print("ERROR: no .nupkg found under artifacts/nuget/")
sys.exit(1)

nupkg = sorted(nupkgs)[-1]
print(f"Validating {nupkg}")

z = zipfile.ZipFile(nupkg)
names = set(z.namelist())

required = [
"buildTransitive/Kapusch.Facebook.iOS.targets",
"kfb.xcframework/Info.plist",
"kfbshare.xcframework/Info.plist",
"fb/FBAEMKit.xcframework/Info.plist",
"fb/FBSDKCoreKit.xcframework/Info.plist",
"fb/FBSDKCoreKit_Basics.xcframework/Info.plist",
"fb/FBSDKLoginKit.xcframework/Info.plist",
"fb/FBSDKShareKit.xcframework/Info.plist",
]

missing = [p for p in required if p not in names]
if missing:
print("ERROR: missing required paths in nupkg:")
for p in missing:
print(f" - {p}")
sys.exit(1)

# Guardrail: ensure the wrapper is not flattened at the package root.
if "Info.plist" in names:
print("ERROR: wrapper appears flattened (found 'Info.plist' at package root).")
sys.exit(1)

if any(name.startswith("fb/FBSDKGamingServicesKit.xcframework/") for name in names):
print("ERROR: GamingServicesKit must not be packaged.")
sys.exit(1)

print("OK: nupkg layout looks correct.")
PY
- name: Validate package
run: python3 scripts/validate-package.py

- uses: actions/upload-artifact@v4
with:
Expand Down
55 changes: 8 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
with:
dotnet-version: "10.0.203"

- name: Scan public tree
run: python3 scripts/verify-public.py

- name: Validate feature selection
run: bash tests/validate-feature-selection.sh

Expand All @@ -88,12 +91,12 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', '**/*.csproj') }}

- name: Cache SwiftPM scratch
- name: Cache pinned Facebook SDK archives
uses: actions/cache@v4
with:
path: |
src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build/spm
key: ${{ runner.os }}-swiftpm-${{ hashFiles('src/Kapusch.FacebookApisForiOSComponents/Native/iOS/KapuschFacebookAuthInterop/Package.resolved') }}
src/Kapusch.FacebookApisForiOSComponents/Native/iOS/.cache/downloads
key: ${{ runner.os }}-facebook-ios-sdk-${{ hashFiles('DependencyLocks/iOS/lockstate.txt') }}

- name: Build iOS wrapper
run: |
Expand All @@ -110,50 +113,8 @@ jobs:
-o artifacts/nuget \
/p:PackageVersion="${{ steps.version.outputs.version }}"

- name: Validate nupkg layout
run: |
python3 - <<'PY'
import glob, sys, zipfile

nupkgs = glob.glob("artifacts/nuget/*.nupkg")
if not nupkgs:
print("ERROR: no .nupkg found under artifacts/nuget/")
sys.exit(1)

nupkg = sorted(nupkgs)[-1]
print(f"Validating {nupkg}")

z = zipfile.ZipFile(nupkg)
names = set(z.namelist())

required = [
"buildTransitive/Kapusch.Facebook.iOS.targets",
"kfb.xcframework/Info.plist",
"kfbshare.xcframework/Info.plist",
"fb/FBAEMKit.xcframework/Info.plist",
"fb/FBSDKCoreKit.xcframework/Info.plist",
"fb/FBSDKCoreKit_Basics.xcframework/Info.plist",
"fb/FBSDKLoginKit.xcframework/Info.plist",
"fb/FBSDKShareKit.xcframework/Info.plist",
]

missing = [p for p in required if p not in names]
if missing:
print("ERROR: missing required paths in nupkg:")
for p in missing:
print(f" - {p}")
sys.exit(1)

if "Info.plist" in names:
print("ERROR: wrapper appears flattened (found 'Info.plist' at package root).")
sys.exit(1)

if any(name.startswith("fb/FBSDKGamingServicesKit.xcframework/") for name in names):
print("ERROR: GamingServicesKit must not be packaged.")
sys.exit(1)

print("OK: nupkg layout looks correct.")
PY
- name: Validate package
run: python3 scripts/validate-package.py

- name: Push to NuGet.org
if: steps.version.outputs.publish_target == 'nuget'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ artifacts/
# macOS
.DS_Store

# SwiftPM / Xcode
# Xcode
.build/
*.xcworkspace/
DerivedData/
Expand All @@ -24,6 +24,7 @@ DerivedData/

# Native build output (repo-only)
src/**/Native/iOS/build/
src/**/Native/iOS/.cache/

# Sample local config
samples/**/Info.plist
Expand Down
12 changes: 10 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
- Public OSS repo: keep docs/sample generic and not app-specific.
- The NuGet ships the required `xcframework`s and references them via `NativeReference`.
- Consuming apps must not download native deps at build time.
- The repo may use SwiftPM during CI/build to fetch the upstream Facebook iOS SDK, but consuming apps must not download native deps at build time.
- The repo build downloads the upstream Facebook iOS SDK release xcframeworks pinned (URL + SHA-256) in `DependencyLocks/iOS/lockstate.txt`; consuming apps must not download native deps at build time.
- The native facades are Objective-C and use only the SDK's Objective-C headers, so they do not depend on the Swift compiler release Meta used for the binaries.

## Repo layout
- `src/Kapusch.FacebookApisForiOSComponents/` — NuGet project (managed API + buildTransitive MSBuild)
- `src/Kapusch.FacebookApisForiOSComponents/Native/iOS/` — Swift wrapper source + scripts (repo-only)
- `src/Kapusch.FacebookApisForiOSComponents/Native/iOS/` — Objective-C wrapper source + scripts (repo-only)
- `DependencyLocks/iOS/lockstate.txt` — pinned Facebook iOS SDK artifacts
- `Docs/` — integration docs
- `samples/` — optional sample template (no secrets committed)

## Validation
- `bash tests/validate-feature-selection.sh` — feature selection and wrapper source invariants.
- `python3 scripts/validate-package.py` — packed layout, native exports, App Events bindings and constants.
- `python3 scripts/verify-public.py` — no consuming-app names or real Facebook credentials in tracked files.
- When package contents or native entry points change, update `scripts/validate-package.py` in the same commit.

## Safety
- Do not add new dependency ingestion paths without documenting them in `README.md`.
- Do not commit real app ids/secrets.
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Thanks for contributing!
If you are working without the NuGet (ProjectReference), see `Docs/SourceMode.md`.


Build the Swift wrapper:
Build the Objective-C wrappers (this also restores and collects the pinned Facebook SDK xcframeworks):

- `bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/build.sh`

Collect the Facebook SDK xcframeworks (from the SwiftPM scratch produced by the build):
Re-collect the Facebook SDK xcframeworks only (restores them from `DependencyLocks/iOS/lockstate.txt` when needed):

- `bash src/Kapusch.FacebookApisForiOSComponents/Native/iOS/collect-facebook-xcframeworks.sh`

Expand All @@ -27,14 +27,14 @@ Pack the NuGet:
## Formatting

- C#: follow `.editorconfig` (tabs, LF).
- Swift: keep changes minimal and consistent with existing style.
- Objective-C: keep changes minimal and consistent with existing style (tabs, ARC, Objective-C SDK surface only).

## Pull requests

- Keep PRs focused and well-scoped.
- Branch from `master` and target `master`; this repository does not use long-lived `release/*` branches.
- Do not commit secrets.
- If you update the Facebook SDK version, update `Package.swift` and `Package.resolved` together.
- If you update the Facebook SDK version, update every line of `DependencyLocks/iOS/lockstate.txt` together. The SHA-256 values must equal the `remoteChecksum` values of the upstream `Package.swift` at the same tag.

See `Docs/Release.md` before changing versions, tags, or publishing workflows.

Expand Down
10 changes: 10 additions & 0 deletions DependencyLocks/iOS/lockstate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Pinned Facebook iOS SDK release artifacts (dynamic xcframeworks).
# Format: <url> <sha256> <filename>
# The SHA-256 values equal the `remoteChecksum` values of the upstream
# Package.swift at the same tag.

https://github.com/facebook/facebook-ios-sdk/releases/download/v19.0.0/FBSDKCoreKit_Basics-Dynamic_XCFramework.zip 7cdfe6a706a4852854aac2dcb24b4aa48ad231f1a3655605ea2333b6d0e2b305 FBSDKCoreKit_Basics-Dynamic_XCFramework.zip
https://github.com/facebook/facebook-ios-sdk/releases/download/v19.0.0/FBAEMKit-Dynamic_XCFramework.zip df494f1e8130d975a0dfbfd54d1471c63d86767589bf03b98f6631ad87feb2ad FBAEMKit-Dynamic_XCFramework.zip
https://github.com/facebook/facebook-ios-sdk/releases/download/v19.0.0/FBSDKCoreKit-Dynamic_XCFramework.zip 791756b0786b79909de375d7060304d7822edac738218863f07470b1acfcde76 FBSDKCoreKit-Dynamic_XCFramework.zip
https://github.com/facebook/facebook-ios-sdk/releases/download/v19.0.0/FBSDKLoginKit-Dynamic_XCFramework.zip d8e23d410d03776f5a2d267f3d935b12a391b878d921c286de9460ac0abad2a9 FBSDKLoginKit-Dynamic_XCFramework.zip
https://github.com/facebook/facebook-ios-sdk/releases/download/v19.0.0/FBSDKShareKit-Dynamic_XCFramework.zip e0c095a0fd6bbf51a1e349de09836f025e73ad907809bae7fcc5ee33934c2ceb FBSDKShareKit-Dynamic_XCFramework.zip
Loading
Loading