Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize the amount of specs being built by jazzy and improve checking which targets to build. #997

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions lib/jazzy/podspec_documenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ def sourcekitten_output(config)
installer = Pod::Installer.new(sandbox, podfile)
installer.install!
stdout = Dir.chdir(sandbox.root) do
specs_being_built = []
targets = installer.pod_targets
.select { |pt| pt.pod_name == podspec.root.name }
.select do |pt|
select = pt.specs[0].root == podspec.root && pt.specs.any? { |spec| !specs_being_built.include?(spec) }
specs_being_built.push(*pt.specs)
select
end
.map(&:label)

targets.map do |t|
Expand Down Expand Up @@ -114,23 +119,23 @@ def podfile
install! 'cocoapods',
integrate_targets: false,
deterministic_uuids: false

[podspec, *podspec.recursive_subspecs].each do |ss|
# test_specification exists from CocoaPods 1.3.0
next if ss.respond_to?('test_specification') && ss.test_specification

ss.available_platforms.each do |p|
# Travis builds take too long when building docs for all available
# platforms for the Moya integration spec, so we just document OSX.
# Also Moya's RxSwift subspec doesn't yet support Swift 4, so skip
# that too while we're at it.
# TODO: remove once jazzy is fast enough.
if ENV['JAZZY_INTEGRATION_SPECS']
next if (p.name != :osx) || (ss.name == 'Moya/RxSwift')
end
target("Jazzy-#{ss.name.gsub('/', '__')}-#{p.name}") do
use_frameworks!
platform p.name, p.deployment_target
specs_to_build = [podspec, *podspec.recursive_subspecs]
platforms_to_build = specs_to_build.flat_map(&:available_platforms).uniq
platforms_to_build.each do |p|
target("Jazzy-#{podspec.name}-#{p.name}") do
use_frameworks!
platform p.name, p.deployment_target
specs_to_build.select { |ss| ss.available_platforms.include?(p) }.each do |ss|
# test_specification exists from CocoaPods 1.3.0
next if ss.respond_to?('test_specification') && ss.test_specification
# Travis builds take too long when building docs for all available
# platforms for the Moya integration spec, so we just document OSX
# Also Moya's RxSwift subspec doesn't yet support Swift 4, so skip
# that too while we're at it.
# TODO: remove once jazzy is fast enough.
if ENV['JAZZY_INTEGRATION_SPECS']
next if (p.name != :osx) || (ss.name == 'Moya/RxSwift')
end
pod ss.name, path: path.realpath.to_s
end
end
Expand Down