From 42f411d266bb464d814caf32414362fbd593d628 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 29 Jul 2018 16:03:26 +0200 Subject: [PATCH 1/2] Minimize the amount of specs being built by jazzy. Also use a nicer check for whether we should build a target. --- lib/jazzy/podspec_documenter.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jazzy/podspec_documenter.rb b/lib/jazzy/podspec_documenter.rb index 419c746c5..03975fdb6 100644 --- a/lib/jazzy/podspec_documenter.rb +++ b/lib/jazzy/podspec_documenter.rb @@ -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| From fabb6eb8ec90a4565c7f44df01c26f415c6b0eed Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 29 Jul 2018 16:47:30 +0200 Subject: [PATCH 2/2] Rework podfile generation logic to even further minimize amount of specs built by jazzy. --- lib/jazzy/podspec_documenter.rb | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/jazzy/podspec_documenter.rb b/lib/jazzy/podspec_documenter.rb index 03975fdb6..d8848f15b 100644 --- a/lib/jazzy/podspec_documenter.rb +++ b/lib/jazzy/podspec_documenter.rb @@ -119,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