cocoapods-kz 0.0.13 → 0.0.14

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: 60b78485f551ed394bb167d18aad9e08008ea9c432ef555ade88cfc241f918bb
4
- data.tar.gz: '082f62c4d943cde90357a9a5a55c10636a39ad232e9aded7230170301c01453e'
3
+ metadata.gz: e5dcadeaa76d480bc0a06c97d9f07fc514d4f6c6fa6e1321ea60546f9b425a5f
4
+ data.tar.gz: 01ab3e043531cbc9e29d6a73ddc15e63873245c7aa99c8a301ae79dc531f4914
5
5
  SHA512:
6
- metadata.gz: ea906c0ac96d2c98a2eab4631a356cb1753de215ca0c0694cd13af454b3418f96f1fe4400d081c63f69115c6870efabdd146ef839168cdaa8d9de2ba3e2bdc6d
7
- data.tar.gz: 295dec357984a4e81fea271b0b261af9e0dc6a0e383d048df8e46224521d3e77ee58124116b0e0d42731121af35d8d4234b92b63c51ca0fc26028e714cba830a
6
+ metadata.gz: e163e6c506505a9a1cf39ae263a5a40ccaf1ff8aae61d0ac808f1256106409ff7d5fd29de8c52abe9fb93666e42a6ad0db504a759eadb94b2781478a61aa83c9
7
+ data.tar.gz: f678b463d568835f87a1d5d490c8f5096651d94fe7123ce94ac26ea8eee3ea1bd9130e908b7e2c616811e26c804523ef5897b2c69306f8e0ca89160cd3159830
@@ -1,5 +1,5 @@
1
1
  module CocoapodsKz
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
4
4
 
5
5
  module Pod
@@ -3,18 +3,41 @@ require_relative 'kz_global_helper'
3
3
 
4
4
  module KZ
5
5
 
6
+ class KZFlexLibInfo
7
+ attr_accessor :have_flexLib_pod
8
+ attr_accessor :have_kzswiftui_pod
9
+ attr_accessor :flexLib_version
10
+
11
+ def initialize
12
+ @have_flexLib_pod = false
13
+ @have_kzswiftui_pod = false
14
+ @flexLib_version = Pod::Version::ZERO
15
+ end
16
+ end
17
+
6
18
  class KZAnalyzer
7
19
  attr_accessor :all_kz_pod_targets
20
+ attr_accessor :pod_of_flexlib_info
8
21
 
9
22
  def initialize(native_pod_targets, development_pods)
10
23
  @native_pod_targets = native_pod_targets
11
24
  @development_pods = development_pods.keys
12
25
  @all_kz_pod_targets = {}
26
+ @pod_of_flexlib_info = KZFlexLibInfo.new
13
27
  end
14
28
 
15
29
  def analyer
16
30
  @native_pod_targets.each { |native_pod_target|
17
31
  create_kz_pod_target_from(native_pod_target, :kz_pod_origin_mode)
32
+
33
+ if native_pod_target.root_spec.name == "FlexLib"
34
+ @pod_of_flexlib_info ||= KZFlexLibInfo()
35
+ @pod_of_flexlib_info.have_flexLib_pod = true
36
+ @pod_of_flexlib_info.flexLib_version = native_pod_target.root_spec.version
37
+ elsif native_pod_target.root_spec.name == "KZSwiftUI"
38
+ @pod_of_flexlib_info ||= KZFlexLibInfo()
39
+ @pod_of_flexlib_info.have_kzswiftui_pod = true
40
+ end
18
41
  }
19
42
 
20
43
  # 检测是否有product名称相同的target
@@ -2,6 +2,7 @@ require_relative 'kz_pod_target'
2
2
  require_relative 'kz_global_helper'
3
3
  require_relative 'kz_config_result'
4
4
  require 'tmpdir'
5
+ require 'shellwords'
5
6
  require_relative 'kz_log'
6
7
 
7
8
  module KZ
@@ -50,6 +51,26 @@ module KZ
50
51
  @@all_resources_cache_info
51
52
  end
52
53
 
54
+ def self.handle_origin_library(origin_libraries, kz_pod_target)
55
+ tempdir = Pathname(Dir.mktmpdir)
56
+ lib_frameworks_path = tempdir + "lib_frameworks"
57
+ FileUtils.mkdir_p(lib_frameworks_path)
58
+
59
+ origin_lib_frameworks = []
60
+ origin_libraries.each do |origin_library_path|
61
+ lib_framework_name = origin_library_path.basename(origin_library_path.extname)
62
+ lib_framework_path = lib_frameworks_path + "#{lib_framework_name}.framework"
63
+ FileUtils.mkdir_p(lib_framework_path)
64
+
65
+ FileUtils.cp(origin_library_path, lib_framework_path + lib_framework_name)
66
+ origin_lib_frameworks.append(lib_framework_path)
67
+ end
68
+
69
+ new_frameworks = handle_origin_framework(origin_lib_frameworks, kz_pod_target)
70
+ FileUtils.rm_r(tempdir)
71
+ new_frameworks
72
+ end
73
+
53
74
  def self.handle_origin_framework(origin_frameworks, kz_pod_target)
54
75
  new_frameworks = []
55
76
  old_destination_path = kz_pod_target.pod_config_cache_path(false , true)
@@ -181,7 +202,9 @@ module KZ
181
202
  FileUtils.mkdir_p(ar_x_path)
182
203
  ar_x_success = system("cd #{ar_x_path}; ar x #{arm64_framework_exe_path}")
183
204
  if ar_x_success
184
- system("for file in #{ar_x_path}/*.o; do #{ARM64_TO_SIMULATOR_EXECUTE_PATH} $file; done")
205
+ Dir["#{ar_x_path}/*.o"].each do |file|
206
+ system(ARM64_TO_SIMULATOR_EXECUTE_PATH, file)
207
+ end
185
208
  system("ar crv #{temp_framwork_exe_path} #{ar_x_path}/*.o &> /dev/null")
186
209
  else
187
210
  FileUtils.rm_r(tempdir)
@@ -96,10 +96,6 @@ module KZ
96
96
  FileUtils.rm_rf(KZ_POD_CONFIG_POD_TEMPDIR) if File.exist?(KZ_POD_CONFIG_POD_TEMPDIR)
97
97
  FileUtils.mkdir_p(KZ_POD_CONFIG_POD_TEMPDIR)
98
98
 
99
- FileUtils.rm(FLEX_COMPLIER_PATH) if File.exist?(FLEX_COMPLIER_PATH)
100
- FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', FLEX_COMPLIER_PATH)
101
- system("chmod +x #{FLEX_COMPLIER_PATH}")
102
-
103
99
  FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/kz_generator_framework.sh', KZ_GENERATOR_FRAMEWORK_PATH)
104
100
  system("chmod +x #{KZ_GENERATOR_FRAMEWORK_PATH}")
105
101
 
@@ -127,6 +123,18 @@ module KZ
127
123
  end
128
124
  end
129
125
 
126
+ def handle_flexCompiler
127
+ if have_flexLib_pod_target
128
+ FileUtils.rm(FLEX_COMPLIER_PATH) if File.exist?(FLEX_COMPLIER_PATH)
129
+ if @kz_analyzer.pod_of_flexlib_info.flexLib_version.major >= 4
130
+ FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler_V1', FLEX_COMPLIER_PATH)
131
+ else
132
+ FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', FLEX_COMPLIER_PATH)
133
+ end
134
+ system("chmod +x #{FLEX_COMPLIER_PATH}")
135
+ end
136
+ end
137
+
130
138
  def analyze_special_parameters(use_code_tag, use_framework_tag, pod_names)
131
139
  specify_pod_names = []
132
140
  if pod_names.count > 0
@@ -159,10 +167,13 @@ module KZ
159
167
  end
160
168
 
161
169
  def have_flexLib_pod_target
170
+ return @kz_analyzer.pod_of_flexlib_info.have_kzswiftui_pod || @kz_analyzer.pod_of_flexlib_info.have_flexLib_pod
171
+ end
172
+
173
+ def check_and_copy_flex_compiler
162
174
  @kz_analyzer.all_kz_pod_targets.values.each do |target|
163
175
  return true if target.root_name == 'FlexLib' || target.root_name == 'KZSwiftUI'
164
176
  end
165
- false
166
177
  end
167
178
 
168
179
  def write_lock_file
@@ -348,5 +348,12 @@ module KZ
348
348
  @on_demand_resources
349
349
  end
350
350
 
351
+ def get_swift_lldb_ast_path
352
+ if current_should_build? and current_uses_swift?
353
+ return "$(TARGET_BUILD_DIR)/#{root_name}/#{product_name}/Modules/#{product_basename}.swiftmodule/$(NATIVE_ARCH_ACTUAL)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(SHALLOW_BUNDLE_TRIPLE).swiftmodule"
354
+ end
355
+ nil
356
+ end
357
+
351
358
  end
352
359
  end
@@ -70,18 +70,38 @@ module Pod
70
70
  end
71
71
  end
72
72
 
73
+ alias_method :origin_vendored_libraries, :vendored_libraries
74
+ def vendored_libraries
75
+ if self.kz_pod_target and KZ::KZGlobalHelper.instance.arm64_simulator
76
+ return []
77
+ else
78
+ origin_vendored_libraries
79
+ end
80
+ end
81
+
73
82
  alias_method :origin_vendored_frameworks, :vendored_frameworks
74
83
  def vendored_frameworks
75
84
  if self.kz_pod_target
76
- frameworks = origin_vendored_frameworks
77
- if KZ::KZGlobalHelper.instance.arm64_simulator && frameworks.count > 0
78
- frameworks = KZ::KZFrameworkManager.handle_origin_framework(frameworks, self.kz_pod_target)
85
+ new_frameworks = []
86
+ if KZ::KZGlobalHelper.instance.arm64_simulator
87
+ libraries = origin_vendored_libraries
88
+ if libraries.count > 0
89
+ new_frameworks.concat(KZ::KZFrameworkManager.handle_origin_library(libraries, self.kz_pod_target))
90
+ end
91
+ frameworks = origin_vendored_frameworks
92
+ if frameworks.count > 0
93
+ new_frameworks.concat(KZ::KZFrameworkManager.handle_origin_framework(frameworks, self.kz_pod_target))
94
+ end
95
+ else
96
+ new_frameworks.concat(origin_vendored_frameworks)
79
97
  end
98
+
99
+ # 是否开启framework模式
80
100
  result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
81
101
  if !self.spec.test_specification && result
82
- frameworks.concat(result.get_framework_paths)
102
+ new_frameworks.concat(result.get_framework_paths)
83
103
  end
84
- frameworks
104
+ new_frameworks
85
105
  else
86
106
  origin_vendored_frameworks
87
107
  end
@@ -16,6 +16,7 @@ module Pod
16
16
  kz_analyer.analyer
17
17
  KZ::KZGlobalHelper.instance.kz_analyzer = kz_analyer
18
18
  KZ::KZGlobalHelper.instance.kz_generator = KZ::KZGenerator.new(main_project)
19
+ KZ::KZGlobalHelper.instance.handle_flexCompiler
19
20
  end
20
21
  end
21
22
 
@@ -21,6 +21,8 @@ module Pod
21
21
  kz_clean_xcconfig(xcconfig)
22
22
  main_hamp_search_path = '"' + KZ::KZ_POD_CONFIG_ROOT_STR + "/#{self.target.user_project.root_object.display_name}.hmap" + '"'
23
23
  pod_targets = self.target.pod_targets_for_build_configuration(generator.configuration_name)
24
+
25
+ swift_lldb_ast_paths = []
24
26
  pod_targets.each do |native_pod_target|
25
27
  kz_pod_target = native_pod_target.weakRef_kz_pod_target
26
28
  if kz_pod_target
@@ -33,8 +35,16 @@ module Pod
33
35
  if kz_pod_target.force_load
34
36
  kz_add_force_load_tag(xcconfig, kz_pod_target)
35
37
  end
38
+
39
+ # 添加swift ast path
40
+ ast_path = kz_pod_target.get_swift_lldb_ast_path
41
+ if !ast_path.nil? and generator.configuration_name == "Debug"
42
+ swift_lldb_ast_paths << ast_path
43
+ end
36
44
  end
37
45
  end
46
+
47
+ kz_add_swift_lldb_ast_paths(xcconfig, swift_lldb_ast_paths)
38
48
  xcconfig.attributes['HEADER_SEARCH_PATHS'] = main_hamp_search_path
39
49
  xcconfig.attributes['USE_HEADERMAP'] = 'NO'
40
50
  if KZ::KZGlobalHelper.instance.arm64_simulator
@@ -175,6 +185,16 @@ module Pod
175
185
  force_flags.add(KZ.deal_path_for_xcconfig(kz_pod_target.force_load_info, true))
176
186
  end
177
187
 
188
+ def kz_add_swift_lldb_ast_paths(xcconfig, swift_lldb_ast_paths)
189
+ if swift_lldb_ast_paths.count > 0
190
+ other_linker_flags = xcconfig.other_linker_flags
191
+ simple = other_linker_flags[:simple]
192
+ swift_lldb_ast_paths.each do |swift_lldb_ast_path|
193
+ simple.add("-Wl,-add_ast_path,#{KZ.deal_path_for_xcconfig(swift_lldb_ast_path, true)}")
194
+ end
195
+ end
196
+ end
197
+
178
198
  end
179
199
  end
180
200
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-kz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - yixiong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-06 00:00:00.000000000 Z
11
+ date: 2025-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - lib/cocoapods-kz/native/target_installer_helper.rb
79
79
  - lib/cocoapods-kz/native/target_integrator.rb
80
80
  - lib/cocoapods-kz/resources/FlexCompiler
81
+ - lib/cocoapods-kz/resources/FlexCompiler_V1
81
82
  - lib/cocoapods-kz/resources/arm64ToSimulator
82
83
  - lib/cocoapods-kz/resources/hmap
83
84
  - lib/cocoapods-kz/resources/kz_fix_force_load_exe.sh