cocoapods-jxedt 0.0.16 → 0.0.18

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: 97f69690fe092a3b3f3ac75812d982e144d4f5e8434e70d999ab81a6d0aeef89
4
- data.tar.gz: 55319b9dd689f80433855208a24a81b4b85a6b1a898b88b9921b961ef6bae4a0
3
+ metadata.gz: 7c059b0853c0b86e555a853eea168d4a3c1c8652bb8db739d5e3e9a434abf22c
4
+ data.tar.gz: a77b1ca134e6f16ce3a12f6da6974b363c07992ee90939c63a0f7d6e9384d020
5
5
  SHA512:
6
- metadata.gz: ecbb12c9bb4c7adac71673b5a47d02a80695112d0acfc157585448c761a91e8ee679d091500cbbcecabea583cfa92a76b1ac74738fc07bf3f8a70494f853c2be
7
- data.tar.gz: 03cb1d511a955cbbe0b6925e1c03a1bc840f09095b91000c5ee581c692d4415adad79fd1b67213c6e712942afcd4d296285ecb9cc8667fdaa51f5a865dadf6d6
6
+ metadata.gz: e35493b31fe5ab1a60b447f8623360a6649a43cce78149bfb814fe55925c0e936ae111543901203f66634341de2c23b5c48d6ad997f6efe851b2d30a259ea31e
7
+ data.tar.gz: be8fdce02f67e56af427026fa8c99c593468354a6a77571b76394f9b32b5e31707db5d40b7424c209acc289b02b954c4f20eb1c61295e38c76df020e6a43549a
@@ -140,6 +140,12 @@ module Pod
140
140
  # rmtree
141
141
  target_prebuild_files = self.sandbox.pod_dir(spec.name) + "_Prebuild"
142
142
  target_prebuild_files.rmtree if target_prebuild_files.exist?
143
+
144
+ # 切换到local pod时,清除一下pod所在目录下的_Prebuild文件夹
145
+ if self.sandbox.local?(spec.root.name)
146
+ source_target_prebuild_files = self.sandbox.sources_root + spec.root.name + "_Prebuild"
147
+ source_target_prebuild_files.rmtree if source_target_prebuild_files.exist?
148
+ end
143
149
 
144
150
  self.prebuild_pod_names.include? spec.root.name
145
151
  end)
@@ -12,6 +12,7 @@ module Jxedt
12
12
  :binary_switch => "插件开关,设置为false则关闭插件二进制功能。默认为true",
13
13
  :prebuild_job => "开启编译任务,设置为false则不触发编译功能。默认为true",
14
14
  :keep_source_project => "保留源码的pods工程,方便查看源码,文件目录为Podfile文件同级目录下'Pods-Source'。默认为false",
15
+ :create_index_project => "在源码工程目录下创建一个index project工程,可以直接拖入workspace中,可点击查看源码,可断点调试。默认取`keep_source_project`的配置",
15
16
  :dev_pods_enabled => "Development Pods是否支持二进制。默认为false",
16
17
  :excluded_pods => "排除binary的pods,是一个数组。默认是[]",
17
18
  :xcconfig_configuration_alias => "xcconfig文件中配置多configuration的别名(一定要唯一),用于搜索替换,我们用来支持多configuration的二进制。一般不需要设置,默认值为'cocoapods-jxedt-binary'",
@@ -63,6 +64,13 @@ module Jxedt
63
64
  @dsl_config[:all_binary] || false
64
65
  end
65
66
 
67
+ def binary_settings
68
+ @options ||= begin
69
+ @dsl_config[:use_binary_settings] || {}
70
+ end
71
+ @options
72
+ end
73
+
66
74
  def binary_switch?
67
75
  @dsl_config[:binary_switch] || @dsl_config[:binary_switch].nil?
68
76
  end
@@ -75,6 +83,14 @@ module Jxedt
75
83
  @dsl_config[:keep_source_project] || false
76
84
  end
77
85
 
86
+ def create_index_project?
87
+ @create_index ||= begin
88
+ create_index = @dsl_config[:create_index_project]
89
+ create_index = keep_source_project? if create_index.nil?
90
+ create_index && keep_source_project?
91
+ end
92
+ end
93
+
78
94
  def dev_pods_enabled?
79
95
  @dsl_config[:dev_pods_enabled] || false
80
96
  end
@@ -7,5 +7,62 @@ module Pod
7
7
  super.to_h.merge(:integrate_targets => false)
8
8
  )
9
9
  end
10
+
11
+ def generate_pods_index_project!
12
+ return unless Jxedt.config.create_index_project?
13
+
14
+ Pod::UI.puts "-----------------------------------------"
15
+ Pod::UI.puts "🚖 生成Pods-Index.xcodeproj,可以直接把工程拖入workspace来查看源码或进行二进制调试"
16
+ Pod::UI.puts "-----------------------------------------"
17
+
18
+ # 生成index project开始标识
19
+ sandbox.index_project_create_stage = true
20
+
21
+ # 只生成pods target工程
22
+ cache_analysis_result = analyze_project_cache
23
+ # 获取缓存中需要生成的pod_targets
24
+ pod_targets_to_generate = cache_analysis_result.pod_targets_to_generate.clone
25
+ # 修改标识,这个标识用于修改Target的productName
26
+ pod_targets_to_generate.each { |target| target.binary_index_enabled = true }
27
+
28
+ # 调用生成project的方法,aggregate_targets传空
29
+ create_and_save_projects(pod_targets_to_generate, [],
30
+ cache_analysis_result.build_configurations, cache_analysis_result.project_object_version)
31
+
32
+ # 恢复sandbox标识
33
+ sandbox.index_project_create_stage = false
34
+ end
35
+ end
36
+ end
37
+
38
+ module Pod
39
+ class Installer
40
+ # Cleans up the sandbox directory by removing stale target support files and headers.
41
+ #
42
+ class SandboxDirCleaner
43
+ alias_method :old_sandbox_project_dir_names, :sandbox_project_dir_names
44
+ def sandbox_project_dir_names
45
+ project_dir_names = old_sandbox_project_dir_names
46
+ if sandbox.is_a?(Pod::JxedtPrebuildSandbox)
47
+ # 如果允许生成Pods-Index.xcodeproj,排除这个文件
48
+ project_dir_names.reject! { |d| d.basename.to_s =~ /#{sandbox.index_project_name}$/ } if Jxedt.config.create_index_project?
49
+ end
50
+ project_dir_names
51
+ end
52
+ end
53
+ end
54
+
55
+ class PodTarget < Target
56
+ attr_accessor :binary_index_enabled
57
+
58
+ # 修改product module name
59
+ alias_method :old_product_module_name, :product_module_name
60
+ def product_module_name
61
+ name_ = old_product_module_name
62
+ return "#{name_}_Source" if binary_index_enabled
63
+ name_
64
+ end
10
65
  end
11
- end
66
+ end
67
+
68
+
@@ -51,6 +51,8 @@ module Pod
51
51
  #
52
52
  #
53
53
  class JxedtPrebuildSandbox < Sandbox
54
+ attr_accessor :index_project_create_stage
55
+
54
56
  # [Pod::Sandbox] standard_sandbox
55
57
  def self.from_standard_sandbox(sandbox, sandbox_path: nil, real_path_compiler: false)
56
58
  prebuild_sandbox_path = Pathname.new(sandbox.root).realpath + '../Pods-Source'
@@ -105,9 +107,16 @@ module Pod
105
107
  end
106
108
 
107
109
  def project_path
110
+ if index_project_create_stage
111
+ return root + index_project_name
112
+ end
108
113
  root + 'Pods-Source.xcodeproj'
109
114
  end
110
115
 
116
+ def index_project_name
117
+ return 'Pods-Index.xcodeproj'
118
+ end
119
+
111
120
  def clean_source_project!
112
121
  return if Jxedt.config.keep_source_project?
113
122
 
@@ -7,8 +7,18 @@ module Pod
7
7
  # prebuild
8
8
  @explicit_prebuild_pod_names ||= []
9
9
  @reject_prebuild_pod_names ||= []
10
- @explicit_prebuild_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options[:binary]
11
- @reject_prebuild_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options.include?(:binary) && !options[:binary]
10
+ if options.is_a?(Hash) && options.include?(:binary)
11
+ @explicit_prebuild_pod_names << Specification.root_name(name) if options[:binary]
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
+ end
21
+
12
22
 
13
23
  # header search path
14
24
  @explicit_header_search_pod_names ||= []
@@ -70,6 +70,7 @@ module Jxedt
70
70
  Jxedt::CachePucher.push(output_dir, build_targets, false)
71
71
  end
72
72
  end
73
+ source_installer.generate_pods_index_project!
73
74
  prebuild_sandbox.clean_source_project!
74
75
 
75
76
  log_section "🤖 Resume pod installation"
@@ -17,6 +17,13 @@ module Pod
17
17
  Jxedt.config.dsl_config.merge!({'framework_header_search_enabled': true})
18
18
  end
19
19
 
20
+ # 统一设置是否使用binary
21
+ def use_binary_settings(options=nil)
22
+ return if options.nil?
23
+ return unless options.is_a?(Hash)
24
+ Jxedt.config.dsl_config.merge!({'use_binary_settings': options})
25
+ end
26
+
20
27
  def cocoapods_jxedt_config(options)
21
28
  Jxedt.config.dsl_config.merge!(options)
22
29
  Jxedt.config.validate_dsl_config
@@ -37,7 +37,11 @@ module Pod
37
37
 
38
38
  used_binary = []
39
39
  Dir.glob("#{pods_root}/*/_Prebuild") do |file_path|
40
+ # 不是目录,不处理
40
41
  next unless File.directory?(file_path)
42
+ # 目录下文件为空不处理
43
+ next if Dir["#{file_path}/*"].empty?
44
+
41
45
  dir_name = File.dirname(file_path)
42
46
  name = File.basename(dir_name).to_s
43
47
  target_path = binary_dir + name
@@ -64,6 +68,9 @@ module Pod
64
68
  index, failed = 0, []
65
69
  used_binary.sort_by {|hash| hash[:name].capitalize }.each do |hash|
66
70
  name = hash[:name]
71
+
72
+ # lockfile中没有则跳过
73
+ next unless lockfile.internal_data["SPEC CHECKSUMS"].include?(name)
67
74
 
68
75
  checksum = lockfile.spec_checksums_hash_key(name)
69
76
  validation_passed = checksum && checksum == hash[:checksum] && hash[:checksum_count] == 1
@@ -1,3 +1,3 @@
1
1
  module CocoapodsJxedt
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.18"
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.16
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - guojiashuang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods