cocoapods-jxedt 0.0.13 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-jxedt/binary/config.rb +36 -22
- data/lib/cocoapods-jxedt/binary/helper/prebuild_installer.rb +11 -0
- data/lib/cocoapods-jxedt/binary/helper/prebuild_sandbox.rb +57 -67
- data/lib/cocoapods-jxedt/binary/hooks/post_install.rb +2 -2
- data/lib/cocoapods-jxedt/binary/hooks/pre_install.rb +7 -7
- data/lib/cocoapods-jxedt/binary/pod-room/xcodebuild_command.rb +9 -5
- data/lib/cocoapods-jxedt/binary/prebuild.rb +2 -2
- data/lib/cocoapods-jxedt/command/binary/binary.rb +4 -2
- data/lib/cocoapods-jxedt/command/binary/command/build.rb +7 -6
- data/lib/cocoapods-jxedt/command/binary/command/clean.rb +9 -9
- data/lib/cocoapods-jxedt/command/binary/command/code.rb +67 -0
- data/lib/cocoapods-jxedt/command/binary/command/fetch.rb +3 -2
- data/lib/cocoapods-jxedt/command/binary/command/push.rb +3 -3
- data/lib/cocoapods-jxedt/command/binary/command/source_project.rb +52 -0
- data/lib/cocoapods-jxedt/command/binary/command/statistics.rb +1 -1
- data/lib/cocoapods-jxedt/command/jxedt.rb +1 -0
- data/lib/cocoapods-jxedt/command/options/options.rb +4 -4
- data/lib/cocoapods-jxedt/command/user/user.rb +58 -0
- data/lib/cocoapods-jxedt/gem_version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87df49d02d7bd4e47d3a4279b4c075e9a55d260d25adc98223aced2c342bc804
|
4
|
+
data.tar.gz: 93fe5bda70d2c56b17b5c0e0b692bd96b6b5dc9aef8f7fc4ee014a860ea9f6d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09a2a403367a4d7b10b7d8b03741325faeb1a32b4d8af1dedce1712e62ad1f1e3b23b5aacc02a60b069f75c7c3ecca8140ea9962e111b2a89bcd394b5236ab74'
|
7
|
+
data.tar.gz: 7581173b0772a0a6abb08d71a76a9bf7b72faba95ca61aa7c4ebb09c03adf2af37f7db470f43d04bae33c635fc15430148867f3bafb30997cd8368611828acc3
|
@@ -7,34 +7,35 @@ module Jxedt
|
|
7
7
|
attr_accessor :dsl_config
|
8
8
|
|
9
9
|
APPLICABLE_DSL_CONFIG = {
|
10
|
-
:all_binary => '
|
11
|
-
:binary_dir => "
|
12
|
-
:binary_switch => "
|
13
|
-
:prebuild_job => "开启编译任务,设置为false
|
14
|
-
:keep_source_project => "保留源码的pods
|
15
|
-
:dev_pods_enabled => "Development Pods
|
16
|
-
:excluded_pods => "排除binary的pods",
|
17
|
-
:xcconfig_configuration_alias => "xcconfig
|
18
|
-
:framework_header_search_enabled => "
|
19
|
-
:silent_build => "
|
10
|
+
:all_binary => '全部组件使用二进制。默认为false',
|
11
|
+
:binary_dir => "二进制文件的保存路径,'Pods/Pods.xcodeproj'文件的相对路径。默认为'../_Prebuild'",
|
12
|
+
:binary_switch => "插件开关,设置为false则关闭插件二进制功能。默认为true",
|
13
|
+
:prebuild_job => "开启编译任务,设置为false则不触发编译功能。默认为true",
|
14
|
+
:keep_source_project => "保留源码的pods工程,方便查看源码,文件目录为Podfile文件同级目录下'Pods-Source'。默认为false",
|
15
|
+
:dev_pods_enabled => "Development Pods是否支持二进制。默认为false",
|
16
|
+
:excluded_pods => "排除binary的pods,是一个数组。默认是[]",
|
17
|
+
:xcconfig_configuration_alias => "xcconfig文件中配置多configuration的别名(一定要唯一),用于搜索替换,我们用来支持多configuration的二进制。一般不需要设置,默认值为'cocoapods-jxedt-binary'",
|
18
|
+
:framework_header_search_enabled => "开启binary的组件是否配置HEADER_SEARCH_PATH头文件搜索,兼容头文件引用的问题。默认为false",
|
19
|
+
:silent_build => "静默编译,即不输出编译命令。默认true",
|
20
20
|
:configurations => "支持的configuration配置,可以写字符串'Debug'或'Release',也可以写多个'['Debug', 'Release']'。默认为'Release'",
|
21
21
|
:xcframework => "编译结果是否为xcframework。默认false",
|
22
|
-
:clean_build => "编译的时候是否clean。默认true",
|
22
|
+
:clean_build => "编译的时候是否clean build。默认true",
|
23
23
|
:bitcode_enabled => "开启bitcode。默认false",
|
24
|
-
:device_build_enabled => "
|
25
|
-
:simulator_build_enabled => "
|
26
|
-
:disable_dsym => "
|
27
|
-
:disable_resource_compilable_pods => "
|
28
|
-
:build_log_path => "编译的log
|
24
|
+
:device_build_enabled => "编译真机架构。默认true",
|
25
|
+
:simulator_build_enabled => "编译模拟器架构。默认false",
|
26
|
+
:disable_dsym => "禁止DSYM产物。默认true",
|
27
|
+
:disable_resource_compilable_pods => "禁止编译有特殊resource文件(xib、xcdatamodeld等)的pod。默认为false",
|
28
|
+
:build_log_path => "编译的log输出路径。",
|
29
|
+
:prebuild_sandbox_path => '预编译的sandbox(源码)路径,可以配置一个多台电脑都可访问的路径,做源码和二进制的link。必须以`/Users/cocoapods-jxedt`开头,否则插件认为无效。',
|
29
30
|
:build_args => "编译的配置。了解xcodebuild命令的可以配置编译参数,例如配置 ARCHS='arm64 armv7'",
|
30
|
-
:git_cache => 'git
|
31
|
+
:git_cache => 'git缓存配置。A Hash. 详情查看 GIT_CACHE_CONFIG'
|
31
32
|
}.freeze
|
32
33
|
|
33
34
|
GIT_CACHE_CONFIG = {
|
34
35
|
:repo => '配置缓存仓库地址,如:{:remote => "https://github.com/user/cocoapods-cache.git", :local => "~/.cocoapods-jxedt/cocoapods-cache"},或者直接写远程仓库地址"https://github.com/user/cocoapods-cache.git"',
|
35
36
|
:branch => 'git cache的branch,默认是master分支',
|
36
|
-
:auto_fetch => '
|
37
|
-
:auto_push => '
|
37
|
+
:auto_fetch => '预编译过程是否自动拉取远程的二进制。默认true',
|
38
|
+
:auto_push => '预编译过程是否自动同步二进制结果到远程。默认false'
|
38
39
|
}.freeze
|
39
40
|
|
40
41
|
def initialize()
|
@@ -134,12 +135,25 @@ module Jxedt
|
|
134
135
|
@dsl_config[:build_log_path]
|
135
136
|
end
|
136
137
|
|
138
|
+
def prebuild_sandbox_path
|
139
|
+
@sandbox_path ||= begin
|
140
|
+
sandbox_path = @dsl_config[:prebuild_sandbox_path]
|
141
|
+
sandbox_path = nil unless sandbox_path =~ /^\/Users\/cocoapods-jxedt\/.{1,}$/
|
142
|
+
sandbox_path = nil unless File.exist?('/Users/cocoapods-jxedt')
|
143
|
+
sandbox_path
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
137
147
|
def build_args
|
138
148
|
@args ||= begin
|
139
149
|
args = @dsl_config[:build_args] || {}
|
140
|
-
|
141
|
-
|
142
|
-
|
150
|
+
# 可选的配置项
|
151
|
+
default_options = []
|
152
|
+
default_options << "ONLY_ACTIVE_ARCH=NO"
|
153
|
+
default_options << "BUILD_LIBRARY_FOR_DISTRIBUTION=YES"
|
154
|
+
args[:default] ||= default_options
|
155
|
+
args[:device] ||= ["ARCHS='arm64'"] # ["ARCHS='arm64 armv7 armv7s'"]
|
156
|
+
args[:simulator] ||= ["ARCHS='x86_64'"] # ["ARCHS='arm64 x86_64 i386'"]
|
143
157
|
args
|
144
158
|
end
|
145
159
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class JxedtPrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength
|
4
|
+
def installation_options
|
5
|
+
# Skip integrating user targets for prebuild Pods project.
|
6
|
+
@installation_options ||= Pod::Installer::InstallationOptions.new(
|
7
|
+
super.to_h.merge(:integrate_targets => false)
|
8
|
+
)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,4 +1,13 @@
|
|
1
1
|
module Pod
|
2
|
+
class Sandbox
|
3
|
+
attr_accessor :standard_sandbox
|
4
|
+
|
5
|
+
def standard_sandbox_root
|
6
|
+
return root if standard_sandbox.nil?
|
7
|
+
standard_sandbox.root
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
2
11
|
# The sandbox provides support for the directory that CocoaPods uses for an
|
3
12
|
# installation. In this directory the Pods projects, the support files and
|
4
13
|
# the sources of the Pods are stored.
|
@@ -41,88 +50,69 @@ module Pod
|
|
41
50
|
# +-- PodTargetN.xcodeproj
|
42
51
|
#
|
43
52
|
#
|
44
|
-
class
|
45
|
-
# [
|
46
|
-
def self.
|
47
|
-
prebuild_sandbox_path = Pathname.new(
|
48
|
-
new(prebuild_sandbox_path)
|
53
|
+
class JxedtPrebuildSandbox < Sandbox
|
54
|
+
# [Pod::Sandbox] standard_sandbox
|
55
|
+
def self.from_standard_sandbox(sandbox, sandbox_path: nil, real_path_compiler: false)
|
56
|
+
prebuild_sandbox_path = Pathname.new(sandbox.root).realpath + '../Pods-Source'
|
57
|
+
prebuild_sandbox = new(prebuild_sandbox_path)
|
58
|
+
# initialize
|
59
|
+
prebuild_sandbox.standard_sandbox = sandbox
|
60
|
+
# prepare
|
61
|
+
prebuild_sandbox.prepare_dir
|
62
|
+
prebuild_sandbox
|
49
63
|
end
|
50
64
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
def source_path
|
65
|
-
'../Pods-Source'
|
65
|
+
def real_path_compiler?
|
66
|
+
@real_path_compiler ||= begin
|
67
|
+
prebuild_sandbox_path = Jxedt.config.prebuild_sandbox_path
|
68
|
+
real_path_compiler = prebuild_sandbox_path && prebuild_sandbox_path.length > 0
|
69
|
+
if real_path_compiler
|
70
|
+
prebuild_sources_root = Pathname.new(prebuild_sandbox_path)
|
71
|
+
prebuild_sources_root.rmtree if prebuild_sources_root.exist?
|
72
|
+
prebuild_sources_root.mkpath
|
73
|
+
end
|
74
|
+
real_path_compiler
|
75
|
+
end
|
66
76
|
end
|
67
77
|
|
68
|
-
def
|
69
|
-
|
70
|
-
|
78
|
+
def prepare_dir
|
79
|
+
# clear
|
80
|
+
root.children.each { |child| child.rmtree if '.xcodeproj' != child.extname }
|
71
81
|
|
72
|
-
|
73
|
-
root
|
74
|
-
|
82
|
+
# copy
|
83
|
+
standard_sandbox.root.children.each do |child|
|
84
|
+
# skip headers_root & target_support_files_root & project_path
|
85
|
+
should_skip_paths = [standard_sandbox.headers_root, standard_sandbox.target_support_files_root, standard_sandbox.project_path]
|
86
|
+
next if should_skip_paths.include?(child)
|
75
87
|
|
76
|
-
|
77
|
-
|
78
|
-
|
88
|
+
should_copy_paths = [standard_sandbox.specifications_root, standard_sandbox.manifest_path]
|
89
|
+
if should_copy_paths.include?(child)
|
90
|
+
# copy Local Podspecs & manifest path
|
91
|
+
FileUtils.cp_r(child, root + child.basename)
|
92
|
+
else
|
93
|
+
# 真实的路径去编译,则拷贝文件到prebuild_sandbox
|
94
|
+
FileUtils.cp_r(child, sources_root) if real_path_compiler?
|
95
|
+
end
|
96
|
+
end
|
79
97
|
end
|
80
98
|
|
81
|
-
def
|
82
|
-
|
99
|
+
def sources_root
|
100
|
+
if real_path_compiler?
|
101
|
+
# 真实的路径去编译,则返回prebuild sources root
|
102
|
+
return @prebuild_sources_root ||= Pathname.new(Jxedt.config.prebuild_sandbox_path)
|
103
|
+
end
|
104
|
+
standard_sandbox.root
|
83
105
|
end
|
84
106
|
|
85
|
-
def
|
86
|
-
root
|
87
|
-
next if ['Headers', 'Local Podspecs', 'Target Support Files'].include? child.basename.to_s
|
88
|
-
next if ['.lock', '.xcodeproj'].include? child.extname.to_s
|
89
|
-
make_source_link(child, root + source_path + child.basename)
|
90
|
-
end
|
107
|
+
def project_path
|
108
|
+
root + 'Pods-Source.xcodeproj'
|
91
109
|
end
|
92
110
|
|
93
111
|
def clean_source_project!
|
94
112
|
return if Jxedt.config.keep_source_project?
|
95
113
|
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
module Pod
|
103
|
-
class Installer
|
104
|
-
# The {UserProjectIntegrator} integrates the libraries generated by
|
105
|
-
# TargetDefinitions of the {Podfile} with their correspondent user
|
106
|
-
# projects.
|
107
|
-
#
|
108
|
-
class UserProjectIntegrator
|
109
|
-
alias_method :old_create_workspace, :create_workspace
|
110
|
-
def create_workspace
|
111
|
-
old_create_workspace unless sandbox.is_a?(Pod::PrebuildSandbox)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
module Pod
|
118
|
-
class Installer
|
119
|
-
# Cleans up the sandbox directory by removing stale target support files and headers.
|
120
|
-
#
|
121
|
-
class SandboxDirCleaner
|
122
|
-
alias_method :old_clean!, :clean!
|
123
|
-
def clean!
|
124
|
-
old_clean! unless @sandbox.is_a?(Pod::PrebuildSandbox)
|
125
|
-
end
|
114
|
+
sources_root.rmtree if real_path_compiler? && sources_root.exist?
|
115
|
+
root.rmtree if root.exist?
|
126
116
|
end
|
127
117
|
end
|
128
118
|
end
|
@@ -11,11 +11,11 @@ module Jxedt
|
|
11
11
|
require_relative '../helper/prebuild_sandbox'
|
12
12
|
|
13
13
|
# :post_install过程校验两次`pod install`的值
|
14
|
-
validate_pod_checksum unless @installer_context.sandbox.is_a?(Pod::
|
14
|
+
validate_pod_checksum unless @installer_context.sandbox.is_a?(Pod::JxedtPrebuildSandbox)
|
15
15
|
end
|
16
16
|
|
17
17
|
def validate_pod_checksum
|
18
|
-
original_installer = ObjectSpace.each_object(Pod::Installer).reject {|installer| installer.sandbox.is_a?(Pod::
|
18
|
+
original_installer = ObjectSpace.each_object(Pod::Installer).reject {|installer| installer.sandbox.is_a?(Pod::JxedtPrebuildSandbox) }.first
|
19
19
|
return if original_installer.nil?
|
20
20
|
|
21
21
|
check_result = original_installer.lockfile == @installer_context.sandbox.source_lockfile
|
@@ -21,14 +21,15 @@ module Jxedt
|
|
21
21
|
end
|
22
22
|
|
23
23
|
require_relative '../helper/prebuild_sandbox'
|
24
|
+
require_relative '../helper/prebuild_installer'
|
24
25
|
|
25
|
-
# 如果是Pod::
|
26
|
-
return if @installer_context.sandbox.is_a?(Pod::
|
26
|
+
# 如果是Pod::JxedtPrebuildSandbox类则直接返回
|
27
|
+
return if @installer_context.sandbox.is_a?(Pod::JxedtPrebuildSandbox)
|
27
28
|
|
28
29
|
# 获取原始的installer对象,必须先获取对象
|
29
30
|
original_installer = ObjectSpace.each_object(Pod::Installer).first
|
30
|
-
prebuild_sandbox = Pod::
|
31
|
-
source_installer = Pod::
|
31
|
+
prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(@installer_context.sandbox)
|
32
|
+
source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, @installer_context.podfile, @installer_context.lockfile)
|
32
33
|
# 设置原始的installer携带的参数
|
33
34
|
source_installer.update = original_installer.update
|
34
35
|
source_installer.repo_update = original_installer.repo_update
|
@@ -51,12 +52,11 @@ module Jxedt
|
|
51
52
|
end
|
52
53
|
|
53
54
|
require 'cocoapods-jxedt/git_helper/cache_fetcher'
|
54
|
-
binary_dir = @installer_context.sandbox.
|
55
|
+
binary_dir = @installer_context.sandbox.standard_sandbox_root + Jxedt.config.binary_dir
|
55
56
|
Jxedt::CacheFetcher.sync(binary_hash, binary_dir)
|
56
57
|
end
|
57
58
|
|
58
59
|
# prebuild_job
|
59
|
-
prebuild_sandbox.link_source_project!
|
60
60
|
if Jxedt.config.prebuild_job?
|
61
61
|
log_section "🚀 Prebuild frameworks"
|
62
62
|
build_targets = Jxedt::Prebuild.new(source_installer).build
|
@@ -65,7 +65,7 @@ module Jxedt
|
|
65
65
|
if Jxedt.config.cache_repo_enabled? && Jxedt.config.auto_push? && build_targets && build_targets.size > 0
|
66
66
|
log_section "🚄 Push git cache"
|
67
67
|
require 'cocoapods-jxedt/git_helper/cache_pucher'
|
68
|
-
output_dir = prebuild_sandbox.
|
68
|
+
output_dir = prebuild_sandbox.standard_sandbox_root + Jxedt.config.binary_dir
|
69
69
|
Jxedt::CachePucher.push(output_dir, build_targets, false)
|
70
70
|
end
|
71
71
|
end
|
@@ -108,7 +108,7 @@ module Jxedt
|
|
108
108
|
`lipo -create -output #{lib_output} #{lib_file}` if lib_file.exist?
|
109
109
|
|
110
110
|
# copy public headers
|
111
|
-
headers_source = target.sandbox.headers_root + 'Public' + target.
|
111
|
+
headers_source = target.sandbox.headers_root + 'Public' + target.pod_name
|
112
112
|
Dir.glob("#{headers_source}/**/*.h").each { |h| `ditto #{h} #{fwk.headers_path}/#{File.basename(h)}` }
|
113
113
|
|
114
114
|
# target support module
|
@@ -129,14 +129,18 @@ module Jxedt
|
|
129
129
|
FileUtils.cp_r(swiftmodule_path, fwk.module_map_path) if swiftmodule_path.exist?
|
130
130
|
|
131
131
|
# umbrella header name
|
132
|
-
|
133
|
-
|
132
|
+
umbrella_header_name = "#{target.pod_name}-umbrella.h"
|
133
|
+
unless File.exist?("#{fwk.headers_path}/#{umbrella_header_name}")
|
134
|
+
# 从Target Support Files文件夹中获取unbrella header
|
135
|
+
target_support_files_root = target.sandbox.target_support_files_root + target.name
|
136
|
+
Dir.glob("#{target_support_files_root}/*-umbrella.h").each { |h| FileUtils.cp_r(h.to_s, fwk.headers_path + umbrella_header_name) }
|
137
|
+
end
|
134
138
|
|
135
139
|
# make modulemap
|
136
|
-
if File.exist?("#{fwk.headers_path}/#{
|
140
|
+
if File.exist?("#{fwk.headers_path}/#{umbrella_header_name}")
|
137
141
|
module_map = <<MODULE_MAP
|
138
142
|
framework module #{target.product_module_name} {
|
139
|
-
umbrella header "#{
|
143
|
+
umbrella header "#{umbrella_header_name}"
|
140
144
|
|
141
145
|
export *
|
142
146
|
module * { export * }
|
@@ -8,7 +8,7 @@ module Jxedt
|
|
8
8
|
|
9
9
|
def self.from_sandbox(sandbox)
|
10
10
|
search_path = Jxedt.config.binary_dir
|
11
|
-
binary_dir = search_path.empty? ? nil : sandbox.
|
11
|
+
binary_dir = search_path.empty? ? nil : sandbox.standard_sandbox_root + search_path
|
12
12
|
check_sandbox = Sandbox.new(binary_dir)
|
13
13
|
check_sandbox.sandbox = sandbox
|
14
14
|
check_sandbox
|
@@ -277,7 +277,7 @@ module Jxedt
|
|
277
277
|
|
278
278
|
def output_path
|
279
279
|
sandbox = @source_installer.sandbox
|
280
|
-
sandbox.
|
280
|
+
sandbox.standard_sandbox_root + Jxedt.config.binary_dir + "GeneratedFrameworks"
|
281
281
|
end
|
282
282
|
|
283
283
|
def clear_output_path
|
@@ -3,14 +3,16 @@ require_relative 'command/build'
|
|
3
3
|
require_relative 'command/fetch'
|
4
4
|
require_relative 'command/push'
|
5
5
|
require_relative 'command/clean'
|
6
|
+
require_relative 'command/code'
|
7
|
+
require_relative 'command/source_project'
|
6
8
|
|
7
9
|
module Pod
|
8
10
|
class Command
|
9
11
|
class JxedtCommand < Command
|
10
12
|
class Binary < JxedtCommand
|
11
|
-
self.summary = '
|
13
|
+
self.summary = '二进制相关操作'
|
12
14
|
self.description = <<-DESC
|
13
|
-
二进制相关操作,二进制build、fetch、push、statistics
|
15
|
+
二进制相关操作,二进制build、clean、fetch、push、statistics等
|
14
16
|
DESC
|
15
17
|
self.command = 'binary'
|
16
18
|
self.abstract_command = true
|
@@ -5,7 +5,8 @@ module Pod
|
|
5
5
|
class Build < Binary
|
6
6
|
self.summary = '组件编译成二进制'
|
7
7
|
self.description = <<-DESC
|
8
|
-
|
8
|
+
编译组件为二进制\n
|
9
|
+
编译结果目录默认在Podfile文件同级目录'Pods-Source/.command_build'
|
9
10
|
DESC
|
10
11
|
self.command = 'build'
|
11
12
|
self.arguments = [
|
@@ -14,8 +15,8 @@ module Pod
|
|
14
15
|
[
|
15
16
|
['--name', '编译的组件name,多个以,分隔'],
|
16
17
|
['--output-path', '编译的二进制文件输出路径'],
|
17
|
-
['--push', '
|
18
|
-
['--force-push', '
|
18
|
+
['--push', '编译的组件二进制推送到远程'],
|
19
|
+
['--force-push', '强制推送编译的组件二进制到远程']
|
19
20
|
]
|
20
21
|
end
|
21
22
|
def initialize(argv)
|
@@ -45,10 +46,11 @@ module Pod
|
|
45
46
|
require 'cocoapods-jxedt/binary/helper/target_definition'
|
46
47
|
require 'cocoapods-jxedt/binary/helper/prebuild_sandbox'
|
47
48
|
require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook'
|
49
|
+
require 'cocoapods-jxedt/binary/helper/prebuild_installer'
|
48
50
|
|
49
51
|
# 获取原始的installer对象,必须先获取对象
|
50
|
-
prebuild_sandbox = Pod::
|
51
|
-
source_installer = Pod::
|
52
|
+
prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox)
|
53
|
+
source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile)
|
52
54
|
# 执行install
|
53
55
|
source_installer.install!
|
54
56
|
|
@@ -59,7 +61,6 @@ module Pod
|
|
59
61
|
require 'cocoapods-jxedt/binary/prebuild'
|
60
62
|
|
61
63
|
# prebuild_job
|
62
|
-
prebuild_sandbox.link_source_project!
|
63
64
|
log_section "🚀 Prebuild frameworks"
|
64
65
|
# 默认放在Pods源码工程同级目录下
|
65
66
|
@output_path = prebuild_sandbox.project_path.parent + '.command_build' if @output_path.nil?
|
@@ -1,20 +1,20 @@
|
|
1
1
|
module Pod
|
2
2
|
class Command
|
3
3
|
class JxedtCommand < Command
|
4
|
-
class
|
5
|
-
class
|
6
|
-
self.summary = '
|
4
|
+
class Binary < JxedtCommand
|
5
|
+
class Clean < Binary
|
6
|
+
self.summary = '清除编译的组件二进制'
|
7
7
|
self.description = <<-DESC
|
8
|
-
|
8
|
+
清除编译的组件二进制\n
|
9
9
|
DESC
|
10
10
|
self.command = 'clean'
|
11
11
|
self.arguments = [
|
12
12
|
]
|
13
13
|
def self.options
|
14
14
|
[
|
15
|
-
['--name', '
|
16
|
-
['--local', '
|
17
|
-
['--all', '
|
15
|
+
['--name', '删除一个或多个二进制产物,多个以,分隔'],
|
16
|
+
['--local', '只删除本地的二进制产物'],
|
17
|
+
['--all', '删除所有的二进制产物,执行过程需要再次确认'],
|
18
18
|
]
|
19
19
|
end
|
20
20
|
def initialize(argv)
|
@@ -25,7 +25,7 @@ module Pod
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def validate!
|
28
|
-
help! "
|
28
|
+
help! "至少要添加一个选项,'--name'或'--all'" if @names.empty? && !@all
|
29
29
|
super
|
30
30
|
end
|
31
31
|
|
@@ -71,7 +71,7 @@ module Pod
|
|
71
71
|
else
|
72
72
|
random = (0...10).map { (97 + rand(26)).chr }.join
|
73
73
|
input = get_stdin("你确认要清除所有缓存吗?包括远程仓库的缓存。确认请输入: #{random}")
|
74
|
-
help! "
|
74
|
+
help! "输入错误,自动退出" if random != input
|
75
75
|
|
76
76
|
local_cache_dir.rmtree if local_cache_dir.exist?
|
77
77
|
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class JxedtCommand < Command
|
4
|
+
class Binary < JxedtCommand
|
5
|
+
class Code < Binary
|
6
|
+
self.summary = '创建源码链接'
|
7
|
+
self.description = <<-DESC
|
8
|
+
创建源码链接\n
|
9
|
+
在'/Users/cocoapods-jxedt'目录下创建源码的链接,用于二进制调试
|
10
|
+
DESC
|
11
|
+
self.command = 'code'
|
12
|
+
self.arguments = [
|
13
|
+
]
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--link', '创建源码软链接'],
|
17
|
+
['--unlink', '删除软链接'],
|
18
|
+
]
|
19
|
+
end
|
20
|
+
def initialize(argv)
|
21
|
+
@link = argv.flag?('link', false)
|
22
|
+
@unlink = argv.flag?('unlink', false)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
help! "至少要添加一个选项,'--link'或'--unlink'" unless @link || @unlink
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
podfile = Pod::Config.instance.podfile
|
33
|
+
help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
|
34
|
+
|
35
|
+
user_path = Pathname.new('/Users/cocoapods-jxedt')
|
36
|
+
help! "#{user_path} 路径不存在,源码和二进制链接只支持此路径下的文件。你可以执行`pod jxedt user --add`来添加目录" unless user_path.exist?
|
37
|
+
|
38
|
+
prebuild_sandbox_path = Jxedt.config.prebuild_sandbox_path
|
39
|
+
help! '请配置正确的prebuild sandbox路径' if prebuild_sandbox_path.nil?
|
40
|
+
|
41
|
+
sandbox_path = Pod::Config.instance.sandbox.root
|
42
|
+
prebuild_sandbox_path = Pathname.new(prebuild_sandbox_path)
|
43
|
+
if @link
|
44
|
+
prebuild_sandbox_path.rmtree if prebuild_sandbox_path.exist?
|
45
|
+
help! '不存在Pods文件夹,请检查你的目录' unless sandbox_path.exist?
|
46
|
+
|
47
|
+
make_source_link(sandbox_path, prebuild_sandbox_path)
|
48
|
+
Pod::UI.puts "🎉 源码二进制软链接已添加"
|
49
|
+
else
|
50
|
+
prebuild_sandbox_path.rmtree if prebuild_sandbox_path.exist?
|
51
|
+
Pod::UI.puts "🎉 源码二进制软链接已删除"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def make_source_link(source, target)
|
56
|
+
source = Pathname.new(source)
|
57
|
+
target = Pathname.new(target)
|
58
|
+
target.parent.mkpath unless target.parent.exist?
|
59
|
+
target.rmtree if target.exist?
|
60
|
+
relative_source = source.relative_path_from(target.parent)
|
61
|
+
FileUtils.ln_sf(relative_source, target)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -3,9 +3,10 @@ module Pod
|
|
3
3
|
class JxedtCommand < Command
|
4
4
|
class Binary < JxedtCommand
|
5
5
|
class Fecth < Binary
|
6
|
-
self.summary = '
|
6
|
+
self.summary = '获取远程更新'
|
7
7
|
self.description = <<-DESC
|
8
|
-
|
8
|
+
获取远程更新\n
|
9
|
+
更新远程仓库到本地,本地目录会放在'~/.cocoapods-jxedt/'
|
9
10
|
DESC
|
10
11
|
self.command = 'fetch'
|
11
12
|
self.arguments = [
|
@@ -3,16 +3,16 @@ module Pod
|
|
3
3
|
class JxedtCommand < Command
|
4
4
|
class Binary < JxedtCommand
|
5
5
|
class Push < Binary
|
6
|
-
self.summary = '
|
6
|
+
self.summary = '同步组件二进制产物到远程'
|
7
7
|
self.description = <<-DESC
|
8
|
-
|
8
|
+
同步组件二进制产物到远程
|
9
9
|
DESC
|
10
10
|
self.command = 'push'
|
11
11
|
self.arguments = [
|
12
12
|
]
|
13
13
|
def self.options
|
14
14
|
[
|
15
|
-
['--force-push', '
|
15
|
+
['--force-push', '强制推送组件二进制到远程,远程有相同的校验和会被本地覆盖']
|
16
16
|
]
|
17
17
|
end
|
18
18
|
def initialize(argv)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class JxedtCommand < Command
|
4
|
+
class Binary < JxedtCommand
|
5
|
+
class SourceProject < Binary
|
6
|
+
self.summary = '生成源码Pods工程'
|
7
|
+
self.description = <<-DESC
|
8
|
+
生成源码Pods工程\n
|
9
|
+
默认我们是不保留源码工程,如果需要查看组件源码时,可重新生成对应的源码工程,打开查看
|
10
|
+
DESC
|
11
|
+
self.command = 'sourceProject'
|
12
|
+
self.arguments = [
|
13
|
+
]
|
14
|
+
def self.options
|
15
|
+
[]
|
16
|
+
end
|
17
|
+
def initialize(argv)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def validate!
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
podfile = Pod::Config.instance.podfile
|
27
|
+
lockfile = Pod::Config.instance.lockfile
|
28
|
+
sandbox = Pod::Config.instance.sandbox
|
29
|
+
help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
|
30
|
+
|
31
|
+
# 修改config配置
|
32
|
+
options = {
|
33
|
+
:keep_source_project => true, # 保留源码工程
|
34
|
+
}
|
35
|
+
Jxedt.config.dsl_config.merge!(options)
|
36
|
+
|
37
|
+
require 'cocoapods-jxedt/binary/helper/target_definition'
|
38
|
+
require 'cocoapods-jxedt/binary/helper/prebuild_sandbox'
|
39
|
+
require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook'
|
40
|
+
require 'cocoapods-jxedt/binary/helper/prebuild_installer'
|
41
|
+
|
42
|
+
# 获取原始的installer对象,必须先获取对象
|
43
|
+
prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox)
|
44
|
+
source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile)
|
45
|
+
# 执行install
|
46
|
+
source_installer.install!
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -2,17 +2,17 @@ module Pod
|
|
2
2
|
class Command
|
3
3
|
class JxedtCommand < Command
|
4
4
|
class Options < JxedtCommand
|
5
|
-
self.summary = '
|
5
|
+
self.summary = 'cocoapods-jxedt插件配置参数介绍。'
|
6
6
|
self.description = <<-DESC
|
7
|
-
|
7
|
+
cocoapods-jxedt插件配置参数介绍
|
8
8
|
DESC
|
9
9
|
self.command = 'options'
|
10
10
|
self.arguments = [
|
11
11
|
]
|
12
12
|
def self.options
|
13
13
|
[
|
14
|
-
['--
|
15
|
-
['--config', '获取cocoapods-jxedt
|
14
|
+
['--config', '获取cocoapods-jxedt插件的基础配置'],
|
15
|
+
['--more-config', '获取cocoapods-jxedt插件的完整配置']
|
16
16
|
]
|
17
17
|
end
|
18
18
|
def initialize(argv)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class JxedtCommand < Command
|
4
|
+
class User < JxedtCommand
|
5
|
+
self.summary = '用户操作,添加和删除用户目录,用来统一路径,方便做源码和二进制的link'
|
6
|
+
self.description = <<-DESC
|
7
|
+
用户操作,添加和删除用户目录\n
|
8
|
+
用来统一路径,方便做源码和二进制的链接
|
9
|
+
DESC
|
10
|
+
self.command = 'user'
|
11
|
+
self.arguments = [
|
12
|
+
]
|
13
|
+
def self.options
|
14
|
+
[
|
15
|
+
['--add', '添加用户目录,/Users/cocoapods-jxedt'],
|
16
|
+
['--delete', '删除用户目录,/Users/cocoapods-jxedt']
|
17
|
+
]
|
18
|
+
end
|
19
|
+
def initialize(argv)
|
20
|
+
@add = argv.flag?('add', false)
|
21
|
+
@delete = argv.flag?('delete', false)
|
22
|
+
@name = 'cocoapods-jxedt'
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
help! "请指定要操作的命令, '--add' 或 '--delete'" unless @add || @delete
|
28
|
+
help! '输入的目录不正确!' if @name.length == 0
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
if @add
|
34
|
+
make_dir
|
35
|
+
else
|
36
|
+
delete_dir
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def make_dir
|
41
|
+
dirname = "/Users/#{@name}"
|
42
|
+
help! "目录已存在!" if File.exist?(dirname)
|
43
|
+
|
44
|
+
`sudo mkdir #{dirname} && sudo chmod -R 777 #{dirname}`
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete_dir
|
48
|
+
help! '因删除操作存在风险,暂不支持删除,请自行删除!' if @name != 'cocoapods-jxedt'
|
49
|
+
|
50
|
+
dirname = "/Users/#{@name}"
|
51
|
+
help! "目录不存在!" unless File.exist?(dirname)
|
52
|
+
|
53
|
+
`sudo rm -rf #{dirname}`
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-jxedt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- guojiashuang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/cocoapods-jxedt/binary/helper/names.rb
|
77
77
|
- lib/cocoapods-jxedt/binary/helper/podfile_options.rb
|
78
78
|
- lib/cocoapods-jxedt/binary/helper/podfile_post_install_hook.rb
|
79
|
+
- lib/cocoapods-jxedt/binary/helper/prebuild_installer.rb
|
79
80
|
- lib/cocoapods-jxedt/binary/helper/prebuild_sandbox.rb
|
80
81
|
- lib/cocoapods-jxedt/binary/helper/target_definition.rb
|
81
82
|
- lib/cocoapods-jxedt/binary/hooks/CocoapodsJxedtHook.rb
|
@@ -92,12 +93,15 @@ files:
|
|
92
93
|
- lib/cocoapods-jxedt/command/binary/binary.rb
|
93
94
|
- lib/cocoapods-jxedt/command/binary/command/build.rb
|
94
95
|
- lib/cocoapods-jxedt/command/binary/command/clean.rb
|
96
|
+
- lib/cocoapods-jxedt/command/binary/command/code.rb
|
95
97
|
- lib/cocoapods-jxedt/command/binary/command/fetch.rb
|
96
98
|
- lib/cocoapods-jxedt/command/binary/command/push.rb
|
99
|
+
- lib/cocoapods-jxedt/command/binary/command/source_project.rb
|
97
100
|
- lib/cocoapods-jxedt/command/binary/command/statistics.rb
|
98
101
|
- lib/cocoapods-jxedt/command/header/header.rb
|
99
102
|
- lib/cocoapods-jxedt/command/jxedt.rb
|
100
103
|
- lib/cocoapods-jxedt/command/options/options.rb
|
104
|
+
- lib/cocoapods-jxedt/command/user/user.rb
|
101
105
|
- lib/cocoapods-jxedt/gem_version.rb
|
102
106
|
- lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
|
103
107
|
- lib/cocoapods-jxedt/git_helper/cache_pucher.rb
|