cocoapods-kz 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-kz/command/install.rb +12 -9
- data/lib/cocoapods-kz/command/kz.rb +1 -0
- data/lib/cocoapods-kz/command/repair.rb +47 -0
- data/lib/cocoapods-kz/command/update.rb +12 -8
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +46 -3
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_generator.rb +256 -0
- data/lib/cocoapods-kz/helpers/kz_global_helper.rb +127 -0
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +95 -24
- data/lib/cocoapods-kz/helpers/repair_dynamic_swift.rb +373 -0
- data/lib/cocoapods-kz/helpers/repair_module_import.rb +113 -0
- data/lib/cocoapods-kz/native/acknowledgements.rb +8 -15
- data/lib/cocoapods-kz/native/analyzer.rb +5 -4
- data/lib/cocoapods-kz/native/dls.rb +2 -1
- data/lib/cocoapods-kz/native/file_accessor.rb +25 -8
- data/lib/cocoapods-kz/native/installer.rb +9 -22
- data/lib/cocoapods-kz/native/pod_target.rb +17 -0
- data/lib/cocoapods-kz/native/pod_target_installer.rb +30 -0
- data/lib/cocoapods-kz/native/target.rb +34 -0
- data/lib/cocoapods-kz/native/target_installer_helper.rb +105 -0
- data/lib/cocoapods-kz/native.rb +4 -1
- metadata +13 -10
- data/lib/cocoapods-kz/helpers/build_framework_config.rb +0 -48
- data/lib/cocoapods-kz/helpers/create_hamp.rb +0 -214
- data/lib/cocoapods-kz/helpers/global_helper.rb +0 -71
- data/lib/cocoapods-kz/helpers/strip_framework_config.rb +0 -40
- data/lib/cocoapods-kz/helpers/xml_build_config.rb +0 -53
- data/lib/cocoapods-kz/native/user_project_integrator.rb +0 -16
@@ -0,0 +1,113 @@
|
|
1
|
+
require_relative 'kz_global_helper'
|
2
|
+
|
3
|
+
module KZ
|
4
|
+
class KZRepairModuleImport
|
5
|
+
def initialize(main_project)
|
6
|
+
@main_project = main_project
|
7
|
+
@all_kz_pod_targets = KZ::KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets
|
8
|
+
@specify_pod_names = KZ::KZGlobalHelper.instance.specify_pod_names
|
9
|
+
end
|
10
|
+
|
11
|
+
def repair
|
12
|
+
if @specify_pod_names.count == 0 || @specify_pod_names.include?("Main")
|
13
|
+
main_project_file_folder = @main_project.project_dir + @main_project.root_object.display_name
|
14
|
+
main_project_files = []
|
15
|
+
main_project_headers = []
|
16
|
+
Dir.glob(File.join(main_project_file_folder, '**', '*')).each do |file|
|
17
|
+
if File.file?(file) and (file.end_with?(".h") or file.end_with?(".m"))
|
18
|
+
if file.end_with?(".h")
|
19
|
+
main_project_headers << Pathname.new(file)
|
20
|
+
main_project_files << Pathname.new(file)
|
21
|
+
elsif file.end_with?(".m")
|
22
|
+
main_project_files << Pathname.new(file)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
puts "Start reair main project..."
|
27
|
+
main_project_files.each do |file_path|
|
28
|
+
repair_file(file_path, main_project_headers)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
@all_kz_pod_targets.values.each do |kz_pod_target|
|
33
|
+
next unless kz_pod_target.is_dev_pod
|
34
|
+
next unless @specify_pod_names.count > 0 && @specify_pod_names.include?(kz_pod_target.name)
|
35
|
+
|
36
|
+
need_repair_files = []
|
37
|
+
kz_pod_target.native_pod_target.file_accessors.each do |file_accessor|
|
38
|
+
next if file_accessor.spec.test_specification
|
39
|
+
|
40
|
+
file_accessor.source_files.each do |source_file|
|
41
|
+
if %w[.h .m .mm].include?(source_file.extname)
|
42
|
+
need_repair_files << source_file
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
puts "Start reair '#{kz_pod_target.name}' files..."
|
48
|
+
need_repair_files.each do |file_path|
|
49
|
+
repair_file(file_path, kz_pod_target.all_headers, kz_pod_target.recursive_dependent_targets)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def repair_file(file_path, current_module_headers, sub_pods = nil)
|
55
|
+
new_header_content = []
|
56
|
+
|
57
|
+
file = File.open(file_path)
|
58
|
+
contents = file.readlines
|
59
|
+
file.close
|
60
|
+
|
61
|
+
contents.each do |line|
|
62
|
+
if line =~ /#import\s*["<]([a-zA-Z\+]+\.h)[">]/
|
63
|
+
heaer_name = $1
|
64
|
+
other_module_name = find_other_module_name(heaer_name, current_module_headers, sub_pods)
|
65
|
+
if other_module_name
|
66
|
+
if other_module_name == ""
|
67
|
+
new_header_content << line
|
68
|
+
else
|
69
|
+
new_header_content << "#import <#{other_module_name}/#{heaer_name}>\n"
|
70
|
+
end
|
71
|
+
else
|
72
|
+
new_header_content << "#warning '#{heaer_name}' is not included in the current pod or its subpods\n"
|
73
|
+
new_header_content << line
|
74
|
+
end
|
75
|
+
else
|
76
|
+
new_header_content << line
|
77
|
+
end
|
78
|
+
end
|
79
|
+
write_swift_file(file_path, new_header_content)
|
80
|
+
end
|
81
|
+
|
82
|
+
def write_swift_file(file_path, contexts)
|
83
|
+
swift_file = File.open(file_path, 'w')
|
84
|
+
contexts.each do |new_line|
|
85
|
+
swift_file.write(new_line)
|
86
|
+
end
|
87
|
+
swift_file.close
|
88
|
+
end
|
89
|
+
|
90
|
+
def find_other_module_name(header_name, current_module_headers, sub_pods)
|
91
|
+
current_module_headers.each do |header_path|
|
92
|
+
if header_path.basename.to_s == header_name
|
93
|
+
return ""
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
if sub_pods == nil
|
98
|
+
sub_pods = @all_kz_pod_targets.values
|
99
|
+
end
|
100
|
+
sub_pods.each do |sub_kz_pod_target|
|
101
|
+
sub_headers = sub_kz_pod_target.all_headers
|
102
|
+
sub_headers.each do |header_path|
|
103
|
+
if header_path.basename.to_s == header_name
|
104
|
+
return sub_kz_pod_target.kz_module_name
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
return nil
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
@@ -3,23 +3,16 @@ require 'cocoapods-kz/native/acknowledgements'
|
|
3
3
|
module Pod
|
4
4
|
module Generator
|
5
5
|
class Acknowledgements
|
6
|
+
|
7
|
+
alias_method :origin_license_text, :license_text
|
6
8
|
def license_text(spec)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
text = IO.read(license_path)
|
14
|
-
else
|
15
|
-
# UI.warn "Unable to read the license file `#{license_file}` " \
|
16
|
-
# "for the spec `#{spec}`"
|
17
|
-
end
|
18
|
-
elsif license_file = file_accessor(spec).license
|
19
|
-
text = IO.read(license_file)
|
20
|
-
end
|
9
|
+
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
10
|
+
return nil unless spec.license
|
11
|
+
text = spec.license[:text]
|
12
|
+
text
|
13
|
+
else
|
14
|
+
origin_license_text(spec)
|
21
15
|
end
|
22
|
-
text
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require 'cocoapods-kz/helpers/
|
1
|
+
require 'cocoapods-kz/helpers/kz_global_helper'
|
2
|
+
require 'cocoapods-kz/helpers/kz_generator'
|
2
3
|
|
3
4
|
module Pod
|
4
5
|
class Installer
|
@@ -7,13 +8,13 @@ module Pod
|
|
7
8
|
|
8
9
|
def generate_targets(resolver_specs_by_target, target_inspections)
|
9
10
|
aggregate_targets, pod_targets = original_generate_targets(resolver_specs_by_target, target_inspections)
|
10
|
-
|
11
|
-
|
11
|
+
if KZ::KZGlobalHelper.instance.generate_kz_pod_targets
|
12
|
+
main_project = aggregate_targets.first.user_project
|
12
13
|
kz_analyer = KZ::KZAnalyzer.new(pod_targets, self.sandbox.development_pods)
|
13
14
|
kz_analyer.analyer
|
14
15
|
KZ::KZGlobalHelper.instance.kz_analyzer = kz_analyer
|
16
|
+
KZ::KZGlobalHelper.instance.kz_generator = KZ::KZGenerator.new(main_project)
|
15
17
|
end
|
16
|
-
|
17
18
|
[aggregate_targets, pod_targets]
|
18
19
|
end
|
19
20
|
|
@@ -8,7 +8,7 @@ module Pod
|
|
8
8
|
|
9
9
|
alias_method :origin_public_headers, :public_headers
|
10
10
|
def public_headers(include_frameworks = false)
|
11
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
11
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
12
12
|
[]
|
13
13
|
else
|
14
14
|
origin_public_headers(include_frameworks)
|
@@ -16,7 +16,7 @@ module Pod
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def project_headers
|
19
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
19
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
20
20
|
[]
|
21
21
|
else
|
22
22
|
project_header_files
|
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def private_headers
|
27
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
27
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
28
28
|
[]
|
29
29
|
else
|
30
30
|
private_header_files
|
@@ -33,7 +33,7 @@ module Pod
|
|
33
33
|
|
34
34
|
alias_method :origin_source_files, :source_files
|
35
35
|
def source_files
|
36
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
36
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
37
37
|
[]
|
38
38
|
else
|
39
39
|
origin_source_files
|
@@ -42,7 +42,7 @@ module Pod
|
|
42
42
|
|
43
43
|
alias_method :origin_arc_source_files, :arc_source_files
|
44
44
|
def arc_source_files
|
45
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
45
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
46
46
|
[]
|
47
47
|
else
|
48
48
|
origin_arc_source_files
|
@@ -51,7 +51,7 @@ module Pod
|
|
51
51
|
|
52
52
|
alias_method :origin_resource_bundles, :resource_bundles
|
53
53
|
def resource_bundles
|
54
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
54
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
55
55
|
{}
|
56
56
|
else
|
57
57
|
origin_resource_bundles
|
@@ -61,7 +61,7 @@ module Pod
|
|
61
61
|
alias_method :origin_resources, :resources
|
62
62
|
def resources
|
63
63
|
result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
64
|
-
if result
|
64
|
+
if !self.spec.test_specification && result
|
65
65
|
resources = origin_resources
|
66
66
|
resources.concat(result.get_bundle_paths)
|
67
67
|
resources
|
@@ -73,7 +73,7 @@ module Pod
|
|
73
73
|
alias_method :origin_vendored_frameworks, :vendored_frameworks
|
74
74
|
def vendored_frameworks
|
75
75
|
result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
76
|
-
if result
|
76
|
+
if !self.spec.test_specification && result
|
77
77
|
frameworks = origin_vendored_frameworks
|
78
78
|
frameworks.concat(result.get_framework_paths)
|
79
79
|
frameworks
|
@@ -82,6 +82,23 @@ module Pod
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
def kz_headers
|
86
|
+
extensions = HEADER_EXTENSIONS
|
87
|
+
origin_source_files.select { |f| extensions.include?(f.extname) }
|
88
|
+
end
|
89
|
+
|
90
|
+
def kz_public_headers
|
91
|
+
public_headers = public_header_files
|
92
|
+
project_headers = project_header_files
|
93
|
+
private_headers = private_header_files
|
94
|
+
if public_headers.nil? || public_headers.empty?
|
95
|
+
header_files = kz_headers
|
96
|
+
else
|
97
|
+
header_files = public_headers
|
98
|
+
end
|
99
|
+
header_files - project_headers - private_headers
|
100
|
+
end
|
101
|
+
|
85
102
|
end
|
86
103
|
end
|
87
104
|
end
|
@@ -1,35 +1,22 @@
|
|
1
1
|
require 'cocoapods/installer'
|
2
|
-
require 'cocoapods-kz/helpers/xml_build_config'
|
3
|
-
require 'cocoapods-kz/helpers/strip_framework_config'
|
4
|
-
require 'cocoapods-kz/helpers/build_framework_config'
|
5
|
-
require 'cocoapods-kz/helpers/create_hamp'
|
6
2
|
|
7
3
|
module Pod
|
8
4
|
class Installer
|
9
5
|
alias_method :original_integrate_user_project, :integrate_user_project
|
10
6
|
def integrate_user_project
|
11
7
|
original_integrate_user_project
|
12
|
-
|
13
8
|
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
puts 'Config Xml Build Rules'
|
18
|
-
KZ::XmlBuildConfig.new(main_project, pods_project).config_project
|
19
|
-
|
20
|
-
puts 'Config Framework Strip'
|
21
|
-
KZ::StripFrameworkConfig.new(main_project, pods_project).config_project
|
22
|
-
|
23
|
-
puts 'Config Framework Build'
|
24
|
-
KZ::BuildFrameworkConfig.new(main_project, pods_project).config_project
|
25
|
-
|
26
|
-
puts 'Config Hmap'
|
27
|
-
KZ::CreateHmap.new(main_project, pods_project).config_project
|
9
|
+
KZ::KZGlobalHelper.instance.write_lock_file
|
10
|
+
end
|
11
|
+
end
|
28
12
|
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
alias_method :original_integrate, :integrate
|
14
|
+
def integrate
|
15
|
+
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
16
|
+
# hmap的创建需要在download之后,integrate之前
|
17
|
+
KZ::KZGlobalHelper.instance.kz_generator.create_hamp
|
32
18
|
end
|
19
|
+
original_integrate
|
33
20
|
end
|
34
21
|
end
|
35
22
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class PodTarget < Target
|
4
|
+
|
5
|
+
def dependent_targets_by_config=(dependent_targets_by_config)
|
6
|
+
@dependent_targets_by_config = dependent_targets_by_config
|
7
|
+
@dependent_targets = dependent_targets_by_config.each_value.reduce([], &:|)
|
8
|
+
|
9
|
+
# 让@recursive_dependent_targets重新赋值
|
10
|
+
if defined?(@recursive_dependent_targets)
|
11
|
+
@recursive_dependent_targets = nil
|
12
|
+
remove_instance_variable(:@recursive_dependent_targets)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class Installer
|
4
|
+
class Xcode
|
5
|
+
class PodsProjectGenerator
|
6
|
+
|
7
|
+
class PodTargetInstaller < TargetInstaller
|
8
|
+
require 'cocoapods/installer/xcode/pods_project_generator/app_host_installer'
|
9
|
+
|
10
|
+
alias_method :origin_install!, :install!
|
11
|
+
def install!
|
12
|
+
target_installation_result = origin_install!
|
13
|
+
if KZ::KZGlobalHelper.instance.kz_pod_enable && self.target.should_build?
|
14
|
+
unless self.target.name.start_with?('Pods-')
|
15
|
+
KZ::KZGlobalHelper.instance.kz_generator.add_framework_generator_build_phase(target_installation_result.native_target)
|
16
|
+
end
|
17
|
+
|
18
|
+
kz_pod_target = self.target.weakRef_kz_pod_target
|
19
|
+
if kz_pod_target&.is_dev_pod
|
20
|
+
KZ::KZGlobalHelper.instance.kz_generator.add_flexlib_xml_build_rules(self.project, target_installation_result.native_target)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
target_installation_result
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class Target
|
4
|
+
attr_accessor :weakRef_kz_pod_target
|
5
|
+
|
6
|
+
alias_method :origin_product_basename, :product_basename
|
7
|
+
def product_basename
|
8
|
+
if self.weakRef_kz_pod_target
|
9
|
+
self.weakRef_kz_pod_target.product_basename
|
10
|
+
else
|
11
|
+
origin_product_basename
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def framework_name
|
17
|
+
if self.weakRef_kz_pod_target
|
18
|
+
self.weakRef_kz_pod_target.product_name
|
19
|
+
else
|
20
|
+
"#{product_module_name}.framework"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
alias_method :origin_product_name, :product_name
|
25
|
+
def product_name
|
26
|
+
if self.weakRef_kz_pod_target
|
27
|
+
self.weakRef_kz_pod_target.product_name
|
28
|
+
else
|
29
|
+
origin_product_name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'cocoapods-kz/helpers/kz_global_helper'
|
2
|
+
require 'cocoapods-kz/helpers/kz_pod_target'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Installer
|
6
|
+
class Xcode
|
7
|
+
class PodsProjectGenerator
|
8
|
+
module TargetInstallerHelper
|
9
|
+
|
10
|
+
alias_method :origin_update_changed_file, :update_changed_file
|
11
|
+
def update_changed_file(generator, path)
|
12
|
+
unless KZ::KZGlobalHelper.instance.kz_pod_enable
|
13
|
+
origin_update_changed_file(generator, path)
|
14
|
+
return
|
15
|
+
end
|
16
|
+
|
17
|
+
if generator.is_a?(Pod::Target::BuildSettings::AggregateTargetSettings)
|
18
|
+
xcconfig = generator.xcconfig
|
19
|
+
kz_clean_xcconfig(xcconfig)
|
20
|
+
main_hamp_search_path = '"' + KZ::KZ_POD_CONFIG_ROOT_STR + "/#{self.target.user_project.root_object.display_name}.hmap" + '"'
|
21
|
+
self.target.pod_targets.each do |native_pod_target|
|
22
|
+
kz_pod_target = native_pod_target.weakRef_kz_pod_target
|
23
|
+
if kz_pod_target
|
24
|
+
if kz_pod_target.repair_header_search_path
|
25
|
+
main_hamp_search_path += (' ' + KZ.deal_path_for_xcconfig(kz_pod_target.repair_header_search_path, true))
|
26
|
+
end
|
27
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
xcconfig.attributes['HEADER_SEARCH_PATHS'] = main_hamp_search_path
|
31
|
+
xcconfig.attributes['USE_HEADERMAP'] = 'NO'
|
32
|
+
|
33
|
+
kz_update_xcconfig_file(xcconfig, path)
|
34
|
+
elsif generator.is_a?(Pod::Target::BuildSettings::PodTargetSettings)
|
35
|
+
kz_pod_target = self.target.weakRef_kz_pod_target
|
36
|
+
if kz_pod_target
|
37
|
+
xcconfig = generator.xcconfig
|
38
|
+
xcconfig.attributes['HEADER_SEARCH_PATHS'] = kz_pod_target.header_search_paths
|
39
|
+
xcconfig.attributes['USE_HEADERMAP'] = 'NO'
|
40
|
+
framework_cache_path = KZ.deal_path_for_xcconfig(kz_pod_target.pod_config_cache_path(true))
|
41
|
+
xcconfig.attributes['KZ_FRAMEWORK_CACHE_PATH'] = framework_cache_path
|
42
|
+
|
43
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
44
|
+
kz_update_xcconfig_file(xcconfig, path)
|
45
|
+
else
|
46
|
+
origin_update_changed_file(generator, path)
|
47
|
+
end
|
48
|
+
else
|
49
|
+
origin_update_changed_file(generator, path)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_repair_modulemap(xcconfig, repair_modulemap_paths)
|
54
|
+
if repair_modulemap_paths.count > 0
|
55
|
+
repair_modulemap_paths.each do |repair_modulemap_path|
|
56
|
+
fmodule_map = ' -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
57
|
+
unless xcconfig.attributes['OTHER_CFLAGS'].include?(fmodule_map)
|
58
|
+
xcconfig.attributes['OTHER_CFLAGS'] += fmodule_map
|
59
|
+
end
|
60
|
+
xfmodule_map = ' -Xcc -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
61
|
+
unless xcconfig.attributes['OTHER_SWIFT_FLAGS'].include?(xfmodule_map)
|
62
|
+
xcconfig.attributes['OTHER_SWIFT_FLAGS'] += xfmodule_map
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def kz_update_xcconfig_file(xcconfig, path)
|
70
|
+
if path.exist?
|
71
|
+
contents = xcconfig.to_s
|
72
|
+
content_stream = StringIO.new(contents)
|
73
|
+
identical = File.open(path, 'rb') { |f| FileUtils.compare_stream(f, content_stream) }
|
74
|
+
return if identical
|
75
|
+
|
76
|
+
File.open(path, 'w') { |f| f.write(contents) }
|
77
|
+
else
|
78
|
+
path.dirname.mkpath
|
79
|
+
xcconfig.save_as(path)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def kz_clean_xcconfig(xcconfig)
|
84
|
+
other_cflags = xcconfig.attributes['OTHER_CFLAGS']
|
85
|
+
flags = other_cflags.split(' ')
|
86
|
+
new_flags = []
|
87
|
+
appear_delete_tag = false
|
88
|
+
flags.each do |flag|
|
89
|
+
if flag.include?('isystem') || flag.include?('iframework')
|
90
|
+
appear_delete_tag = true
|
91
|
+
else
|
92
|
+
unless appear_delete_tag || new_flags.include?(flag)
|
93
|
+
new_flags << flag
|
94
|
+
end
|
95
|
+
appear_delete_tag = false
|
96
|
+
end
|
97
|
+
end
|
98
|
+
xcconfig.attributes['OTHER_CFLAGS'] = new_flags.join(' ')
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/lib/cocoapods-kz/native.rb
CHANGED
@@ -7,5 +7,8 @@ if Pod.match_version?('~> 1.4')
|
|
7
7
|
require 'cocoapods-kz/native/acknowledgements'
|
8
8
|
require 'cocoapods-kz/native/analyzer'
|
9
9
|
require 'cocoapods-kz/native/file_accessor'
|
10
|
-
require 'cocoapods-kz/native/
|
10
|
+
require 'cocoapods-kz/native/target'
|
11
|
+
require 'cocoapods-kz/native/target_installer_helper'
|
12
|
+
require 'cocoapods-kz/native/pod_target'
|
13
|
+
require 'cocoapods-kz/native/pod_target_installer'
|
11
14
|
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.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yixiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: Kanzhun's cocoapods manage tools.
|
42
42
|
email:
|
43
43
|
- yixiong@kanzhun.com
|
44
44
|
executables: []
|
@@ -49,24 +49,27 @@ files:
|
|
49
49
|
- lib/cocoapods-kz/command.rb
|
50
50
|
- lib/cocoapods-kz/command/install.rb
|
51
51
|
- lib/cocoapods-kz/command/kz.rb
|
52
|
+
- lib/cocoapods-kz/command/repair.rb
|
52
53
|
- lib/cocoapods-kz/command/update.rb
|
53
54
|
- lib/cocoapods-kz/gem_version.rb
|
54
|
-
- lib/cocoapods-kz/helpers/build_framework_config.rb
|
55
|
-
- lib/cocoapods-kz/helpers/create_hamp.rb
|
56
|
-
- lib/cocoapods-kz/helpers/global_helper.rb
|
57
55
|
- lib/cocoapods-kz/helpers/kz_analyzer.rb
|
58
56
|
- lib/cocoapods-kz/helpers/kz_config_result.rb
|
59
57
|
- lib/cocoapods-kz/helpers/kz_framework_manager.rb
|
58
|
+
- lib/cocoapods-kz/helpers/kz_generator.rb
|
59
|
+
- lib/cocoapods-kz/helpers/kz_global_helper.rb
|
60
60
|
- lib/cocoapods-kz/helpers/kz_pod_target.rb
|
61
|
-
- lib/cocoapods-kz/helpers/
|
62
|
-
- lib/cocoapods-kz/helpers/
|
61
|
+
- lib/cocoapods-kz/helpers/repair_dynamic_swift.rb
|
62
|
+
- lib/cocoapods-kz/helpers/repair_module_import.rb
|
63
63
|
- lib/cocoapods-kz/native.rb
|
64
64
|
- lib/cocoapods-kz/native/acknowledgements.rb
|
65
65
|
- lib/cocoapods-kz/native/analyzer.rb
|
66
66
|
- lib/cocoapods-kz/native/dls.rb
|
67
67
|
- lib/cocoapods-kz/native/file_accessor.rb
|
68
68
|
- lib/cocoapods-kz/native/installer.rb
|
69
|
-
- lib/cocoapods-kz/native/
|
69
|
+
- lib/cocoapods-kz/native/pod_target.rb
|
70
|
+
- lib/cocoapods-kz/native/pod_target_installer.rb
|
71
|
+
- lib/cocoapods-kz/native/target.rb
|
72
|
+
- lib/cocoapods-kz/native/target_installer_helper.rb
|
70
73
|
- lib/cocoapods-kz/resources/FlexCompiler
|
71
74
|
- lib/cocoapods-kz/resources/hmap
|
72
75
|
- lib/cocoapods_plugin.rb
|
@@ -92,5 +95,5 @@ requirements: []
|
|
92
95
|
rubygems_version: 3.4.13
|
93
96
|
signing_key:
|
94
97
|
specification_version: 4
|
95
|
-
summary:
|
98
|
+
summary: Kanzhun's cocoapods manage tools.
|
96
99
|
test_files: []
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module KZ
|
2
|
-
class BuildFrameworkConfig
|
3
|
-
|
4
|
-
def initialize(main_project, pod_project)
|
5
|
-
@pod_project = pod_project
|
6
|
-
end
|
7
|
-
|
8
|
-
def config_project
|
9
|
-
@pod_project.targets.each do |target|
|
10
|
-
if target.isa == "PBXNativeTarget" && target.product_type == "com.apple.product-type.framework"
|
11
|
-
generate_framework_script = target.new_shell_script_build_phase('[KZ] Generate Framework')
|
12
|
-
generate_framework_script.show_env_vars_in_log = '0'
|
13
|
-
generate_framework_script.always_out_of_date = '1'
|
14
|
-
generate_framework_script.shell_script = %q{
|
15
|
-
if [ "${MACH_O_TYPE}" != "staticlib" ]; then
|
16
|
-
exit 0
|
17
|
-
fi
|
18
|
-
|
19
|
-
if [ "${ACTION}" != "build" ]; then
|
20
|
-
exit 0
|
21
|
-
fi
|
22
|
-
|
23
|
-
PRODUCT_DIR=${PODS_BUILD_DIR}/Debug-iphoneos/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
24
|
-
PRODUCT_SIMULATOR_DIR=${PODS_BUILD_DIR}/Debug-iphonesimulator/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
25
|
-
CURRENT_PRODUCT_DIR=${PODS_CONFIGURATION_BUILD_DIR}/${TARGET_NAME}
|
26
|
-
|
27
|
-
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}" ]; then
|
28
|
-
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}"
|
29
|
-
fi
|
30
|
-
cp -r ${CURRENT_PRODUCT_DIR}/${FULL_PRODUCT_NAME} "${KZ_FRAMEWORK_CACHE_PATH}"
|
31
|
-
|
32
|
-
find "${CURRENT_PRODUCT_DIR}" -iname "*.bundle" -type d | while read -r BUNDLE_FILE; do
|
33
|
-
BUNDLE_NAME=$(basename ${BUNDLE_FILE})
|
34
|
-
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}" ]; then
|
35
|
-
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}"
|
36
|
-
fi
|
37
|
-
cp -r ${BUNDLE_FILE} "${KZ_FRAMEWORK_CACHE_PATH}"
|
38
|
-
done
|
39
|
-
|
40
|
-
if [ -f ${PRODUCT_DIR}/${PRODUCT_NAME} ] && [ -f ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} ]; then
|
41
|
-
lipo -create ${PRODUCT_DIR}/${PRODUCT_NAME} ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} -output "${KZ_FRAMEWORK_CACHE_PATH}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
|
42
|
-
fi
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|