MOBILESDK-318: Add StripeCore dependency to Stripe (#273)

- Add a dependency on `StripeCore` for the StripeiOS target, Carthage, SPM, and Cocoapods
- Update `StripeCore.podspec` to use a tag instead of a branch
- Shared `StripeCore.xcscheme` so Carthage builds StripeCore
- Modified `build_documentation.sh` to pass a temporary local podspec repo so it can find `StripeCore`
This commit is contained in:
Mel 2021-07-01 13:46:14 -07:00 committed by GitHub
parent 5065438a28
commit 45ee1ac390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 149 additions and 5 deletions

View File

@ -16,7 +16,7 @@ let package = Package(
targets: [
.target(
name: "Stripe",
dependencies: ["Stripe3DS2"],
dependencies: ["Stripe3DS2", "StripeCore"],
path: "Stripe",
exclude: ["Info.plist"],
resources: [

View File

@ -18,6 +18,7 @@ Pod::Spec.new do |s|
s.weak_framework = 'SwiftUI'
s.source_files = 'Stripe/*.swift', 'Stripe/PanModal/**/*.swift'
s.ios.resource_bundle = { 'Stripe' => 'Stripe/Resources/**/*.{lproj,json,png,xcassets}' }
s.dependency 'StripeCore', "#{s.version}"
s.subspec 'Stripe3DS2' do |sp|
sp.source_files = 'Stripe3DS2/Stripe3DS2/**/*.{h,m}'
sp.resource_bundles = { 'Stripe3DS2' => ['Stripe3DS2/Stripe3DS2/Resources/**/*.{lproj,png}'] }

View File

@ -677,6 +677,7 @@
E640A4C1265F26A500B31E91 /* Analytic+Payments.swift in Sources */ = {isa = PBXBuildFile; fileRef = E640A4C0265F26A500B31E91 /* Analytic+Payments.swift */; };
E69552D625CCDC0F00753FDA /* STPiDEALBank.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69552D525CCDC0F00753FDA /* STPiDEALBank.swift */; };
E69552EB25D1E4F000753FDA /* STPGenericInputPickerField.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69552EA25D1E4EF00753FDA /* STPGenericInputPickerField.swift */; };
E6B0F5592686C0BA00055EAF /* StripeCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6B0F5582686C0BA00055EAF /* StripeCore.framework */; };
E6B8971F25FC4FD6002428E1 /* MockAnalyticsClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B8971E25FC4FD6002428E1 /* MockAnalyticsClient.swift */; };
E6B8972525FC532B002428E1 /* Analytic.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6B8972125FC5311002428E1 /* Analytic.swift */; };
F1122A7E1DFB84E000A8B1AF /* UINavigationBar+StripeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F1122A7D1DFB84E000A8B1AF /* UINavigationBar+StripeTest.m */; };
@ -1442,6 +1443,7 @@
E640A4C0265F26A500B31E91 /* Analytic+Payments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Analytic+Payments.swift"; sourceTree = "<group>"; };
E69552D525CCDC0F00753FDA /* STPiDEALBank.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STPiDEALBank.swift; sourceTree = "<group>"; };
E69552EA25D1E4EF00753FDA /* STPGenericInputPickerField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STPGenericInputPickerField.swift; sourceTree = "<group>"; };
E6B0F5582686C0BA00055EAF /* StripeCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = StripeCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E6B8971E25FC4FD6002428E1 /* MockAnalyticsClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAnalyticsClient.swift; sourceTree = "<group>"; };
E6B8972125FC5311002428E1 /* Analytic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Analytic.swift; sourceTree = "<group>"; };
ED627D57207EA348007EFC56 /* nb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = nb; path = Localizations/nb.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -1499,6 +1501,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E6B0F5592686C0BA00055EAF /* StripeCore.framework in Frameworks */,
F15232311EA93E6800D65C67 /* Contacts.framework in Frameworks */,
31EFEE0E258AE3F40069BC5F /* Stripe3DS2.framework in Frameworks */,
F1D765CE1EDE331500F37005 /* CoreLocation.framework in Frameworks */,
@ -1644,6 +1647,7 @@
11C74B9A164043050071C2CA /* Frameworks */ = {
isa = PBXGroup;
children = (
E6B0F5582686C0BA00055EAF /* StripeCore.framework */,
31EFEE0D258AE3F40069BC5F /* Stripe3DS2.framework */,
310FCA922582F1C6005FB2AE /* Stripe3DS2.framework */,
04E01F7921A8C37C0061402F /* OHHTTPStubs.xcframework */,

View File

@ -10,9 +10,7 @@ Pod::Spec.new do |s|
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.homepage = 'https://stripe.com/docs/mobile/ios'
s.authors = { 'Stripe' => 'support+github@stripe.com' }
# TODO(mludowise|MOBILESDK-265): Temporarily publish to branch so `pod lib lint` can pass.
# Change from branch back to `:tag => "#{s.version}"` before next deploy.
s.source = { :git => 'https://github.com/stripe/stripe-ios.git', :branch => "StripeCore-#{s.version}" }
s.source = { :git => 'https://github.com/stripe/stripe-ios.git', :tag => "#{s.version}" }
s.frameworks = 'Foundation', 'Security', 'WebKit', 'PassKit', 'Contacts', 'CoreLocation'
s.requires_arc = true
s.platform = :ios

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E69D63FA26855B250090B43D"
BuildableName = "StripeCore.framework"
BlueprintName = "StripeCore"
ReferencedContainer = "container:StripeCore.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E69D640326855B260090B43D"
BuildableName = "StripeCoreTests.xctest"
BlueprintName = "StripeCoreTests"
ReferencedContainer = "container:StripeCore.xcodeproj">
</BuildableReference>
</TestableReference>
</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 = "E69D63FA26855B250090B43D"
BuildableName = "StripeCore.framework"
BlueprintName = "StripeCore"
ReferencedContainer = "container:StripeCore.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -16,6 +16,7 @@
31CA744B25CCC669007FE8BF /* Stripe3DS2.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31CA744A25CCC669007FE8BF /* Stripe3DS2.xcframework */; };
31FF1DB1255FA383000EF4B0 /* Stripe.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04E6FD061B714DDF000C8759 /* Stripe.xcframework */; };
31FF1DB2255FA383000EF4B0 /* Stripe.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04E6FD061B714DDF000C8759 /* Stripe.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
E6F05EAA2687C76F00614D61 /* StripeCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6F05EA92687C76F00614D61 /* StripeCore.xcframework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -55,6 +56,7 @@
04E6FCFC1B714AC2000C8759 /* CarthageTestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarthageTestTests.swift; sourceTree = "<group>"; };
04E6FD061B714DDF000C8759 /* Stripe.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Stripe.xcframework; path = Carthage/Build/Stripe.xcframework; sourceTree = "<group>"; };
31CA744A25CCC669007FE8BF /* Stripe3DS2.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Stripe3DS2.xcframework; path = Carthage/Build/Stripe3DS2.xcframework; sourceTree = "<group>"; };
E6F05EA92687C76F00614D61 /* StripeCore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = StripeCore.xcframework; path = Carthage/Build/StripeCore.xcframework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -63,6 +65,7 @@
buildActionMask = 2147483647;
files = (
31FF1DB1255FA383000EF4B0 /* Stripe.xcframework in Frameworks */,
E6F05EAA2687C76F00614D61 /* StripeCore.xcframework in Frameworks */,
31CA744B25CCC669007FE8BF /* Stripe3DS2.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -139,6 +142,7 @@
isa = PBXGroup;
children = (
31CA744A25CCC669007FE8BF /* Stripe3DS2.xcframework */,
E6F05EA92687C76F00614D61 /* StripeCore.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";

View File

@ -4,6 +4,7 @@ target 'CocoapodsTest' do
platform :ios, '11.0'
use_frameworks!
pod 'Stripe', path: '../../../..'
pod 'StripeCore', path: '../../../..'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|

View File

@ -4,6 +4,7 @@ target 'CocoapodsTest' do
platform :ios, '11.0'
use_frameworks!
pod 'Stripe', path: '../../../..'
pod 'StripeCore', path: '../../../..'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|

View File

@ -1,6 +1,7 @@
target 'CocoapodsTest' do
pod 'Stripe', path: '../../../..'
pod 'StripeCore', path: '../../../..'
post_install do |installer|
installer.pods_project.build_configurations.each do |config|

View File

@ -29,6 +29,15 @@ if [[ "${jazzy_version_local}" != "${jazzy_version_remote}" ]]; then
die "Please update jazzy: \`gem update jazzy\`"
fi
# Create temp podspec directory
temp_spec_dir="$(/bin/bash "$script_dir/make_temp_spec_repo.sh")"
make_dir_status=$?
if [ $make_dir_status -ne 0 ]; then
die "$temp_spec_dir"
fi
echo "Sucessfully created podspec repo at \`$temp_spec_dir\`"
# Execute jazzy
release_version="$(cat "${script_dir}/../VERSION")"
@ -36,7 +45,11 @@ info "Executing jazzy..."
jazzy \
--config "${script_dir}/../.jazzy.yaml" \
--github-file-prefix "https://github.com/stripe/stripe-ios/tree/${release_version}" \
--podspec Stripe.podspec
--podspec Stripe.podspec \
--pod-sources "file://$temp_spec_dir"
# Cleanup temp podspec directory
rm -rf "$temp_spec_dir"
# Verify jazzy exit code
jazzy_exit_code="$?"

View File

@ -0,0 +1,44 @@
#!/bin/bash
# This script is used from `build_documentation.sh` as a workaround for a jazzy
# limitation so we can specify pod dependencies using the local source directory.
# It creates a temp git repo mimicing the directory structure of a pod spec
# repo containing modified versions of our *.podspec files which use a local
# file:// URL as their source. It prints the resulting directory path which is
# passed to jazzy as its `--pod-sources` argument.
#
# Note: The temporary directory should be deleted after it's finished being used.
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root_dir="$(realpath "${script_dir}/../")"
release_version="$(cat "${root_dir}/VERSION")"
# Create temp podspec directory
temp_spec_dir="$(mktemp -d)"
# Copy and modify each podspec
for podspec in ${root_dir}/*.podspec
do
# Extract the name of the pod
filename="$(basename $podspec)"
podname="${filename%.*}"
# Create expected directory structure for .podspec file
mkdir "$temp_spec_dir/$podname"
mkdir "$temp_spec_dir/$podname/$release_version"
# Replace the s.source with file:// URL pointing to root_dir
cat $podspec \
| sed -E "s|(s\.source *= *)\{(.*)\}|\1\{ :git => 'file://$root_dir' \}|" \
> "$temp_spec_dir/$podname/$release_version/$filename"
done
# Cocoapods needs this directory to be a git repo so it can clone it
cd "$temp_spec_dir"
git init -q > /dev/null
git add . > /dev/null
git commit -m "initial commit" > /dev/null
# print dir path when we're done
echo $temp_spec_dir