cocoapods-jxedt 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 472fb07816c0d1c0e832786027600851e8676949716ce3d4b9d953023c497120
4
- data.tar.gz: a98a8e436579197870178ff57bf820af36bfb029b758f5b646aa62bc275fe61c
3
+ metadata.gz: abe43eae6c807ddde37ea7b81207987ba97882ffb07f19b6331d6e4ee3f0252a
4
+ data.tar.gz: 4de675f594a49c74c3c6542c4c39025cad621aefd62110f155b6da3634520137
5
5
  SHA512:
6
- metadata.gz: 812df6af0ccbfafcd314c944683da40d8d6aa235fc91e373374eda1089f536c8f0e47e7351facc26d297bbec23fe37304ace96db3b893634244617cabc22250b
7
- data.tar.gz: 28461e27c2869c1688bdcd38dec279ce333732fe14a85ce46b8ccf98339801026e412be60c9b5867d5d66d50dd3361b3d656e0c91a572761e98635d302574d4c
6
+ metadata.gz: 5fe8e4a1d9f7f49bc3171c97372a60f540180124468b81e34dfd055aff059d4fed9d865c4b0a0a7298ea638d77d9876e709246fef564b94e03fb707a3ba23ee7
7
+ data.tar.gz: 5a2aad13e0ac630865c88ef177048fbca2ef7b5cf88cc783c4cf8d502ca01faddf7e1f9fb6fa1c2b5db1c339124cf3bafeea3425074cfe1789eb29e714d8229e
@@ -18,8 +18,8 @@ module Pod
18
18
  class PodSourceInstaller
19
19
 
20
20
  def install_for_prebuild!(standard_sanbox)
21
- check_sandbox = Jxedt::Sandbox.from_sandbox(standard_sanbox)
22
- target_names = check_sandbox.existed_target_names(self.name)
21
+ binary_sandbox = Jxedt::BinarySandbox.from_sandbox(standard_sanbox)
22
+ target_names = binary_sandbox.existed_target_names(self.name)
23
23
 
24
24
  def walk(path, &action)
25
25
  return unless path.exist?
@@ -53,7 +53,7 @@ module Pod
53
53
  target_names.each do |name|
54
54
 
55
55
  # symbol link copy all substructure
56
- real_file_folder = check_sandbox.framework_folder_path_for_target_name(name)
56
+ real_file_folder = binary_sandbox.framework_folder_path_for_target_name(name)
57
57
 
58
58
  # If have only one platform, just place int the root folder of this pod.
59
59
  # If have multiple paths, we use a sperated folder to store different
@@ -132,8 +132,11 @@ module Pod
132
132
  end
133
133
  end
134
134
  end
135
+
136
+ # 设置使用二进制的targets标识
137
+ prebuilt_pod_targets.each { |target| target.use_binary = true }
135
138
 
136
- check_sandbox = Jxedt::Sandbox.from_sandbox(self.sandbox)
139
+ binary_sandbox = Jxedt::BinarySandbox.from_sandbox(self.sandbox)
137
140
 
138
141
  specs = self.analysis_result.specifications
139
142
  prebuilt_specs = (specs.select do |spec|
@@ -175,7 +178,7 @@ module Pod
175
178
  resources = [resources] if resources.kind_of?(String)
176
179
  spec.attributes_hash["resources"] = resources
177
180
  # spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
178
- prebuild_bundles = check_sandbox.prebuild_bundles(spec.root.name).each.map { |bundle_path| "_Prebuild/" + bundle_path }
181
+ prebuild_bundles = binary_sandbox.prebuild_bundles(spec.root.name).each.map { |bundle_path| "_Prebuild/" + bundle_path }
179
182
  prebuild_bundles = [] if checked_specs[spec.root.name].size > 1 # spec.root.name相同的只添加一次bundle文件
180
183
  spec.attributes_hash["resources"] += prebuild_bundles
181
184
  end
@@ -186,7 +189,7 @@ module Pod
186
189
  targets.each do |target|
187
190
  # the framework_file_path rule is decided when `install_for_prebuild`,
188
191
  # as to compitable with older version and be less wordy.
189
- check_sandbox.prebuild_vendored_frameworks(spec.root.name).each do |frame_file_path|
192
+ binary_sandbox.prebuild_vendored_frameworks(spec.root.name).each do |frame_file_path|
190
193
  framework_file_path = "_Prebuild/" + frame_file_path
191
194
  framework_file_path = nil if checked_specs[spec.root.name].size > 1 # spec.root.name相同的只添加一次framework文件
192
195
  add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
@@ -52,8 +52,8 @@ module Pod
52
52
  }.uniq
53
53
 
54
54
  available_pod_names = []
55
- check_sandbox = Jxedt::Sandbox.from_sandbox(self.sandbox)
56
- available_pod_names = check_sandbox.target_paths.map {|path| path.basename.to_s }
55
+ binary_sandbox = Jxedt::BinarySandbox.from_sandbox(self.sandbox)
56
+ available_pod_names = binary_sandbox.target_paths.map {|path| path.basename.to_s }
57
57
  if Jxedt.config.all_binary_enabled?
58
58
  explicit_prebuild_pod_names = available_pod_names
59
59
  else
@@ -34,6 +34,18 @@ module Pod
34
34
  # 恢复sandbox标识
35
35
  sandbox.index_project_create_stage = false
36
36
  end
37
+
38
+ def resolve_dependencies
39
+ analyzer = super
40
+ self.analysis_result.specifications.each do |spec|
41
+ # keep all file in pods
42
+ preserve_paths = spec.attributes_hash["preserve_paths"] || []
43
+ preserve_paths = [preserve_paths] if preserve_paths.kind_of?(String)
44
+ preserve_paths += ['_Prebuild']
45
+ spec.attributes_hash["preserve_paths"] = preserve_paths
46
+ end
47
+ analyzer
48
+ end
37
49
  end
38
50
  end
39
51
 
@@ -10,21 +10,16 @@ module Pod
10
10
  if options.is_a?(Hash) && options.include?(:binary)
11
11
  @explicit_prebuild_pod_names << Specification.root_name(name) if options[:binary]
12
12
  @reject_prebuild_pod_names << Specification.root_name(name) unless options[:binary]
13
- else
14
- settings = Jxedt.config.binary_settings
15
- symbol_name = Specification.root_name(name).to_sym
16
- if settings.include?(symbol_name) && [true, false].include?(settings[symbol_name])
17
- @explicit_prebuild_pod_names << Specification.root_name(name) if settings[symbol_name]
18
- @reject_prebuild_pod_names << Specification.root_name(name) unless settings[symbol_name]
19
- end
20
13
  end
21
14
 
22
15
 
23
16
  # header search path
24
17
  @explicit_header_search_pod_names ||= []
25
18
  @reject_header_search_pod_names ||= []
26
- @explicit_header_search_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options[:framework_header_search]
27
- @reject_header_search_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options.include?(:framework_header_search) && !options[:framework_header_search]
19
+ if options.is_a?(Hash) && options.include?(:framework_header_search)
20
+ @explicit_header_search_pod_names << Specification.root_name(name) if options[:framework_header_search]
21
+ @reject_header_search_pod_names << Specification.root_name(name) unless options[:framework_header_search]
22
+ end
28
23
 
29
24
  options.delete(:binary) if options.is_a?(Hash)
30
25
  options.delete(:framework_header_search) if options.is_a?(Hash)
@@ -37,6 +32,17 @@ module Pod
37
32
  original_parse_inhibit_warnings = instance_method(:parse_inhibit_warnings)
38
33
  define_method(:parse_inhibit_warnings) do |name, requirements|
39
34
  detect_prebuilt_pod(name, requirements)
35
+
36
+ # merge binary settings
37
+ Jxedt.config.binary_settings.each { |name, val|
38
+ next if @explicit_prebuild_pod_names.include?(name) # 配置:binary的组件优先级高
39
+ next if @reject_prebuild_pod_names.include?(name)
40
+ next unless [true, false].include?(val)
41
+
42
+ @explicit_prebuild_pod_names << name.to_s if val
43
+ @reject_prebuild_pod_names << name.to_s unless val
44
+ }
45
+
40
46
  original_parse_inhibit_warnings.bind(self).call(name, requirements)
41
47
  end
42
48
  end
@@ -1,6 +1,6 @@
1
1
  module Jxedt
2
- class Sandbox
3
- attr_accessor :sandbox
2
+ class BinarySandbox
3
+ attr_accessor :standard_sandbox
4
4
 
5
5
  def initialize(path=nil)
6
6
  @sandbox_path = path
@@ -9,9 +9,9 @@ module Jxedt
9
9
  def self.from_sandbox(sandbox)
10
10
  search_path = Jxedt.config.binary_dir
11
11
  binary_dir = search_path.empty? ? nil : sandbox.standard_sandbox_root + search_path
12
- check_sandbox = Sandbox.new(binary_dir)
13
- check_sandbox.sandbox = sandbox
14
- check_sandbox
12
+ binary_sandbox = BinarySandbox.new(binary_dir)
13
+ binary_sandbox.standard_sandbox = sandbox
14
+ binary_sandbox
15
15
  end
16
16
 
17
17
  def binary_dir
@@ -21,11 +21,11 @@ module Jxedt
21
21
  def target_paths
22
22
  return [] if @sandbox_path.nil?
23
23
  return [] unless binary_dir.exist?
24
- return [] if @sandbox.source_lockfile.nil?
24
+ return [] if @standard_sandbox.source_lockfile.nil?
25
25
  @targets ||= begin
26
26
  prebuild_targets = binary_dir.children().map do |target_path|
27
27
  if target_path.directory? && (not target_path.children.empty?)
28
- hash_key = @sandbox.source_lockfile.spec_checksums_hash_key(target_path.basename.to_s)
28
+ hash_key = @standard_sandbox.source_lockfile.spec_checksums_hash_key(target_path.basename.to_s)
29
29
  next if hash_key.nil?
30
30
 
31
31
  checksum_files = target_path.children().select { |path| path.extname == '.checksum' }
@@ -126,8 +126,8 @@ module Jxedt
126
126
  end
127
127
 
128
128
  def build
129
- check_sandbox = Jxedt::Sandbox.from_sandbox(@source_installer.sandbox)
130
- existed_target_names = check_sandbox.target_paths.map { |pair| pair.basename.to_s }
129
+ binary_sandbox = Jxedt::BinarySandbox.from_sandbox(@source_installer.sandbox)
130
+ existed_target_names = binary_sandbox.target_paths.map { |pair| pair.basename.to_s }
131
131
  targets = targets_to_prebuild.reject { |target| existed_target_names.include?(target.name.to_s) }
132
132
 
133
133
  Pod::UI.puts "Prebuild total count: #{targets.size}"
@@ -44,6 +44,8 @@ module Pod
44
44
  source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile)
45
45
  # 执行install
46
46
  source_installer.install!
47
+ # 生成index工程
48
+ source_installer.generate_pods_index_project!
47
49
  end
48
50
  end
49
51
  end
@@ -2,6 +2,7 @@ require_relative 'options/options'
2
2
  require_relative 'header/header'
3
3
  require_relative 'binary/binary'
4
4
  require_relative 'user/user'
5
+ require_relative 'modify/modify'
5
6
 
6
7
  module Pod
7
8
  class Command
@@ -0,0 +1,63 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class ModifyDir < JxedtCommand
5
+ self.summary = '修改文件目录的真实路径,并在原位置创建一个目录的软链接,为二进制调试提供便利。'
6
+ self.description = <<-DESC
7
+ 可以把很多台机器上的工程目录统一放置到一个相同目录,这样可以确保所有的机器的工程目录都是相同的。\n
8
+ 编译打包的文件路径也是相同的,然后就可以使用二进制调试的功能了。\n
9
+ 这个统一的目录是`/Users/cocoapods-jxedt/`
10
+ DESC
11
+ self.command = 'modifydir'
12
+ self.arguments = [
13
+ CLAide::Argument.new('DIRECTORY_PATH', true)
14
+ ]
15
+ def self.options
16
+ [
17
+ ['--name', '统一路径下的工程目录名称']
18
+ ]
19
+ end
20
+ def initialize(argv)
21
+ @dir_path = argv.shift_argument
22
+ @name = argv.option('name')
23
+ super
24
+ end
25
+
26
+ def validate!
27
+ super
28
+ help! '没有传入操作目录!!!' if @dir_path.nil?
29
+ # 获取完整路径
30
+ @dir_path = File.expand_path(@dir_path)
31
+ help! '操作目录不存在!!!' unless File.exist?(@dir_path)
32
+ help! '传入的地址不是一个目录!!!' unless File.directory?(@dir_path)
33
+ help! '操作目录已经是一个软链接!!!' if File.ftype(@dir_path) == 'link'
34
+ help! '操作目录已经在指定目录下!!!' if @dir_path =~ /^#{user_path}/
35
+ help! '当前目录不允许操作,操作路径最少要3层目录!!!' unless @dir_path.split('/').reject { |path| path.empty? }.count > 2
36
+ end
37
+
38
+ def run
39
+ op_dir_path = Pathname.new(@dir_path)
40
+ # 获取target name
41
+ @name = op_dir_path.basename if @name.nil? || @name.empty?
42
+
43
+ # create user directory
44
+ `sudo mkdir #{user_path} && sudo chmod -R 777 #{user_path}` unless user_path.exist?
45
+
46
+ # 路径是否存在
47
+ target_path = user_path + @name
48
+ # target_path.rmtree if target_path.exist?
49
+ help! '目录已存在!!!' if target_path.exist?
50
+
51
+ # 移动目录
52
+ FileUtils.mv(@dir_path, target_path)
53
+ # 创建软链接
54
+ FileUtils.ln_s(target_path, op_dir_path)
55
+ end
56
+
57
+ def user_path
58
+ @user_path ||= Pathname.new('/Users/cocoapods-jxedt/')
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -40,6 +40,30 @@ module Pod
40
40
  log_section "🌹 GIT_CACHE_CONFIG"
41
41
  git_config = Jxedt::Config::GIT_CACHE_CONFIG
42
42
  Pod::UI.puts JSON.pretty_generate(git_config)
43
+
44
+ log_section "🌹 DSL支持的方法"
45
+ Pod::UI.puts dsl_support_method
46
+
47
+ log_section "🌹 组件支持的DSL配置"
48
+ Pod::UI.puts arguments_support
49
+ end
50
+
51
+ def dsl_support_method
52
+ dsl_method = <<DSL_METHOD
53
+ all_binary! 组件全部使用二进制
54
+ binary_dir('../_Prebuild') 配置二进制的放置路径
55
+ binary_switch(true) 二进制开关
56
+ framework_header_search_enabled(true) 开启配置依赖的framework头文件配置
57
+ use_binary_settings(Hash) 使用二进制的组件配置
58
+ cocoapods_jxedt_config(Hash) 配置插件
59
+ DSL_METHOD
60
+ end
61
+
62
+ def arguments_support
63
+ config = <<CONFIG
64
+ :binary => true 组件是否使用二进制
65
+ :framework_header_search => true 组件是否需要配置依赖的framework的头文件
66
+ CONFIG
43
67
  end
44
68
 
45
69
  def print_base_options_config
@@ -1,3 +1,3 @@
1
1
  module CocoapodsJxedt
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  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.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - guojiashuang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -100,6 +100,7 @@ files:
100
100
  - lib/cocoapods-jxedt/command/binary/command/statistics.rb
101
101
  - lib/cocoapods-jxedt/command/header/header.rb
102
102
  - lib/cocoapods-jxedt/command/jxedt.rb
103
+ - lib/cocoapods-jxedt/command/modify/modify.rb
103
104
  - lib/cocoapods-jxedt/command/options/options.rb
104
105
  - lib/cocoapods-jxedt/command/user/user.rb
105
106
  - lib/cocoapods-jxedt/gem_version.rb