Skip to content

Commit

Permalink
SPM Support (#1073)
Browse files Browse the repository at this point in the history
Summary:
Thanks for proposing a pull request!

To help us review the request, please complete the following:

- [x] sign [contributor license agreement](https://developers.facebook.com/opensource/cla)
- [x] I've ensured that all existing tests pass and added tests (when/where necessary)
- [x] I've updated the documentation (when/where necessary) and [Changelog](CHANGELOG.md) (when/where necessary)
- [x] I've added the proper label to this pull request (e.g. `bug` for bug fixes)

## Pull Request Details

Added a `Package.swift` manifest.
Updated imports to be non-modular for non-cocoapod setups.
Updated dynamic framework loader to compile with arc. - This should be checked. Not 100% sure I did not cause a regression.
Added a directory of symlinks to public header files - this was to get around a limitation in the SPM api where they will only accepts a path to header files (forces them to be located in the same directory) and not a list of header files.
Pull Request resolved: #1073

Test Plan:
**SPM:**

`cd fbsource/fbobjc/ios-sdk`

Initialize a new repository, add all the files and create a new commit on master.
`git init`
`git add .`
`git commit -m "new commit"`

Open the package itself with >= Xcode 11 by opening `Package.swift` instead of the usual project and verify that it builds

Open a new project with >= Xcode 11 and add a new swift package. For the Package Repository field put the path to the sdk.
`file:///Users/$whoami/fbsource/fbobjc/ios-sdk`

then specify the branch as `master`. This sample project should build and you should be able to consume the kits with `import FBSDKCoreKit` or `FacebookCore` (for the Swift variant), `import FBSDKLoginKit` or `import FacebookLogin` and `import FBSDKShareKit` or `import FacebookShare`.

Make sure that LoginKit and ShareKit also expose CoreKit symbols.

**Xcode:**

Can build all schemes as expected
`BuildAllKits`
`FBSDKTVOSKit-Universal`
`FBSDKTVOSKit-Dynamic`
`SwiftKits`

**CocoaPods:**

`cd fbsource/fbojbc/ios-sdk`

`bundle exec pod lib lint FBSDKCoreKit.podspec`

`bundle exec pod lib lint FBSDKLoginKit.podspec --include-podspecs=FBSDKCoreKit.podspec --allow-warnings`

`bundle exec pod lib lint FBSDKShareKit.podspec --include-podspecs=FBSDKCoreKit.podspec --allow-warnings`

**BUCK:**

`cd fbsource/fbobjc/ios-sdk`
`buck build ios-sdk:FBSDKCoreKit`
`buck build ios-sdk:FBSDKLoginKit`
`buck build ios-sdk:FBSDKShareKit`

Also all of the other BUCK targets (will be covered by sandcastle)

Reviewed By: dreamolight

Differential Revision: D17879652

Pulled By: joesus

fbshipit-source-id: d931140d0fb3b554f1e29e5c2af7e2173316670d
  • Loading branch information
joesus authored and facebook-github-bot committed Oct 29, 2019
1 parent 26833c5 commit f3be0da
Show file tree
Hide file tree
Showing 222 changed files with 1,042 additions and 319 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/FBSDKCoreKit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKit"
BuildableName = "FBSDKCoreKit"
BlueprintName = "FBSDKCoreKit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKit"
BuildableName = "FBSDKCoreKit"
BlueprintName = "FBSDKCoreKit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "SWIFT_PACKAGE"
value = "true"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKit"
BuildableName = "FBSDKCoreKit"
BlueprintName = "FBSDKCoreKit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
95 changes: 95 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Facebook.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKit"
BuildableName = "FBSDKCoreKit"
BlueprintName = "FBSDKCoreKit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FacebookCore"
BuildableName = "FacebookCore"
BlueprintName = "FacebookCore"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKitObjC"
BuildableName = "FBSDKCoreKitObjC"
BlueprintName = "FBSDKCoreKitObjC"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FBSDKCoreKit"
BuildableName = "FBSDKCoreKit"
BlueprintName = "FBSDKCoreKit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 1 addition & 0 deletions FBSDKCoreKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ Pod::Spec.new do |s|
ss.dependency 'FBSDKCoreKit/Core'
ss.platform = :ios
ss.source_files = 'FBSDKCoreKit/FBSDKCoreKit/Swift/*.{h,m,swift}'
ss.exclude_files = 'FBSDKCoreKit/FBSDKCoreKit/Swift/Exports.swift'
end
end
Loading

0 comments on commit f3be0da

Please sign in to comment.