cocoapods-jxedt 0.0.17 → 0.0.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b8390f2490128b3ae787cd3a5d1ae8677eda84a3d8b2817f9d89fef6b47e1d
4
- data.tar.gz: b43bef366375925d915be7bf0a4e4b745a1f2eaf506ea0991f6cd7292bce849c
3
+ metadata.gz: 7c059b0853c0b86e555a853eea168d4a3c1c8652bb8db739d5e3e9a434abf22c
4
+ data.tar.gz: a77b1ca134e6f16ce3a12f6da6974b363c07992ee90939c63a0f7d6e9384d020
5
5
  SHA512:
6
- metadata.gz: 7a771222219d027b4f5b5de8077c63d6d9e04450b39c8383e940a1c3b1bf2bdccdd0c974d024ba4a9e8b30da82a530c4370d79c4f14067f1384a9d0fea8d6c4c
7
- data.tar.gz: 2a7f8424df70d69f239aa28996152857504e6e07253521fefab8b9370c15a03c98b0effa5637a08ac82a004e75622708a7b3c1d99a2b1af4baa0cd22d0792772
6
+ metadata.gz: e35493b31fe5ab1a60b447f8623360a6649a43cce78149bfb814fe55925c0e936ae111543901203f66634341de2c23b5c48d6ad997f6efe851b2d30a259ea31e
7
+ data.tar.gz: be8fdce02f67e56af427026fa8c99c593468354a6a77571b76394f9b32b5e31707db5d40b7424c209acc289b02b954c4f20eb1c61295e38c76df020e6a43549a
@@ -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'",
@@ -82,6 +83,14 @@ module Jxedt
82
83
  @dsl_config[:keep_source_project] || false
83
84
  end
84
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
+
85
94
  def dev_pods_enabled?
86
95
  @dsl_config[:dev_pods_enabled] || false
87
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,27 +107,18 @@ 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
 
111
- def clean_source_project!
112
- if Jxedt.config.keep_source_project?
113
- # 修改productName后,可以把源码工程拖入workspace中源码调试,而源码不链接和编译
114
- require 'xcodeproj'
115
- project = Xcodeproj::Project.open(project_path)
116
- project.targets.each do |target|
117
- target.build_configurations.each do |config|
118
- # 修改工程的product name
119
- product_name = config.build_settings['PRODUCT_NAME'] || target.name
120
- config.build_settings['PRODUCT_NAME'] = "#{product_name}_Source"
121
- end
122
- # target.name = "#{target.name}_Source"
123
- end
124
- project.save
116
+ def index_project_name
117
+ return 'Pods-Index.xcodeproj'
118
+ end
125
119
 
126
- # 保存源码工程,退出
127
- return
128
- end
120
+ def clean_source_project!
121
+ return if Jxedt.config.keep_source_project?
129
122
 
130
123
  sources_root.rmtree if real_path_compiler? && sources_root.exist?
131
124
  root.rmtree if root.exist?
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module CocoapodsJxedt
2
- VERSION = "0.0.17"
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.17
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-08-18 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