Reputation: 1123
I'm currently developing an iOS SDK using Cocoapods to manage deployment and Jazzy to generate documentation. I recently added a dependency to Google ads v8 in a subspec, and another dependency to Google ads v7 in another subspec, like this:
s.subspec 'Admob' do |admob|
admob.source_files = 'MyLib/Classes/admob/**/*.{swift,h,m}'
admob.dependency 'MyLib/Core'
admob.dependency 'Google-Mobile-Ads-SDK', '~> 8.0'
admob.xcconfig = { 'OTHER_SWIFT_FLAGS' => '$(inherited) -D SDK_ADMOB' }
end
s.subspec 'Admob7' do |admob|
admob.source_files = 'MyLib/Classes/admob7/**/*.{swift,h,m}'
admob.dependency 'MyLib/Core'
admob.dependency 'Google-Mobile-Ads-SDK', '~> 7.0'
admob.xcconfig = { 'OTHER_SWIFT_FLAGS' => '$(inherited) -D SDK_ADMOB' }
admob.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
admob.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
end
Everything is working fine, except when I want to generate doc with Jazzy. Here is my conf:
documentation: "*.md"
xcodebuild_arguments: -scheme,Tests
module: MyLib
sdk: iphone
source_directory: MyLib
podspec: MyLib.podspec
theme: fullwidth
readme: USERGUIDE.md
when I run bundle exec jazzy
I have a conflict because it wants tu use all my subspecs at the same time:
Using config file /Users/***/***/.jazzy.yaml
Analyzing dependencies
bundler: failed to load command: jazzy (/usr/local/lib/ruby/gems/2.7.0/bin/jazzy)
Pod::Informative: [!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":
In Podfile:
MyLib/Admob (from `/Users/***/***`) was resolved to 2.8.0, which depends on
Google-Mobile-Ads-SDK (~> 8.0)
MyLib/Admob7 (from `/Users/***/***`) was resolved to 2.8.0, which depends on
Google-Mobile-Ads-SDK (~> 7.0)
Can somebody tell me if it's possible to exclude one or several subspecs from my doc generation?
Upvotes: 2
Views: 430
Reputation: 1123
Ok, it appears that there are no options in Jazzy to overcome this issue. I ended up writing this script:
### Removing admob7 subspec before generating doc is necessary.
# add a new line to the podspec file to remove it after awk treatment
echo "" >> MyLib.podspec
# create the jazzy podspec
awk '!/Admob7/' RS=s.subspec ORS=s.subspec MyLib.podspec > MyLib.jazzy.podspec
# clean the last line which contains an awk artifact
sed -i '' -e '$ d' MyLib.jazzy.podspec
# remove the last line we added before
sed -i '' -e '$ d' MyLib.podspec
bundle exec jazzy
And changed the podspec in the jazzy yml config file
documentation: "*.md"
xcodebuild_arguments: -scheme,Tests
module: MyLib
sdk: iphone
source_directory: MyLib
podspec: MyLib.jazzy.podspec
theme: fullwidth
readme: USERGUIDE.md
Upvotes: 1