{"id":50837621,"url":"https://github.com/lengain/cocoapods-podgenerate","last_synced_at":"2026-06-20T11:00:58.569Z","repository":{"id":364551426,"uuid":"1268344342","full_name":"lengain/cocoapods-podgenerate","owner":"lengain","description":"CocoaPods Performance Acceleration Plugin","archived":false,"fork":false,"pushed_at":"2026-06-17T15:22:08.000Z","size":309,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T09:25:45.115Z","etag":null,"topics":["cocoapods-plugin"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lengain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T12:23:09.000Z","updated_at":"2026-06-17T15:23:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lengain/cocoapods-podgenerate","commit_stats":null,"previous_names":["lengain/cocoapods-podgenerate"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/lengain/cocoapods-podgenerate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengain%2Fcocoapods-podgenerate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengain%2Fcocoapods-podgenerate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengain%2Fcocoapods-podgenerate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengain%2Fcocoapods-podgenerate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lengain","download_url":"https://codeload.github.com/lengain/cocoapods-podgenerate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengain%2Fcocoapods-podgenerate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34526073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods-plugin"],"created_at":"2026-06-14T05:01:10.866Z","updated_at":"2026-06-20T11:00:58.553Z","avatar_url":"https://github.com/lengain.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cocoapods-podgenerate 🚀\n\n**CocoaPods 性能加速插件** — 专为 150+ Pod 依赖的大型项目优化 `pod install`。\n\n在使用 CocoaPods 管理 150+ 甚至更多 Pod 依赖的大型项目中，`pod install` **第3步（Generating Pods project）** 和 **第4步（Integrating client project）** 是主要瓶颈。本插件通过多补丁协同工作，显著降低这些步骤的耗时。\n\n---\n\n## 效果\n\n\u003e 测试环境：150 pods · 26源文件+3资源/pod · ObjC+Swift混编 · 6 targets · Apple M3 · v0.1.11\n\n| 方案 | 插件来源 | Podfile plugin | 首次安装 | 增量安装 | 相对无插件加速 |\n|:---:|:------:|:-------------:|:-------:|:-------:|:----------:|\n| A | 本地路径 | ✅ | 7.06s | 1.67s | **+76.8%** 🚀 |\n| B | 无 | ❌ | 7.14s | 7.19s | 基准 |\n| C | 生产 gem | ✅ | 7.24s | 1.70s | **+76.4%** 🚀 |\n\n\u003e 对比脚本见 `example/compare.sh`，包含 A/B/C 三方对照及增量/首轮双维度对比。\n\n---\n\n---\n\n## 使用方式\n\n### 安装\n\n```bash\ngem install cocoapods-podgenerate\n```\n\n要求 Ruby \u003e= 3.0、CocoaPods \u003e= 1.10.0。\n\n### 在 Podfile 中启用\n\n```ruby\nplugin 'cocoapods-podgenerate'\n```\n\n### 执行\n\n```bash\npod install\n```\n\n插件会自动激活并输出性能报告。\n\n### 调试模式\n\n```bash\nCOCOAPODS_PODGENERATE_DEBUG=1 pod install\n```\n\n输出示例：\n\n```\n[cocoapods-podgenerate] Performance Report:\n    Resolve dependencies              0.35s (2.5%)\n    Download dependencies             0.01s (0.0%)\n      Create and save projects        4.34s (30.8%)\n    Generate Pods project             4.38s (31.1%)\n    Integrate user project            0.02s (0.1%)\n    Write lockfiles                   0.04s (0.3%)\n  Total install!                      4.96s (35.2%)\n```\n\n---\n\n## 项目结构\n\n```\nPodGenerate/\n├── cocoapods-podgenerate.gemspec       # Gem 规范\n├── Gemfile\n├── lib/\n│   ├── cocoapods_plugin.rb             # CLAide 插件发现入口\n│   └── cocoapods-podgenerate/\n│       ├── cocoapods-podgenerate.rb    # 入口，激活所有补丁\n│       ├── command.rb                  # pod podgenerate CLI 命令\n│       ├── hooks.rb                    # :pre_install hook\n│       ├── patches/\n│       │   ├── installer_patch.rb      # 强制增量 + 跳过 + 并行集成 + 并行 schemes\n│       │   ├── multi_project_generator_patch.rb  # 并行 PodTargetInstaller (v0.1.2)\n│       │   ├── project_patch.rb        # pod_group 哈希缓存\n│       │   ├── project_writer_patch.rb # 增量写入 + 并行 cleanup/schemes/save\n│       │   ├── analyzer_patch.rb       # 依赖解析缓存\n│       │   ├── cache_analyzer_patch.rb # 并行 cache key 计算 (v0.1.2)\n│       │   └── user_integrator_patch.rb# 多 target 并行集成 + 并行 xcconfig 警告\n│       ├── parallel/\n│       │   ├── thread_pool.rb          # 线程池封装\n│       │   └── batch_processor.rb      # 批处理工具\n│       └── benchmark/\n│           └── profiler.rb             # 性能分析器（含子步骤计时）\n└── example/                            # 性能测试框架\n    ├── compare.sh                      # A/B/C 三方对比（首轮 + 增量）\n    ├── enhance_pods.rb                 # 增强 pod 模板\n    ├── generate_podfile.rb             # 生成 150 个测试 pod\n    ├── multi_target_test.rb            # 多 target 场景测试\n    ├── complex_podfile_test.rb         # 复杂 Podfile 兼容性测试（abstract_target + inherit! + test_spec）\n    ├── run_complex_test.rb             # 复杂 Podfile 测试运行器\n    ├── run_flutter_test.rb             # Flutter 兼容性测试（内联 + load podhelper.rb 双模式）\n    ├── run_flutter_integration_test.rb # Flutter Add-to-App 集成测试\n    ├── run_with_plugin.rb              # 手动加载插件运行（调试用）\n    ├── Gemfile                         # ExampleA/C 的 Gemfile\n    ├── ExampleA/                       # 本地路径插件工程\n    ├── ExampleB/                       # 纯原生 CocoaPods 基准工程\n    └── ExampleC/                       # 生产 gem 插件工程\n```\n\n---\n\n## 测试\n\n项目包含完整的性能测试框架，支持三种方案的横向对比：\n\n| 方案 | 说明 | 运行方式 |\n|:---:|:----|:--------:|\n| ExampleA | 本地路径插件 + Podfile `plugin` 声明 | `bundle exec pod install` |\n| ExampleB | 纯原生 CocoaPods（无插件）基准 | `pod install` |\n| ExampleC | 生产 gem 插件 + Podfile `plugin` 声明 | `bundle exec pod install` |\n\n```bash\ncd example\n\n# 增强 pod 模板（添加更多源文件和资源）\nruby enhance_pods.rb\n\n# 生成 150 个测试 pod\nruby generate_podfile.rb\n\n# A/B/C 三方对比测试（首次干净安装 + 增量安装 + 性能表格）\nbash compare.sh\n\n# 手动调试：在指定 Example 目录运行\ncd ExampleC \u0026\u0026 bundle exec pod install --verbose\n\n# 多 target 场景测试（6 个 target）\nruby ../multi_target_test.rb\n\n# 复杂 Podfile 兼容性测试（abstract_target + inherit! + test_spec 等）\nruby ../complex_podfile_test.rb\n\n# Flutter 兼容性测试（内联 depends_on_flutter / load podhelper.rb）\nruby ../run_flutter_test.rb          # Mode A: 内联\nruby ../run_flutter_test.rb --b     # Mode B: load podhelper.rb\n\n# Flutter Add-to-App 完整集成测试\nruby ../run_flutter_integration_test.rb\n```\n\n\u003e **注意**：`compare.sh` 会自动管理系统 gem 的安装/卸载，确保 ExampleB 不被插件影响。运行过程中会临时卸载 cocoapods-podgenerate gem，运行完 B 后重新安装。\n\n---\n\n## 兼容性\n\n- **CocoaPods**: \u003e= 1.10.0（已验证 1.16.2）\n- **Ruby**: \u003e= 3.0\n- **Platform**: macOS（Xcode 项目集成）\n- **Flutter**: ≥ v0.1.9 完全兼容 Flutter Add-to-App `load podhelper.rb` 集成模式\n- **Xcode 动态刷新**: ≥ v0.1.12 每次 `pod install` 都会更新 Pods 项目文件修改时间，触发 Xcode Dynamic Project Reloading（项目树自动刷新）\n- 不影响 Xcode 编译产物，仅优化 `pod install` 过程\n\n### Flutter 集成注意\n\n本插件强制启用 `generate_multiple_pod_projects`，这会导致 Xcodeproj 无法解析跨项目的 `PBXTargetDependency` 引用（`dependency.target` 返回 `nil`）。Flutter 的 `depends_on_flutter` 递归遍历依赖链时会因此崩溃。\n\n**v0.1.9+** 在 post-install hooks 执行前自动解析全部项目的跨项目依赖引用，确保 `depends_on_flutter` 递归遍历不会遇到 `nil`。如果你在 Flutter 项目中使用此插件，请使用 ≥ v0.1.11 版本（含 nil 保护）。\n\n---\n\n## 功能\n\n### 补丁总览\n\n| 补丁                                 | 优化目标                                                   | 步骤  | 引入版本 |\n| ---------------------------------- | ------------------------------------------------------ |:---:|:------:|\n| `installer_patch.rb`               | 强制增量模式 + 跳过无变更生成 + 并行 integrate + 并行 configure_schemes | 3/4 | v0.1.1 |\n| `project_patch.rb`                 | pod_group O(n) → O(1) 哈希缓存                             | 3   | v0.1.1 |\n| `project_writer_patch.rb`          | SHA256 摘要比对 + 并行 cleanup/schemes/save                  | 3   | v0.1.1 |\n| `analyzer_patch.rb`                | 依赖解析结果缓存                                               | 1   | v0.1.1 |\n| `user_integrator_patch.rb`         | 多 target 并行集成 + 并行保存 + 并行 xcconfig 警告                  | 4   | v0.1.1 |\n| `multi_project_generator_patch.rb` | 并行化 PodTargetInstaller（150 pod 同时安装）                  | 3   | v0.1.2 |\n| `cache_analyzer_patch.rb`          | 并行 cache key MD5 计算                                     | 3   | v0.1.2 |\n| `profiler.rb`                      | 子步骤计时分析（调试）                                          | 调试  | v0.1.2 |\n\n### 版本历史\n\n| 版本 | 变更 |\n|:---:|:----|\n| v0.1.0 | 初始版本 |\n| v0.1.1 | 增量安装从 4.22s → 1.52s（+64%）；跳过无变更项目生成；并行集成 |\n| v0.1.2 | 并行化 PodTargetInstaller + cache key + schemes；子步骤计时分析 |\n| v0.1.3 | Bug fixes from audit |\n| v0.1.4 | Comprehensive bug fix（包含 CocoaPods 1.16.2 `ResolverSpecification` 兼容修复） |\n| v0.1.5 | （内部版本） |\n| v0.1.6 | 正式发布 CocoaPods 1.16.2 兼容修复；增加 A/B/C 三方对比测试框架 |\n| **v0.1.7** | **修复 3 个并发 bug：`pool.post` rescue 绑定错误 + 线程异常裸传播 + `analyzer_patch` 缩进** |\n| **v0.1.8** | **Flutter 兼容性：`resolve_cross_project_dependencies` + 跳过路径 `@pods_project=nil` 修复** |\n| **v0.1.9** | **Flutter 兼容性加强：跨项目依赖解析扩展到全部 `generated_projects`** |\n| **v0.1.10** | **代码审查改进：调试日志 + 统一 Flutter 测试脚本** |\n| **v0.1.11** | **nil 保护：`@pods_project` 为 nil 时创建空项目降级，防止 post-install hook 崩溃** |\n| **v0.1.12** | **Xcode 动态刷新修复：touch pbxproj 更新时间戳，确保增量安装后 Xcode 项目树刷新** |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flengain%2Fcocoapods-podgenerate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flengain%2Fcocoapods-podgenerate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flengain%2Fcocoapods-podgenerate/lists"}