diff --git a/PodMergeExample/MergeFile b/PodMergeExample/MergeFile index 67c96f7..76dcacb 100644 --- a/PodMergeExample/MergeFile +++ b/PodMergeExample/MergeFile @@ -13,8 +13,11 @@ end group 'MergedSwiftPods' do # Swift Pods + swift_version! '5.0' + pod 'SnapKit', '5.0.1' pod 'SwiftyJSON', '5.0.0' + pod 'youtube-ios-player-helper' end group 'AlamofireGroup' do @@ -26,3 +29,8 @@ group 'AlamofireGroup' do pod 'AlamofireImage', '3.6.0' pod 'AlamofireActivityLogger', '2.5.0' end + +group 'Subspecs' + pod 'AppAuth/Core' + pod 'AppAuth/ExternalUserAgent' +end diff --git a/PodMergeExample/PodMergeExample/ViewController.swift b/PodMergeExample/PodMergeExample/ViewController.swift index 6ae05c8..7031ff0 100644 --- a/PodMergeExample/PodMergeExample/ViewController.swift +++ b/PodMergeExample/PodMergeExample/ViewController.swift @@ -16,6 +16,7 @@ import UI.TTTAttributedLabel import Networking.AFNetworking import Networking.SDWebImage +import Subspecs.AppAuth // Merged Swift Pods cannot be import individually, only all or none. import MergedSwiftPods @@ -50,6 +51,11 @@ class ViewController: UIViewController { // SnapKit Usage let box = UIView() box.snp.makeConstraints { _ in } + + let authorizationEndpoint = URL(string: "https://accounts.google.com/o/oauth2/v2/auth")! + let tokenEndpoint = URL(string: "https://www.googleapis.com/oauth2/v4/token")! + let configuration = OIDServiceConfiguration(authorizationEndpoint: authorizationEndpoint, + tokenEndpoint: tokenEndpoint) } } diff --git a/PodMergeExample/Podfile b/PodMergeExample/Podfile index d5f316b..3c37fdc 100644 --- a/PodMergeExample/Podfile +++ b/PodMergeExample/Podfile @@ -13,4 +13,5 @@ target 'PodMergeExample' do pod 'UI', :path => 'MergedPods/UI' pod 'AlamofireGroup', :path => 'MergedPods/AlamofireGroup' pod 'MergedSwiftPods', :path => 'MergedPods/MergedSwiftPods' + pod 'Subspecs', :path => 'MergedPods/Subspecs' end diff --git a/PodMergeExample/Podfile.lock b/PodMergeExample/Podfile.lock index 84587f5..4aeb8cf 100644 --- a/PodMergeExample/Podfile.lock +++ b/PodMergeExample/Podfile.lock @@ -3,6 +3,7 @@ PODS: - MergedSwiftPods (1.0.0) - Networking (1.0.0) - Nuke (8.3.1) + - Subspecs (1.0.0) - UI (1.0.0) DEPENDENCIES: @@ -10,6 +11,7 @@ DEPENDENCIES: - MergedSwiftPods (from `MergedPods/MergedSwiftPods`) - Networking (from `MergedPods/Networking`) - Nuke + - Subspecs (from `MergedPods/Subspecs`) - UI (from `MergedPods/UI`) SPEC REPOS: @@ -23,16 +25,19 @@ EXTERNAL SOURCES: :path: MergedPods/MergedSwiftPods Networking: :path: MergedPods/Networking + Subspecs: + :path: MergedPods/Subspecs UI: :path: MergedPods/UI SPEC CHECKSUMS: AlamofireGroup: 113f3ab321b31b75a748378909f3f96305b771a2 - MergedSwiftPods: 86f52fdd7411987cd39e6c80e709ef0de0126fd3 + MergedSwiftPods: 1d3174c8375d5c332021c20accaedaf11b5e58d0 Networking: 844633d13d2328a829083b24ffaee99aea51c1de Nuke: 85fb80f8df0cb26c28d2f4e0cb7fb93bcd6548d3 + Subspecs: 634e12dffc5b250b231410781ffa7b7c2c665b7a UI: 2aa82721ee430cd2f0ab314904bbe1a281fa2ff9 -PODFILE CHECKSUM: 689012d73798a7fea312905128d4dadb72554cf1 +PODFILE CHECKSUM: cf932697df9d1e546ce24dd892661e3d0e6d57ec COCOAPODS: 1.10.1 diff --git a/lib/cocoapods-pod-merge/Main.rb b/lib/cocoapods-pod-merge/Main.rb index 37ef482..475aed0 100644 --- a/lib/cocoapods-pod-merge/Main.rb +++ b/lib/cocoapods-pod-merge/Main.rb @@ -188,7 +188,8 @@ def parse_mergefile def merge(merged_framework_name, group_contents, podfile_info) Pod::UI.puts "Preparing to Merge: #{merged_framework_name}" - pods_to_merge = group_contents['titles'] + # Replace the Subspecs notation (e.g AppAuth/Core) for `AppAuth` only as the folder AppAuth/Core would not exist + pods_to_merge = group_contents['titles'].map { |pod_name| pod_name.sub /(\/[a-zA-Z]+)/,''}.uniq flags = group_contents['flags'] forced_swift_language_version = group_contents['swift_version'] platforms_in_target = group_contents['platforms'] @@ -231,7 +232,7 @@ def merge(merged_framework_name, group_contents, podfile_info) FileUtils.mkdir("#{InstallationDirectory}/#{merged_framework_name}/Sources") Pod::UI.puts 'Merging Pods'.cyan - pods_to_merge.each do |pod| + pods_to_merge.each_with_index do |pod, index| # Capture all resources to specify in the final podspec Pod::UI.puts "\t#{pod.cyan}" @@ -293,8 +294,13 @@ def merge(merged_framework_name, group_contents, podfile_info) # Read each pod's podspec, and collect configuration for the final merged podspec Pod::UI.puts "\t\tExtracting Detailed Podspecs".magenta + + # The originals pods name with the subspecs from the MergeFile. The subspecs are renamed to + # PodspecName_Subspec instead of PodspecName/Subspec + pods_to_merge_with_subspecs = group_contents['titles'].map { |pod_name| pod_name.sub '/','_'} + Dir.chdir("#{CacheDirectory}/Podspecs") do - info = extract_info_from_podspec(pod, mixed_language_group) + info = extract_info_from_podspec(pods_to_merge_with_subspecs[index], mixed_language_group) frameworks += info.frameworks prefix_header_contents += info.prefix_header_contents private_header_files += info.private_header_files