cocoapods-anker-ar 1.2.0 → 1.2.2
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 +4 -4
- data/lib/cocoapods_anker_ar.rb +1 -1
- data/lib/cocoapods_plugin.rb +143 -47
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f7f7de7a7a171b60747089ca8c51d423b9a26bd2d7d50b418683d9e5582928e
|
|
4
|
+
data.tar.gz: 561d0f5dd9099c3f254dace5c021ce0607ffdb056cff867d84a9f45124492509
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c04469d6b95601cf7122eda64453de636571cb12517559985eeecd4331573db13576359b29abddadf3fb9b2cc1cb4aaa3110d0f7791767af0106af2c46fb7e2
|
|
7
|
+
data.tar.gz: 7304d9ccd6684d48bc1fd38d44a10b6fe7c646573f63e9f217395fa0817f4f7e436fc5ea4601645954e92a8433a89b84042fc556401c0289d6a6bb733ea57879
|
data/lib/cocoapods_anker_ar.rb
CHANGED
data/lib/cocoapods_plugin.rb
CHANGED
|
@@ -5,75 +5,171 @@ require 'coding_ar_util'
|
|
|
5
5
|
module Pod
|
|
6
6
|
module Downloader
|
|
7
7
|
class Http
|
|
8
|
+
# The upstream implementation of `should_flatten?`, captured lazily.
|
|
9
|
+
#
|
|
10
|
+
# It is used as an escape hatch when another plugin (e.g. cocoapods-art)
|
|
11
|
+
# has captured our definition with `alias_method` and calls back into us:
|
|
12
|
+
# continuing down the `super` chain in that situation loops forever.
|
|
13
|
+
#
|
|
14
|
+
# @return [UnboundMethod, nil]
|
|
15
|
+
#
|
|
16
|
+
def self.base_should_flatten?
|
|
17
|
+
@base_should_flatten ||=
|
|
18
|
+
begin
|
|
19
|
+
require 'cocoapods-downloader/http'
|
|
20
|
+
Pod::Downloader::RemoteFile.instance_method(:should_flatten?)
|
|
21
|
+
rescue NameError, LoadError
|
|
22
|
+
nil
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Union with the upstream option list instead of replacing it.
|
|
27
|
+
#
|
|
28
|
+
# Other plugins (cocoapods-art adds `:headers`) and newer CocoaPods
|
|
29
|
+
# releases contribute options here. Replacing the list would make
|
|
30
|
+
# `Base#initialize` reject their options as unrecognized.
|
|
31
|
+
#
|
|
8
32
|
def self.options
|
|
9
|
-
|
|
33
|
+
upstream = defined?(super) ? (super || []) : []
|
|
34
|
+
(upstream | [:type, :flatten, :sha1, :sha256, :indexDownload]).freeze
|
|
10
35
|
end
|
|
11
36
|
|
|
12
|
-
alias_method
|
|
13
|
-
|
|
37
|
+
# Use prepend instead of alias_method to safely monkey-patch without
|
|
38
|
+
# infinite recursion when the plugin is loaded more than once.
|
|
39
|
+
module AnkerArExtensions
|
|
40
|
+
CODING_AR_HOST = 'codingcorp-cocoapods.pkg.coding.anker-in.com'.freeze
|
|
14
41
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
def download_file(full_filename)
|
|
43
|
+
if url.to_s.include?(CODING_AR_HOST)
|
|
44
|
+
CodingArUtil.download(url, full_filename)
|
|
45
|
+
else
|
|
46
|
+
super
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def should_flatten?
|
|
51
|
+
if options.key?(:indexDownload) && options[:indexDownload] == true
|
|
52
|
+
true
|
|
53
|
+
elsif url.to_s.include?(CODING_AR_HOST)
|
|
54
|
+
# For CODING-AR packages, preserve directory structure to maintain .xcframework layout
|
|
55
|
+
# Use indexDownload: true in podspec if flattening is needed
|
|
56
|
+
puts "🔧 [CocoaPods-Anker-AR] Preserving directory structure for CODING-AR package"
|
|
57
|
+
false
|
|
58
|
+
elsif @__anker_resolving_should_flatten
|
|
59
|
+
# Re-entered through a plugin that aliased this method
|
|
60
|
+
# (cocoapods-art does `alias_method :orig_should_flatten?, ...`).
|
|
61
|
+
# Delegating again would bounce between the two definitions
|
|
62
|
+
# forever, so fall back to the downloader's own implementation.
|
|
63
|
+
base = self.class.base_should_flatten?
|
|
64
|
+
return base ? base.bind(self).call : false
|
|
65
|
+
else
|
|
66
|
+
begin
|
|
67
|
+
@__anker_resolving_should_flatten = true
|
|
68
|
+
super
|
|
69
|
+
ensure
|
|
70
|
+
@__anker_resolving_should_flatten = false
|
|
71
|
+
end
|
|
72
|
+
end
|
|
21
73
|
end
|
|
22
74
|
end
|
|
23
75
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
76
|
+
prepend AnkerArExtensions
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# ---------------------------------------------------------------------------
|
|
82
|
+
# CDN 源传输层兼容开关
|
|
83
|
+
# ---------------------------------------------------------------------------
|
|
84
|
+
#
|
|
85
|
+
# cocoapods-core 的 `Pod::CDNSource` 在构造请求时硬编码了
|
|
86
|
+
# `:http_version => :httpv2_0`(见 cocoapods-core/lib/cocoapods-core/cdn_source.rb
|
|
87
|
+
# 的 `download_typhoeus_impl_async`)。当链路(VPN / MTU / 中间设备 / 服务端
|
|
88
|
+
# h2 实现)对 HTTP/2 支持不完整时,libcurl 会抛出
|
|
89
|
+
#
|
|
90
|
+
# CDN: <repo> URL couldn't be downloaded: <url> Response: Error in the HTTP2 framing layer
|
|
91
|
+
#
|
|
92
|
+
# 该异常在 CDN 源里是 `raise Informative`,属于致命错误,`pod install` 会中断,
|
|
93
|
+
# 且无法通过 Podfile 或 CocoaPods 配置项规避(上游没有暴露协议开关)。
|
|
94
|
+
#
|
|
95
|
+
# 这里提供两个环境变量作为逃生舱:
|
|
96
|
+
#
|
|
97
|
+
# COCOAPODS_CDN_HTTP_1_1=1 强制 CDN 请求走 HTTP/1.1(推荐用于排查上述报错)
|
|
98
|
+
# COCOAPODS_CDN_MAX_CONCURRENCY 交给上游 cocoapods-core 自己读取,无需在此处理
|
|
99
|
+
#
|
|
100
|
+
# 默认不改变任何行为:不设环境变量时协议仍是上游的 :httpv2_0,
|
|
101
|
+
# 避免给其它使用方带来性能回归。
|
|
102
|
+
#
|
|
103
|
+
module Pod
|
|
104
|
+
class CDNSource
|
|
105
|
+
module AnkerArHttpVersion
|
|
106
|
+
# @return [Symbol, nil] 需要强制使用的 libcurl 协议,nil 表示保持上游默认。
|
|
107
|
+
def self.forced_http_version
|
|
108
|
+
case ENV['COCOAPODS_CDN_HTTP_1_1'].to_s.strip.downcase
|
|
109
|
+
when '1', 'true', 'yes', 'on', '1.1', 'http1', 'http/1.1'
|
|
110
|
+
:httpv1_1
|
|
32
111
|
else
|
|
33
|
-
|
|
112
|
+
nil
|
|
34
113
|
end
|
|
35
114
|
end
|
|
115
|
+
|
|
116
|
+
def queue_request(request)
|
|
117
|
+
forced = AnkerArHttpVersion.forced_http_version
|
|
118
|
+
if forced
|
|
119
|
+
# 请求入队前覆写协议;Typhoeus 允许在 run 之前修改 options。
|
|
120
|
+
begin
|
|
121
|
+
request.options[:http_version] = forced
|
|
122
|
+
rescue StandardError
|
|
123
|
+
# options 结构在未来的 CocoaPods 里可能变化,失败时退回上游行为
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
super
|
|
127
|
+
end
|
|
36
128
|
end
|
|
129
|
+
|
|
130
|
+
prepend AnkerArHttpVersion unless ancestors.include?(AnkerArHttpVersion)
|
|
37
131
|
end
|
|
38
132
|
end
|
|
39
133
|
|
|
40
134
|
module Pod
|
|
41
135
|
class Source
|
|
42
136
|
class Manager
|
|
43
|
-
alias_method
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
137
|
+
# Use prepend instead of alias_method to safely monkey-patch without
|
|
138
|
+
# infinite recursion when the plugin is loaded more than once.
|
|
139
|
+
module AnkerArExtensions
|
|
140
|
+
def source_from_path(path)
|
|
141
|
+
# Only intercept repos that carry our marker file. Everything else
|
|
142
|
+
# is delegated to the rest of the chain so that other plugins
|
|
143
|
+
# patching `source_from_path` (e.g. cocoapods-art) keep working.
|
|
144
|
+
#
|
|
145
|
+
# Our own cache is deliberately kept in a dedicated ivar:
|
|
146
|
+
# cocoapods-art builds its own Hash under `@sources_by_path`, and
|
|
147
|
+
# sharing that one would make the two plugins recurse into each other.
|
|
148
|
+
if (path + '.coding_ar_url').exist?
|
|
149
|
+
@__anker_sources_by_path ||= {}
|
|
150
|
+
@__anker_sources_by_path[path] ||= CodingArSource.new(path)
|
|
151
|
+
else
|
|
152
|
+
super
|
|
153
|
+
end
|
|
58
154
|
end
|
|
59
155
|
|
|
60
|
-
|
|
61
|
-
|
|
156
|
+
def create_source_with_url(url)
|
|
157
|
+
require 'coding_ar_util'
|
|
62
158
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
orig_create_source_with_url(url)
|
|
71
|
-
end
|
|
159
|
+
name = name_for_url(url)
|
|
160
|
+
if CodingArUtil.coding_ar_service?(url)
|
|
161
|
+
Command::Repo::AddCodingAr.parse([name, url]).run
|
|
162
|
+
else
|
|
163
|
+
super
|
|
164
|
+
end
|
|
72
165
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
166
|
+
source = source_with_url(url)
|
|
167
|
+
raise "Unable to create a source with URL #{url}" unless source
|
|
168
|
+
source
|
|
169
|
+
end
|
|
76
170
|
end
|
|
171
|
+
|
|
172
|
+
prepend AnkerArExtensions
|
|
77
173
|
end
|
|
78
174
|
end
|
|
79
175
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-anker-ar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dark Liu
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -54,7 +54,7 @@ homepage: http://codingcorp.coding.anker-in.com/public/CODING_ANKER/cocoapods-an
|
|
|
54
54
|
licenses:
|
|
55
55
|
- MIT
|
|
56
56
|
metadata: {}
|
|
57
|
-
post_install_message:
|
|
57
|
+
post_install_message:
|
|
58
58
|
rdoc_options: []
|
|
59
59
|
require_paths:
|
|
60
60
|
- lib
|
|
@@ -69,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
71
|
requirements: []
|
|
72
|
-
rubygems_version: 3.
|
|
73
|
-
signing_key:
|
|
72
|
+
rubygems_version: 3.5.22
|
|
73
|
+
signing_key:
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: CODING-AR-backed repo support for Cocoapods
|
|
76
76
|
test_files: []
|