cocoapods-podgenerate 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c23dcfa65c98d07b1facb75c25c0b48c4899886f88397544887c38d95f1d695
4
- data.tar.gz: f5a1805ef912d83ce6ac2520b48a40543c76f02634bef505bab121910427fb1a
3
+ metadata.gz: a9b3c14400566dae090f4ce380901a448e6aed75b5aab2a9b83e2629c043e547
4
+ data.tar.gz: f8ce64ec3991bf97c28aac639a056cb566103cade356a2baf5d3fbac81083573
5
5
  SHA512:
6
- metadata.gz: f2f2628e7f34e56c628f006cdf785fc38df4e37e0e86cd04c52fe155b8eacf398ec656172b9476871438807acf987e13f3894c19501ce99c6e0a7a9cb0bae488
7
- data.tar.gz: 81d85b61da2db4da471411f0bc4ec3d4f42513d45a5358a2211c8bd0e352f01e0d02b888c99ef4c2ddf0ae6d12e8248b624eb98dda78e60a8a07691528a270f5
6
+ metadata.gz: 2e524501b0080aab551e23973570c0057570c4a0ddf72ec20996c7a0ff0f7de623d2138edbf667e363d3fd9ad22bb40c91d17fd48091c365e1fcfa953e388a1f
7
+ data.tar.gz: 7e2d6b08360a4c1d22ec27f0447634293b7d69f992ab13677829d73c997c00819c4fa99f04c346766b35e7541a25d313de80aba78c7a789c08ab1ba3531490c7
@@ -1,29 +1,70 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # [cocoapods-podgenerate]
4
- # Monkey-patches PodsProjectGenerator to optimize "Generating Pods project".
4
+ # Monkey-patches Pod::Installer and PodsProjectGenerator for step 3/4 optimizations.
5
5
  #
6
- # Optimizations:
7
- # 1. Parallelize PodTargetIntegrator integration (multiple pods at once)
8
- # 2. Delegate install_pod_targets to original (safe, no threading issues)
6
+ # v0.1.1 Optimizations:
7
+ # 1. Force-enable incremental_installation + generate_multiple_pod_projects
8
+ # 2. Skip project generation entirely when nothing changed
9
+ # 3. Parallelize PodTargetIntegrator integration
9
10
  #
10
- # Reference: CocoaPods — lib/cocoapods/installer/xcode/pods_project_generator.rb
11
+ # Reference: CocoaPods — lib/cocoapods/installer.rb
11
12
 
12
13
  module Pod
13
14
  module PodGenerate
14
15
  module Patches
15
16
  module InstallerPatch
16
17
  def self.apply
17
- Pod::UI.message '[cocoapods-podgenerate] Applying InstallerPatch (optimized integration)'
18
+ Pod::UI.message '[cocoapods-podgenerate] Applying InstallerPatch v2'
19
+ Pod::Installer.prepend(ForceIncrementalInstall)
18
20
  Pod::Installer::Xcode::PodsProjectGenerator.prepend(ParallelInstall)
19
21
  end
20
22
 
23
+ # ── Optimization 1: Force-enable incremental_installation ──
24
+ module ForceIncrementalInstall
25
+ def install!
26
+ installation_options.incremental_installation = true
27
+ installation_options.generate_multiple_pod_projects = true
28
+ super
29
+ end
30
+
31
+ # ── Optimization 2: Skip project generation when nothing changed ──
32
+ def generate_pods_project
33
+ stage_sandbox(sandbox, pod_targets)
34
+
35
+ cache_analysis_result = analyze_project_cache
36
+ ptg = cache_analysis_result.pod_targets_to_generate
37
+ atg = cache_analysis_result.aggregate_targets_to_generate
38
+
39
+ if ptg.empty? && (atg.nil? || atg.empty?)
40
+ Pod::UI.puts "[cocoapods-podgenerate] No changes — skipping project generation"
41
+ @generated_aggregate_targets = aggregate_targets
42
+ @generated_pod_targets = []
43
+ Pod::Installer::SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!
44
+ update_project_cache(cache_analysis_result,
45
+ Pod::Installer::Xcode::PodsProjectGenerator::InstallationResults.new({}, {}))
46
+ return
47
+ end
48
+
49
+ # Normal path
50
+ ptg.each do |pod_target|
51
+ pod_target.build_headers.implode_path!(pod_target.headers_sandbox)
52
+ sandbox.public_headers.implode_path!(pod_target.headers_sandbox)
53
+ end
54
+
55
+ create_and_save_projects(ptg, atg,
56
+ cache_analysis_result.build_configurations, cache_analysis_result.project_object_version)
57
+ Pod::Installer::SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!
58
+ update_project_cache(cache_analysis_result, target_installation_results)
59
+ end
60
+ end
61
+
62
+ # ── Optimization 3: Parallelize PodTargetIntegrator ──
21
63
  module ParallelInstall
22
64
  def install_pod_targets(project, pod_targets)
23
65
  super
24
66
  end
25
67
 
26
- # Override integrate_targets to run in parallel
27
68
  def integrate_targets(pod_target_installation_results)
28
69
  pods_to_integrate = pod_target_installation_results.values.select do |result|
29
70
  target = result.target
@@ -1,21 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # [cocoapods-podgenerate]
4
- # Monkey-patches PodsProjectWriter to support incremental project saves.
5
- # Uses project.pbxproj file for change detection via SHA256 digest.
4
+ # Monkey-patches PodsProjectWriter to support incremental + parallel project saves.
6
5
  #
7
- # Reference: CocoaPods source — lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb
6
+ # v0.1.1 Optimizations:
7
+ # 1. SHA256 digest — skip sort+save for unchanged projects
8
+ # 2. Parallel save — multiple xcodeproj files saved in threads
9
+ #
10
+ # Reference: CocoaPods — lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb
8
11
 
9
12
  module Pod
10
13
  module PodGenerate
11
14
  module Patches
12
15
  module ProjectWriterPatch
13
16
  def self.apply
14
- Pod::UI.message '[cocoapods-podgenerate] Applying ProjectWriterPatch (incremental save)'
15
- Pod::Installer::Xcode::PodsProjectWriter.prepend(IncrementalSave)
17
+ Pod::UI.message '[cocoapods-podgenerate] Applying ProjectWriterPatch v2 (incremental + parallel save)'
18
+ Pod::Installer::Xcode::PodsProjectWriter.prepend(IncrementalAndParallelSave)
16
19
  end
17
20
 
18
- module IncrementalSave
21
+ module IncrementalAndParallelSave
19
22
  def initialize(sandbox, projects, pod_target_installation_results, installation_options)
20
23
  super
21
24
  @project_digests = {}
@@ -24,18 +27,42 @@ module Pod
24
27
  compute_initial_digests
25
28
  end
26
29
 
30
+ # ── Optimization: SHA256 skip + parallel save ──
27
31
  def save_projects(projects)
28
- projects.each do |project|
32
+ # Filter: skip projects whose pbxproj is unchanged
33
+ to_save = projects.select do |project|
29
34
  if project_unchanged?(project)
30
35
  Pod::UI.message "- Skipping unchanged project #{UI.path project.path}"
31
- next
36
+ false
37
+ else
38
+ true
32
39
  end
40
+ end
41
+ return if to_save.empty?
42
+
43
+ # Sort each project
44
+ to_save.each { |p| p.sort(:groups_position => :below) if needs_sort?(p) }
33
45
 
34
- project.sort(:groups_position => :below) if needs_sort?(project)
35
- Pod::UI.message "- Writing Xcode project file to #{UI.path project.path}" do
36
- project.save
46
+ # Parallel save (safe: each xcodeproj is an independent directory)
47
+ if to_save.size > 1
48
+ Pod::UI.message "- Saving #{to_save.size} projects in parallel"
49
+ threads = to_save.map do |project|
50
+ Thread.new do
51
+ begin
52
+ Pod::UI.message "- Writing Xcode project file to #{UI.path project.path}"
53
+ project.save
54
+ update_digest(project)
55
+ rescue StandardError => e
56
+ Pod::UI.warn "[cocoapods-podgenerate] Parallel save error: #{e.message}"
57
+ end
58
+ end
59
+ end
60
+ threads.each(&:join)
61
+ else
62
+ Pod::UI.message "- Writing Xcode project file to #{UI.path to_save.first.path}" do
63
+ to_save.first.save
64
+ update_digest(to_save.first)
37
65
  end
38
- update_digest(project)
39
66
  end
40
67
  end
41
68
 
@@ -74,7 +101,6 @@ module Pod
74
101
  def pbxproj_path(project)
75
102
  path = project.path
76
103
  return nil unless path
77
- # .xcodeproj is a directory; the actual content is in project.pbxproj
78
104
  if path.to_s.end_with?('.xcodeproj')
79
105
  File.join(path.to_s, 'project.pbxproj')
80
106
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-podgenerate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PodGenerate Team
@@ -81,7 +81,7 @@ dependencies:
81
81
  version: '3.0'
82
82
  description: A CocoaPods plugin that accelerates pod install for large-scale projects
83
83
  with 200+ pods by introducing parallel processing, optimized dependency analysis,
84
- and incremental project generation.
84
+ incremental project generation, and multi-project parallel saving.
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
@@ -98,7 +98,7 @@ files:
98
98
  - lib/cocoapods-podgenerate/patches/project_writer_patch.rb
99
99
  - lib/cocoapods-podgenerate/patches/user_integrator_patch.rb
100
100
  - lib/cocoapods_plugin.rb
101
- homepage: https://github.com/example/cocoapods-podgenerate
101
+ homepage: https://github.com/lengain/cocoapods-podgenerate
102
102
  licenses:
103
103
  - MIT
104
104
  metadata: {}