Skip to content

Commit

Permalink
Import most third party libraries as Swift packages (#23378)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmassel authored Jul 5, 2024
2 parents e0fd9fd + 68cf81b commit caee457
Show file tree
Hide file tree
Showing 253 changed files with 14,788 additions and 8,496 deletions.
9 changes: 0 additions & 9 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ steps:
- github_commit_status:
context: "Unit Tests"

- label: "🔬 :wordpress: Tests {{ matrix }}"
command: ".buildkite/commands/run-pod-tests.sh {{ matrix }}"
plugins: [$CI_TOOLKIT_PLUGIN]
artifact_paths:
- "build/results/*"
matrix:
- WordPressKit
- WordPressAuthenticator

#################
# UI Tests
#################
Expand Down
196 changes: 15 additions & 181 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,16 @@ inhibit_all_warnings!
use_frameworks!
workspace 'WordPress.xcworkspace'

## Pods shared between all the targets
## ===================================
##
def wordpress_shared
pod 'WordPressShared', '~> 2.3', '>= 2.3.1'
# pod 'WordPressShared', git: 'https://github.com/wordpress-mobile/WordPress-iOS-Shared.git', branch: ''
# pod 'WordPressShared', git: 'https://github.com/wordpress-mobile/WordPress-iOS-Shared.git', commit: ''
# pod 'WordPressShared', path: '../WordPress-iOS-Shared'
end

def aztec
## When using a tagged version, feel free to comment out the WordPress-Aztec-iOS line below.
## When using a commit number (during development) you should provide the same commit number for both pods.
##
# pod 'WordPress-Aztec-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
# pod 'WordPress-Editor-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
# pod 'WordPress-Editor-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', tag: ''
# pod 'WordPress-Editor-iOS', path: '../AztecEditor-iOS'
pod 'WordPress-Editor-iOS', '~> 1.19.11'
end

def wordpress_ui
pod 'WordPressUI', '~> 1.16'
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', tag: ''
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', branch: ''
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', commit: ''
# pod 'WordPressUI', path: '../WordPressUI-iOS'
end

def gravatar
# pod 'Gravatar', path: '../Gravatar-SDK-iOS'
# pod 'GravatarUI', path: '../Gravatar-SDK-iOS'
Expand All @@ -57,49 +38,9 @@ def gravatar
pod 'GravatarUI', '2.0.0'
end

def wordpress_kit
pod 'WordPressKit', path: './WordPressKit', testspecs: ['Tests']
end

def shared_with_all_pods
wordpress_shared
pod 'CocoaLumberjack/Swift', '~> 3.0'
pod 'NSObject-SafeExpectations', '~> 0.0.4'
end

def shared_with_networking_pods
pod 'Reachability', '~> 3.7'

wordpress_kit
end

def shared_test_pods
pod 'OHHTTPStubs/Swift', '~> 9.1.0'
pod 'OCMock', '~> 3.4.3'
gutenberg_pod
end

def shared_with_extension_pods
shared_style_pods
# The PrivacyInfo in this library is incorrectly copied to the app bundle's root directory.
# That conflicts with the our own app's PrivacyInfo. We can update this library once the
# issue is resolved.
# See https://github.com/weichsel/ZIPFoundation/pull/314
pod 'ZIPFoundation', '0.9.16'
pod 'Down', '~> 0.6.6'
end

def shared_style_pods
pod 'Gridicons', '~> 1.2'
end

abstract_target 'Apps' do
project 'WordPress/WordPress.xcodeproj'

shared_with_all_pods
shared_with_networking_pods
shared_with_extension_pods

## Gutenberg (React Native)
## =====================
##
Expand All @@ -108,47 +49,27 @@ abstract_target 'Apps' do
## Third party libraries
## =====================
##
pod 'Gifu', '3.3.1'

app_center_version = '~> 5.0'
app_center_configurations = %w[Release-Internal Release-Alpha]
pod 'AppCenter', app_center_version, configurations: app_center_configurations
pod 'AppCenter/Distribute', app_center_version, configurations: app_center_configurations

pod 'Starscream', '~> 4.0'
pod 'SVProgressHUD', '2.2.5'
pod 'ZendeskSupportSDK', '5.3.0'
pod 'AlamofireImage', '~> 4.0'
pod 'FSInteractiveMap', git: 'https://github.com/wordpress-mobile/FSInteractiveMap.git', tag: '0.2.0'
pod 'JTAppleCalendar', '~> 8.0.5'
pod 'CropViewController', '2.5.3'

## Automattic libraries
## ====================
##
wordpress_kit
wordpress_shared
gravatar

# Production

pod 'Automattic-Tracks-iOS', '~> 3.3'
# While in PR
# pod 'Automattic-Tracks-iOS', git: 'https://github.com/Automattic/Automattic-Tracks-iOS.git', branch: ''
# Local Development
# pod 'Automattic-Tracks-iOS', path: '~/Projects/Automattic-Tracks-iOS'

pod 'NSURL+IDN', '~> 0.4'

pod 'WordPressAuthenticator', path: './WordPressAuthenticator', testspecs: ['Tests']

pod 'MediaEditor', '~> 1.2', '>= 1.2.2'
# pod 'MediaEditor', git: 'https://github.com/wordpress-mobile/MediaEditor-iOS.git', commit: ''
# pod 'MediaEditor', path: '../MediaEditor-iOS'

aztec
wordpress_ui
shared_style_pods

## WordPress App iOS
## =================
Expand All @@ -157,7 +78,7 @@ abstract_target 'Apps' do
target 'WordPressTest' do
inherit! :search_paths

shared_test_pods
gutenberg_pod
end
end

Expand All @@ -173,23 +94,13 @@ end
target 'WordPressShareExtension' do
project 'WordPress/WordPress.xcodeproj'

shared_with_extension_pods

aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end

target 'JetpackShareExtension' do
project 'WordPress/WordPress.xcodeproj'

shared_with_extension_pods

aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end

## DraftAction Extension
Expand All @@ -198,83 +109,13 @@ end
target 'WordPressDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'

shared_with_extension_pods

aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end

target 'JetpackDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'

shared_with_extension_pods

aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end

## Widgets
## ============
##

target 'JetpackStatsWidgets' do
project 'WordPress/WordPress.xcodeproj'

shared_with_all_pods
shared_with_networking_pods
shared_style_pods

wordpress_ui
end

## Intents
## ============
##

target 'JetpackIntents' do
project 'WordPress/WordPress.xcodeproj'

shared_with_all_pods
shared_with_networking_pods

wordpress_ui
end

## Notification Service Extension
## ==============================
##
target 'WordPressNotificationServiceExtension' do
project 'WordPress/WordPress.xcodeproj'

wordpress_kit
wordpress_shared
wordpress_ui
end

target 'JetpackNotificationServiceExtension' do
project 'WordPress/WordPress.xcodeproj'

wordpress_kit
wordpress_shared
wordpress_ui
end

## Screenshot Generation
## ===================
##
target 'WordPressScreenshotGeneration' do
project 'WordPress/WordPress.xcodeproj'
end

## UI Tests
## ===================
##
target 'WordPressUITests' do
project 'WordPress/WordPress.xcodeproj'
end

## Tools
Expand All @@ -297,25 +138,28 @@ end
# Make all pods that are not shared across multiple targets into static frameworks by overriding the static_framework? function to return true
# Linking the shared frameworks statically would lead to duplicate symbols
# A future version of CocoaPods may make this easier to do. See https://github.com/CocoaPods/CocoaPods/issues/7428
shared_targets = ['WordPressFlux']
shared_targets = %w[WordPressFlux]
dyanmic_framework_pods = %w[WordPressFlux]
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
dyanmic_framework_pods += %w[Sentry SentryPrivate]
pre_install do |installer|
static = []
dynamic = []
installer.pod_targets.each do |pod|
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
if %w[Sentry SentryPrivate].include? pod.name
dynamic << pod
next
end
use_dynamic_frameworks = false
use_dynamic_frameworks = true if dyanmic_framework_pods.include? pod.name

# If this pod is a dependency of one of our shared targets, it must be linked dynamically
if pod.target_definitions.any? { |t| shared_targets.include? t.name }
use_dynamic_frameworks = true if pod.target_definitions.any? { |t| shared_targets.include? t.name }

if use_dynamic_frameworks
dynamic << pod
next
pod.instance_variable_set(:@build_type, Pod::BuildType.dynamic_framework)
else
static << pod
pod.instance_variable_set(:@build_type, Pod::BuildType.static_framework)
end
static << pod
pod.instance_variable_set(:@build_type, Pod::BuildType.static_framework)
end
puts "Installing #{static.count} pods as static frameworks"
puts "Installing #{dynamic.count} pods as dynamic frameworks"
Expand Down Expand Up @@ -396,16 +240,6 @@ post_install do |installer|
end
# rubocop:enable Style/CombinableLoops

# Flag Alpha builds for Tracks
# ============================
#
tracks_target = installer.pods_project.targets.find { |target| target.name == 'Automattic-Tracks-iOS' }
# This will crash if/when we'll remove Tracks.
# That's okay because it is a crash we'll only have to address once.
tracks_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'ALPHA=1'] if (config.name == 'Release-Alpha') || (config.name == 'Release-Internal')
end

yellow_marker = "\033[33m"
reset_marker = "\033[0m"
puts "#{yellow_marker}The abstract target warning below is expected. Feel free to ignore it.#{reset_marker}"
Expand Down
Loading

0 comments on commit caee457

Please sign in to comment.