Module: ConfuseModule

Defined in:
lib/cocoapods-privacy/confuse/ConfuseModule.rb

Class Method Summary collapse

Class Method Details

.load_module(podspec_file_path) ⇒ Object

处理组件



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cocoapods-privacy/confuse/ConfuseModule.rb', line 14

def self.load_module(podspec_file_path)
  # puts "podspec_file_path = #{podspec_file_path}"
  specManager = BB::BBSpecManager.new(KSpecTypeConfuse)
  puts "👇👇👇👇👇👇 Start analysis component confuse 👇👇👇👇👇👇"
  confuse_hash = specManager.check(podspec_file_path)
  confuse_hash.each do |confuse_file_path, hash|
    source_files = hash[KSource_Files_Key]
    exclude_files = hash[KExclude_Files_Key]
    # puts "source_files = #{source_files}"
    # puts "exclude_files = #{exclude_files}"
    # puts "confuse_file_path = #{confuse_file_path}"
    podspec = Pod::Specification.from_file(podspec_file_path)
    version =  podspec.version.to_s.gsub('.', '_')  # Replace dots with underscores
    name = Base64.encode64(podspec.name.to_s)
    mix_version = version + "_" + name

    hunter = Confuse::Hunter.new(mix_version)
    apis_define_map, swift_extension_funcBody_map = hunter.search_need_confuse_apis(source_files,exclude_files)  
    # puts "swift_extension_funcBody_map = #{swift_extension_funcBody_map}"

    oc_confuse_file_path = "#{confuse_file_path}.h"
    swift_confuse_file_path = "#{confuse_file_path}.swift"
    hunter.insert_encrypted_apis_to_confuse_header(apis_define_map,oc_confuse_file_path)
    hunter.insert_encrypted_apis_to_confuse_swift(swift_extension_funcBody_map,swift_confuse_file_path)
  end
  puts "👆👆👆👆👆👆 End analysis component confuse 👆👆👆👆👆👆"
end