cocoapods-swordfish 0.1.6
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 +7 -0
- data/README.md +35 -0
- data/lib/cocoapods_plugin.rb +86 -0
- data/lib/gem_version.rb +11 -0
- data/lib/swordfish/command/archive.rb +187 -0
- data/lib/swordfish/command/auto.rb +192 -0
- data/lib/swordfish/command/config.rb +70 -0
- data/lib/swordfish/command/repo/update.rb +42 -0
- data/lib/swordfish/command/spec/create.rb +78 -0
- data/lib/swordfish/command/spec/push.rb +114 -0
- data/lib/swordfish/command/swordfish.rb +41 -0
- data/lib/swordfish/command.rb +2 -0
- data/lib/swordfish/config/config.rb +137 -0
- data/lib/swordfish/config/config_asker.rb +57 -0
- data/lib/swordfish/config/config_builder.rb +216 -0
- data/lib/swordfish/helpers/build_helper.rb +160 -0
- data/lib/swordfish/helpers/build_utils.rb +94 -0
- data/lib/swordfish/helpers/framework.rb +85 -0
- data/lib/swordfish/helpers/framework_builder.rb +451 -0
- data/lib/swordfish/helpers/library.rb +54 -0
- data/lib/swordfish/helpers/library_builder.rb +90 -0
- data/lib/swordfish/helpers/sources_helper.rb +38 -0
- data/lib/swordfish/helpers/spec_creator.rb +167 -0
- data/lib/swordfish/helpers/spec_files_helper.rb +76 -0
- data/lib/swordfish/helpers/spec_source_creator.rb +266 -0
- data/lib/swordfish/helpers/upload_helper.rb +94 -0
- data/lib/swordfish/hmap/hmap_generator.rb +59 -0
- data/lib/swordfish/hmap/pod_target.rb +92 -0
- data/lib/swordfish/hmap/podfile_dsl.rb +36 -0
- data/lib/swordfish/hmap/post_install_hook_context.rb +41 -0
- data/lib/swordfish/hmap/xcconfig.rb +99 -0
- data/lib/swordfish/hmap.rb +4 -0
- data/lib/swordfish/native/acknowledgements.rb +27 -0
- data/lib/swordfish/native/analyzer.rb +55 -0
- data/lib/swordfish/native/file_accessor.rb +28 -0
- data/lib/swordfish/native/installation_options.rb +25 -0
- data/lib/swordfish/native/installer.rb +135 -0
- data/lib/swordfish/native/linter.rb +25 -0
- data/lib/swordfish/native/path_source.rb +33 -0
- data/lib/swordfish/native/pod_source_installer.rb +19 -0
- data/lib/swordfish/native/pod_target_installer.rb +94 -0
- data/lib/swordfish/native/podfile.rb +105 -0
- data/lib/swordfish/native/podfile_env.rb +36 -0
- data/lib/swordfish/native/podfile_generator.rb +195 -0
- data/lib/swordfish/native/podspec_finder.rb +24 -0
- data/lib/swordfish/native/resolver.rb +223 -0
- data/lib/swordfish/native/source.rb +35 -0
- data/lib/swordfish/native/sources_manager.rb +19 -0
- data/lib/swordfish/native/specification.rb +31 -0
- data/lib/swordfish/native/target_architectures.rb +79 -0
- data/lib/swordfish/native/target_validator.rb +41 -0
- data/lib/swordfish/native/validator.rb +39 -0
- data/lib/swordfish/native.rb +16 -0
- data/lib/swordfish.rb +2 -0
- metadata +167 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Source
|
7
|
+
# Returns the path of the specification with the given name and version.
|
8
|
+
#
|
9
|
+
# @param [String] name
|
10
|
+
# the name of the Pod.
|
11
|
+
#
|
12
|
+
# @param [Version,String] version
|
13
|
+
# the version for the specification.
|
14
|
+
#
|
15
|
+
# @return [Pathname] The path of the specification.
|
16
|
+
#
|
17
|
+
def specification_path(name, version)
|
18
|
+
raise ArgumentError, 'No name' unless name
|
19
|
+
raise ArgumentError, 'No version' unless version
|
20
|
+
|
21
|
+
path = pod_path(name) + version.to_s
|
22
|
+
|
23
|
+
specification_path = Specification::VALID_EXTNAME
|
24
|
+
.map { |extname| "#{name}#{extname}" }
|
25
|
+
.map { |file| path + file }
|
26
|
+
.find(&:exist?)
|
27
|
+
|
28
|
+
unless specification_path
|
29
|
+
raise StandardError, "Unable to find the specification #{name} " \
|
30
|
+
"(#{version}) in the #{self.name} source."
|
31
|
+
end
|
32
|
+
specification_path
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods'
|
3
|
+
require 'swordfish/config/config'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Source
|
7
|
+
class Manager
|
8
|
+
# 源码 source
|
9
|
+
def code_source
|
10
|
+
source_with_name_or_url(Ocean.config.code_repo_url)
|
11
|
+
end
|
12
|
+
|
13
|
+
# 二进制 source
|
14
|
+
def binary_source
|
15
|
+
source_with_name_or_url(Ocean.config.binary_repo_url)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'swordfish/native/sources_manager'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Specification
|
7
|
+
VALID_EXTNAME = %w[.binary.podspec.json .binary.podspec .podspec.json .podspec].freeze
|
8
|
+
DEFAULT_TEMPLATE_EXTNAME = %w[.binary-template.podspec .binary-template.podspec.json].freeze
|
9
|
+
|
10
|
+
# TODO
|
11
|
+
# 可以在这里根据组件依赖二进制或源码调整 sources 的先后顺序
|
12
|
+
# 如果是源码,则调整 code_source 到最前面
|
13
|
+
# 如果是二进制,则调整 binary_source 到最前面
|
14
|
+
# 这样 CocoaPods 分析时,就会优先获取到对应源的 podspec
|
15
|
+
#
|
16
|
+
# 先要把 Podfile 里面的配置数据保存到单例中,再在这里判断,就不需要 resolver 了
|
17
|
+
# 但是现在这个插件依旧可用,重构需要时间 = = ,没什么动力去重构了呀。。。
|
18
|
+
#
|
19
|
+
# class Set
|
20
|
+
# old_initialize = instance_method(:initialize)
|
21
|
+
# define_method(:initialize) do |name, sources|
|
22
|
+
# if name == 'TDFAdaptationKit'
|
23
|
+
# sources_manager = Pod::Config.instance.sources_manager
|
24
|
+
# # sources = [sources_manager.binary_source, *sources].uniq
|
25
|
+
# sources = [sources_manager.code_source, *sources].uniq
|
26
|
+
# end
|
27
|
+
# old_initialize.bind(self).call(name, sources)
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class Target
|
4
|
+
def self.excluded_archs_simulator(post_context, is_arm64)
|
5
|
+
post_context.aggregate_targets.each do |one|
|
6
|
+
one.pod_targets.each { |target|
|
7
|
+
target.excluded_archs_simulator(is_arm64)
|
8
|
+
}
|
9
|
+
one.excluded_archs_simulator(is_arm64)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class PodTarget
|
15
|
+
def excluded_archs_simulator(is_arm64)
|
16
|
+
build_settings.each do |config_name, setting|
|
17
|
+
config_file = setting.xcconfig
|
18
|
+
if is_arm64
|
19
|
+
config_file.set_excluded_archs_simulator
|
20
|
+
else
|
21
|
+
config_file.set_excluded_archs_simulator_default
|
22
|
+
end
|
23
|
+
config_path = xcconfig_path(config_name)
|
24
|
+
config_file.save_as(config_path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class AggregateTarget
|
30
|
+
def excluded_archs_simulator(is_arm64)
|
31
|
+
xcconfigs.each do |config_name, config_file|
|
32
|
+
if is_arm64
|
33
|
+
config_file.set_excluded_archs_simulator
|
34
|
+
else
|
35
|
+
config_file.set_excluded_archs_simulator_default
|
36
|
+
end
|
37
|
+
config_path = xcconfig_path(config_name)
|
38
|
+
config_file.save_as(config_path)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Xcodeproj
|
45
|
+
class Config
|
46
|
+
def set_excluded_archs_simulator_default
|
47
|
+
remove_attr_with_key('EXCLUDED_ARCHS[sdk=iphonesimulator*]"')
|
48
|
+
end
|
49
|
+
|
50
|
+
def set_excluded_archs_simulator
|
51
|
+
@attributes["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = 'arm64'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Project
|
56
|
+
def self.set_archs_arm64(post_context, is_arm64)
|
57
|
+
temp_project = post_context.umbrella_targets.first.user_project
|
58
|
+
temp_project.targets.each do | target |
|
59
|
+
build_configurations = target.build_configurations
|
60
|
+
build_configurations.each do | config |
|
61
|
+
config.set_archs(is_arm64)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
temp_project.save
|
65
|
+
end
|
66
|
+
|
67
|
+
module Object
|
68
|
+
class XCBuildConfiguration
|
69
|
+
def set_archs(is_arm64)
|
70
|
+
if is_arm64
|
71
|
+
build_settings['ARCHS'] = "arm64"
|
72
|
+
else
|
73
|
+
build_settings['ARCHS'] = "$(ARCHS_STANDARD)"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
# The {Xcode::TargetValidator} ensures that the pod and aggregate target
|
5
|
+
# configuration is valid for installation.
|
6
|
+
#
|
7
|
+
class TargetValidator
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
def verify_swift_pods_have_module_dependencies
|
12
|
+
error_messages = []
|
13
|
+
pod_targets.each do |pod_target|
|
14
|
+
next unless pod_target.uses_swift?
|
15
|
+
|
16
|
+
non_module_dependencies = []
|
17
|
+
pod_target.dependent_targets.each do |dependent_target|
|
18
|
+
next if !dependent_target.should_build? || dependent_target.defines_module?
|
19
|
+
non_module_dependencies << dependent_target.name
|
20
|
+
end
|
21
|
+
|
22
|
+
next if non_module_dependencies.empty?
|
23
|
+
|
24
|
+
error_messages << "The Swift pod `#{pod_target.name}` depends upon #{non_module_dependencies.map { |d| "`#{d}`" }.to_sentence}, " \
|
25
|
+
"which #{non_module_dependencies.count == 1 ? 'does' : 'do'} not define modules. " \
|
26
|
+
'To opt into those targets generating module maps '\
|
27
|
+
'(which is necessary to import them from Swift when building as static libraries), ' \
|
28
|
+
'you may set `use_modular_headers!` globally in your Podfile, '\
|
29
|
+
'or specify `:modular_headers => true` for particular dependencies.'
|
30
|
+
end
|
31
|
+
return false
|
32
|
+
|
33
|
+
# raise Informative, 'The following Swift pods cannot yet be integrated '\
|
34
|
+
# "as static libraries:\n\n#{error_messages.join("\n\n")}"
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class Validator
|
4
|
+
# def validate_source_url(spec)
|
5
|
+
# return if spec.source.nil? || spec.source[:http].nil?
|
6
|
+
# url = URI(spec.source[:http])
|
7
|
+
# return if url.scheme == 'https' || url.scheme == 'file'
|
8
|
+
# warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPs protocol. " \
|
9
|
+
# 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
|
10
|
+
# 'This will be an error in future releases. Please update the URL to use https.')
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# Perform analysis for a given spec (or subspec)
|
14
|
+
#
|
15
|
+
def perform_extensive_analysis(spec)
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
#覆盖
|
20
|
+
def check_file_patterns
|
21
|
+
FILE_PATTERNS.each do |attr_name|
|
22
|
+
next if %i(source_files resources).include? attr_name
|
23
|
+
if respond_to?("_validate_#{attr_name}", true)
|
24
|
+
send("_validate_#{attr_name}")
|
25
|
+
else
|
26
|
+
validate_nonempty_patterns(attr_name, :error)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
_validate_header_mappings_dir
|
31
|
+
if consumer.spec.root?
|
32
|
+
_validate_license
|
33
|
+
_validate_module_map
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate_source_url(spec); end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'swordfish/native/acknowledgements'
|
2
|
+
require 'swordfish/native/analyzer'
|
3
|
+
require 'swordfish/native/file_accessor'
|
4
|
+
require 'swordfish/native/installation_options'
|
5
|
+
require 'swordfish/native/installer'
|
6
|
+
require 'swordfish/native/linter'
|
7
|
+
require 'swordfish/native/path_source'
|
8
|
+
require 'swordfish/native/pod_source_installer'
|
9
|
+
require 'swordfish/native/pod_target_installer'
|
10
|
+
require 'swordfish/native/podfile'
|
11
|
+
require 'swordfish/native/podfile_generator'
|
12
|
+
require 'swordfish/native/podspec_finder'
|
13
|
+
require 'swordfish/native/resolver'
|
14
|
+
require 'swordfish/native/source'
|
15
|
+
require 'swordfish/native/target_validator'
|
16
|
+
require 'swordfish/native/validator'
|
data/lib/swordfish.rb
ADDED
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-swordfish
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yuanli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-11-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parallel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cocoapods
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cocoapods-generate
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.2.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: swordfish是一款支持pod二进制化,hmap优化等特性的cocoapods插件.
|
84
|
+
email:
|
85
|
+
- yuanli_kk925@163.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- README.md
|
91
|
+
- lib/cocoapods_plugin.rb
|
92
|
+
- lib/gem_version.rb
|
93
|
+
- lib/swordfish.rb
|
94
|
+
- lib/swordfish/command.rb
|
95
|
+
- lib/swordfish/command/archive.rb
|
96
|
+
- lib/swordfish/command/auto.rb
|
97
|
+
- lib/swordfish/command/config.rb
|
98
|
+
- lib/swordfish/command/repo/update.rb
|
99
|
+
- lib/swordfish/command/spec/create.rb
|
100
|
+
- lib/swordfish/command/spec/push.rb
|
101
|
+
- lib/swordfish/command/swordfish.rb
|
102
|
+
- lib/swordfish/config/config.rb
|
103
|
+
- lib/swordfish/config/config_asker.rb
|
104
|
+
- lib/swordfish/config/config_builder.rb
|
105
|
+
- lib/swordfish/helpers/build_helper.rb
|
106
|
+
- lib/swordfish/helpers/build_utils.rb
|
107
|
+
- lib/swordfish/helpers/framework.rb
|
108
|
+
- lib/swordfish/helpers/framework_builder.rb
|
109
|
+
- lib/swordfish/helpers/library.rb
|
110
|
+
- lib/swordfish/helpers/library_builder.rb
|
111
|
+
- lib/swordfish/helpers/sources_helper.rb
|
112
|
+
- lib/swordfish/helpers/spec_creator.rb
|
113
|
+
- lib/swordfish/helpers/spec_files_helper.rb
|
114
|
+
- lib/swordfish/helpers/spec_source_creator.rb
|
115
|
+
- lib/swordfish/helpers/upload_helper.rb
|
116
|
+
- lib/swordfish/hmap.rb
|
117
|
+
- lib/swordfish/hmap/hmap_generator.rb
|
118
|
+
- lib/swordfish/hmap/pod_target.rb
|
119
|
+
- lib/swordfish/hmap/podfile_dsl.rb
|
120
|
+
- lib/swordfish/hmap/post_install_hook_context.rb
|
121
|
+
- lib/swordfish/hmap/xcconfig.rb
|
122
|
+
- lib/swordfish/native.rb
|
123
|
+
- lib/swordfish/native/acknowledgements.rb
|
124
|
+
- lib/swordfish/native/analyzer.rb
|
125
|
+
- lib/swordfish/native/file_accessor.rb
|
126
|
+
- lib/swordfish/native/installation_options.rb
|
127
|
+
- lib/swordfish/native/installer.rb
|
128
|
+
- lib/swordfish/native/linter.rb
|
129
|
+
- lib/swordfish/native/path_source.rb
|
130
|
+
- lib/swordfish/native/pod_source_installer.rb
|
131
|
+
- lib/swordfish/native/pod_target_installer.rb
|
132
|
+
- lib/swordfish/native/podfile.rb
|
133
|
+
- lib/swordfish/native/podfile_env.rb
|
134
|
+
- lib/swordfish/native/podfile_generator.rb
|
135
|
+
- lib/swordfish/native/podspec_finder.rb
|
136
|
+
- lib/swordfish/native/resolver.rb
|
137
|
+
- lib/swordfish/native/source.rb
|
138
|
+
- lib/swordfish/native/sources_manager.rb
|
139
|
+
- lib/swordfish/native/specification.rb
|
140
|
+
- lib/swordfish/native/target_architectures.rb
|
141
|
+
- lib/swordfish/native/target_validator.rb
|
142
|
+
- lib/swordfish/native/validator.rb
|
143
|
+
homepage: http://rubygems.org/gems/cocoapods-swordfish
|
144
|
+
licenses: []
|
145
|
+
metadata:
|
146
|
+
allowed_push_host: https://rubygems.org
|
147
|
+
homepage_uri: http://rubygems.org/gems/cocoapods-swordfish
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: 2.4.0
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubygems_version: 3.1.2
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: swordfish编译加速插件.
|
167
|
+
test_files: []
|