podfileDep 2.7.6 → 3.0.0
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 +4 -4
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/cocoapods_plugin.rb +15 -10
- data/lib/{podfileDep → core_blur}/check/import.rb +1 -20
- data/lib/{podfileDep → core_blur}/check/item.rb +1 -64
- data/lib/{podfileDep → core_blur}/check/podspec.rb +1 -54
- data/lib/{podfileDep → core_blur}/check/project.rb +1 -73
- data/lib/{podfileDep → core_blur}/check/util.rb +1 -13
- data/lib/{podfileDep → core_blur}/check/xcodeproj.rb +1 -28
- data/lib/{podfileDep → core_blur}/command/all.rb +1 -8
- data/lib/{podfileDep → core_blur}/command/dep.rb +4 -9
- data/lib/{podfileDep → core_blur}/command/quick.rb +1 -8
- data/lib/{podfileDep → core_blur}/dep/find.rb +9 -48
- data/lib/{podfileDep → core_blur}/indirect/indirect.rb +1 -9
- data/lib/{podfileDep → core_blur}/modify/modify_code.rb +1 -10
- data/lib/{podfileDep → core_blur}/my_constants.rb +0 -3
- data/lib/{podfileDep → core_blur}/podfilelock.rb +1 -5
- data/lib/{podfileDep → core_blur}/reference/project.rb +1 -26
- data/lib/{podfileDep → core_blur}/reference/unused.rb +1 -8
- data/lib/{podfileDep → core_blur}/thin/installer.rb +1 -49
- data/lib/{podfileDep → core_blur}/thin/local.rb +1 -14
- data/lib/{podfileDep → core_blur}/thin/pod_target.rb +1 -13
- data/lib/{podfileDep → core_blur}/thin/shell.rb +1 -43
- data/lib/core_blur/variable.rb +1 -0
- data/lib/{podfileDep → core_blur}/yaml/yaml_dep.rb +2 -116
- data/lib/{podfileDep → core_blur}/yaml/yaml_pod.rb +1 -6
- data/lib/core_helper.rb +20 -0
- data/lib/podfileDep.rb +8 -21
- data/lib/{podfileDep/version.rb → version.rb} +1 -1
- metadata +34 -40
- data/CHANGELOG.md +0 -175
- data/Gemfile +0 -8
- data/README.md +0 -33
- data/Rakefile +0 -4
- data/docs/Gemfile +0 -9
- data/docs/debug/347/233/256/345/275/225.png +0 -0
- data/docs/debug/351/205/215/347/275/256.png +0 -0
- data/lib/podfileDep/variable.rb +0 -2
- data/podfileDep.gemspec +0 -45
- data/release.sh +0 -6
@@ -1,13 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module MyConstants
|
3
|
-
|
4
3
|
PODFILE_LOCAL_YAML = 'PodfileLocal.yaml'
|
5
4
|
PODFILE_MODULE_YAML = 'PodfileModule.yaml'
|
6
5
|
PODFILE_THIRD_PARTY_YAML = 'PodfileThirdParty.yaml'
|
7
6
|
PODFILE_LOCK = 'Podfile.lock'
|
8
7
|
PODFILE = 'Podfile'
|
9
|
-
|
10
8
|
LIBLIBARYS = %w[time removefile AppleTextureEncoder standards AvailabilityMacros semaphore SystemHealthClient dns_sd ftw checkint pwd bitstring utime err CommonCrypto inttypes resolv c++ _ctermid stdlib sysdir unwind fts vis AvailabilityVersions membership libxml2 ulimit _stdio ntsid net notify_keys CMakeLists.txt AssertMacros float aio libxml ConditionalMacros locale fmtmsg unicode _wctype cpio langinfo xlocale limits Endian unwind_itanium _types db bank _ctype unistd stddef dispatch wctype fcntl mach_debug Availability stringlist tar readpassphrase _locale ttyent bzlib cache signal dirent mpool libDER unwind_arm_ehabi spawn crt_externs simd regex AvailabilityInternal arpa syslog bsm netinet libunwind libgen corpses rpcsvc monetary compression expat_external setjmp tgmath notify getopt _regex dlfcn strings TargetConditionals fnmatch pthread xlocale execinfo networkext printf architecture alloca sys iconv fenv expat grp secure ctype fstab pthread_spis machine SystemHealthManager voucher wordexp zlib nl_types paths AppleEXR wchar sqlite3 util gethostuuid sched sqlite3ext iso646 Block netdb pthread math memory asl __wctype mach errno device termios copyfile os xattr_flags poll _xlocale stdio mach-o malloc string_x86 arm Spatial __libunwind_config nameser dns _types rpc netinet6 pthread_impl objc MacTypes libkern uuid search assert AppleArchive cache_callbacks dns_util glob ifaddrs utmpx sandbox arm64 stdint complex runetype zconf ucontext sysexits string ndbm]
|
11
9
|
FRAMEWORKS = %w[MetricKit Network GameKit AddressBookUI CreateML Speech SafariServices ProximityReader Metal AppClip QuartzCore CoreGraphics StoreKit GSS CoreML WatchConnectivity UserNotificationsUI ARKit CoreLocationUI MetalPerformanceShaders AutomaticAssessmentConfiguration ExternalAccessory MediaPlayer LinkPresentation IdentityLookupUI MediaToolbox UIKit MessageUI MetalFX CoreNFC HomeKit CryptoKit ScreenTime NewsstandKit MLCompute NaturalLanguage CoreVideo MetalKit OSLog PDFKit CoreText UniformTypeIdentifiers IOKit ManagedSettings AVFoundation Accelerate DeviceCheck ImageIO BackgroundTasks FamilyControls ClockKit CoreBluetooth ThreadNetwork SensorKit Security Contacts CarPlay ExtensionFoundation RealityKit PhotosUI RoomPlan ReplayKit IOSurface SpriteKit MobileCoreServices IntentsUI QuickLookThumbnailing CoreMedia BusinessChat Intents ColorSync VideoSubscriberAccount PencilKit ManagedSettingsUI CoreServices HealthKit MultipeerConnectivity BackgroundAssets WebKit NotificationCenter SystemConfiguration GameController CoreTelephony ActivityKit AVFAudio AssetsLibrary AudioUnit FileProvider DeviceActivity Social IdentityLookup Matter CoreImage CoreAudio MusicKit DeviceDiscoveryExtension MediaSetup AutomatedDeviceEnrollment CoreAudioKit ExposureNotification ClassKit VisionKit SwiftUI Combine ModelIO PHASE SharedWithYou OpenGLES MetalPerformanceShadersGraph CreateMLComponents Accounts FileProviderUI ShazamKit CarKey RealityFoundation QuickLook AppIntents AuthenticationServices WeatherKit DataDetection AudioToolbox NearbyInteraction ContactsUI CoreSpotlight LocalAuthentication MatterSupport Foundation AdSupport LocalAuthenticationEmbeddedUI Accessibility HealthKitUI PushKit Vision CoreAudioTypes NetworkExtension ExtensionKit OpenAL EventKit MediaAccessibility Charts iAd MapKit AppTrackingTransparency CoreHaptics CallKit CoreFoundation TabularData CoreMotion AVRouting WidgetKit AVKit AddressBook SoundAnalysis GroupActivities CoreLocation CloudKit SharedWithYouCore CFNetwork Photos JavaScriptCore GameplayKit PushToTalk CoreMIDI Twitter PassKit ImageCaptureCore CoreData GLKit AdServices Messages CryptoTokenKit VideoToolbox SafetyKit UserNotifications DeveloperToolsSupport CoreTransferable EventKitUI SceneKit]
|
12
|
-
|
13
10
|
end
|
@@ -1,17 +1,13 @@
|
|
1
1
|
require_relative 'my_constants'
|
2
2
|
require 'yaml'
|
3
|
-
|
4
3
|
module PodfileLock
|
5
4
|
class PodfileLockManager
|
6
|
-
# 读取podfile.lock
|
7
5
|
def self.podfile_lock_content
|
8
6
|
podfile_lock = MyConstants::PODFILE_LOCK
|
9
|
-
|
10
7
|
unless File.exist?(podfile_lock)
|
11
8
|
return {}
|
12
9
|
end
|
13
|
-
|
14
10
|
YAML.load_file(podfile_lock)
|
15
11
|
end
|
16
12
|
end
|
17
|
-
end
|
13
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require_relative '../check/xcodeproj'
|
2
2
|
require_relative '../my_constants'
|
3
|
-
|
4
3
|
module Project
|
5
4
|
class ProjectManager
|
6
5
|
def self.yaml_resource
|
@@ -14,13 +13,10 @@ module Project
|
|
14
13
|
self.yaml_resource_file(resource_shell_path)
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
18
16
|
def self.yaml_resource_file(file_path)
|
19
17
|
unless File.exist?(file_path)
|
20
18
|
return
|
21
19
|
end
|
22
|
-
|
23
|
-
# 读内容
|
24
20
|
content = ""
|
25
21
|
line_array = IO.readlines(file_path)
|
26
22
|
line_array.each_with_index { |line, index|
|
@@ -30,71 +26,51 @@ module Project
|
|
30
26
|
if File.exist?(MyConstants::PODFILE_LOCAL_YAML)
|
31
27
|
content += " install_resource \"${SRCROOT}/#{MyConstants::PODFILE_LOCAL_YAML}\"\n"
|
32
28
|
end
|
33
|
-
|
34
29
|
if File.exist?(MyConstants::PODFILE_MODULE_YAML)
|
35
30
|
content += " install_resource \"${SRCROOT}/#{MyConstants::PODFILE_MODULE_YAML}\"\n"
|
36
31
|
end
|
37
|
-
|
38
32
|
if File.exist?(MyConstants::PODFILE_THIRD_PARTY_YAML)
|
39
33
|
content += " install_resource \"${SRCROOT}/#{MyConstants::PODFILE_THIRD_PARTY_YAML}\"\n"
|
40
34
|
end
|
41
35
|
end
|
42
36
|
}
|
43
|
-
|
44
|
-
# 写文件
|
45
37
|
File.open(file_path, 'w') { |file|
|
46
38
|
file.write(content)
|
47
39
|
}
|
48
40
|
end
|
49
|
-
|
50
|
-
|
51
|
-
# 将yaml文件加入引用
|
52
41
|
def self.yaml_reference
|
53
42
|
puts "yaml文件引用添加"
|
54
43
|
self.add_yaml
|
55
44
|
self.add_local_yaml_ignore
|
56
45
|
end
|
57
|
-
|
58
46
|
def self.add_yaml
|
59
|
-
|
60
47
|
podfile_local_yaml = MyConstants::PODFILE_LOCAL_YAML
|
61
48
|
podfile_module_yaml = MyConstants::PODFILE_MODULE_YAML
|
62
49
|
podfile_third_party_yaml = MyConstants::PODFILE_THIRD_PARTY_YAML
|
63
|
-
|
64
50
|
project_manager = XCProject::XcodeprojManager.share_manager
|
65
51
|
pods_project = project_manager.get_pods_project
|
66
|
-
|
67
52
|
did_add = []
|
68
|
-
|
69
53
|
pods_project.main_group.children.each {|child|
|
70
54
|
did_add << child.display_name
|
71
55
|
}
|
72
|
-
|
73
56
|
unless did_add.include?(podfile_local_yaml)
|
74
57
|
path = "#{Dir.pwd}/#{podfile_local_yaml}"
|
75
58
|
pods_project.new_file(path)
|
76
59
|
end
|
77
|
-
|
78
60
|
unless did_add.include?(podfile_module_yaml)
|
79
61
|
path = "#{Dir.pwd}/#{podfile_module_yaml}"
|
80
62
|
pods_project.new_file(path)
|
81
63
|
end
|
82
|
-
|
83
64
|
unless did_add.include?(podfile_third_party_yaml)
|
84
65
|
path = "#{Dir.pwd}/#{podfile_third_party_yaml}"
|
85
66
|
pods_project.new_file(path)
|
86
67
|
end
|
87
|
-
|
88
68
|
pods_project.sort(:groups_position => :below)
|
89
69
|
pods_project.save
|
90
70
|
end
|
91
|
-
|
92
|
-
# 把local.yaml添加到忽略文件中
|
93
71
|
def self.add_local_yaml_ignore
|
94
|
-
|
95
72
|
gitignore = ".gitignore"
|
96
73
|
podfile_local_yaml = MyConstants::PODFILE_LOCAL_YAML
|
97
|
-
|
98
74
|
contain = false
|
99
75
|
gitignore_path= "#{Dir.pwd}/#{gitignore}"
|
100
76
|
if File.exist?(gitignore_path)
|
@@ -107,7 +83,6 @@ module Project
|
|
107
83
|
end
|
108
84
|
end
|
109
85
|
end
|
110
|
-
|
111
86
|
unless contain
|
112
87
|
File.open(gitignore_path, 'a+') { |file|
|
113
88
|
file.write(podfile_local_yaml)
|
@@ -115,4 +90,4 @@ module Project
|
|
115
90
|
end
|
116
91
|
end
|
117
92
|
end
|
118
|
-
end
|
93
|
+
end
|
@@ -1,15 +1,10 @@
|
|
1
1
|
require 'colored2'
|
2
2
|
require_relative '../my_constants'
|
3
3
|
require_relative '../yaml/yaml_dep'
|
4
|
-
|
5
4
|
module Unused
|
6
5
|
class UnusedManager
|
7
|
-
|
8
|
-
# 打印未被引用的依赖库
|
9
6
|
def self.check_unused
|
10
|
-
|
11
7
|
yaml_dep = Pod::YamlDep.new
|
12
|
-
|
13
8
|
if yaml_dep.quick_build
|
14
9
|
msg = "💚当前已开启编译优化选项,请关注上方日志 '下载依赖...'部分内容。"
|
15
10
|
msg += "\n #{MyConstants::PODFILE_LOCAL_YAML}文件内的依赖库,将不会被优化忽略掉。如需关闭优化,有2种方式任选其一"
|
@@ -22,8 +17,6 @@ module Unused
|
|
22
17
|
msg += "\n2. 执行 pod install quick 可单次开启"
|
23
18
|
puts msg.yellow
|
24
19
|
end
|
25
|
-
|
26
20
|
end
|
27
|
-
|
28
21
|
end
|
29
|
-
end
|
22
|
+
end
|
@@ -3,31 +3,19 @@ require 'yaml'
|
|
3
3
|
require_relative 'shell'
|
4
4
|
require_relative 'local'
|
5
5
|
require_relative 'pod_target'
|
6
|
-
|
7
6
|
module Pod
|
8
7
|
class Installer
|
9
|
-
|
10
|
-
# @return [Hash{String, Pod:Target}] 所有的pod库被使用的次数
|
11
8
|
attr_accessor :thin_pods
|
12
|
-
|
13
|
-
# @return [String] 未被使用的pod库列表
|
14
9
|
attr_accessor :thin_unused_pods
|
15
|
-
|
16
|
-
|
17
10
|
def download_dependencies
|
18
11
|
UI.section '下载依赖...' do
|
19
|
-
|
20
12
|
thin_pod_unused #自定义
|
21
13
|
thin_delete_pods_unused #自定义
|
22
|
-
|
23
14
|
install_pod_sources
|
24
15
|
run_podfile_pre_install_hooks
|
25
16
|
clean_pod_sources
|
26
17
|
end
|
27
18
|
end
|
28
|
-
|
29
|
-
# 删除未被使用的依赖
|
30
|
-
# @return nil
|
31
19
|
def thin_pod_unused
|
32
20
|
@thin_pods = Hash.new
|
33
21
|
thin_all_deps_pods_targets
|
@@ -35,45 +23,30 @@ module Pod
|
|
35
23
|
thin_all_deps_local_yaml
|
36
24
|
thin_unused_deps
|
37
25
|
end
|
38
|
-
|
39
|
-
# 获取未被使用到的依赖库
|
40
|
-
# @return thin_unused_pods
|
41
26
|
def thin_unused_deps
|
42
27
|
thin_unused_pods = []
|
43
28
|
thin_pods.each do |name, pod_target|
|
44
29
|
pod_target.reduce_reference_count
|
45
30
|
end
|
46
|
-
|
47
31
|
thin_pods.each do |name, pod_target|
|
48
32
|
if pod_target.reference_count <= 0
|
49
33
|
thin_unused_pods << name
|
50
34
|
end
|
51
35
|
end
|
52
|
-
|
53
36
|
@thin_unused_pods = thin_unused_pods
|
54
37
|
end
|
55
|
-
|
56
|
-
# 获取在pods_targets使用的依赖库
|
57
|
-
# @return thin_pods
|
58
38
|
def thin_all_deps_pods_targets
|
59
|
-
|
60
39
|
pod_targets = analysis_result.pod_targets
|
61
|
-
|
62
40
|
pod_targets.each do |pod_target|
|
63
41
|
thin_pods[pod_target.to_s] = pod_target
|
64
42
|
end
|
65
|
-
|
66
43
|
pod_targets.each do |pod_target|
|
67
44
|
pod_target.dependent_targets.each do|sub_pod_target|
|
68
45
|
thin_update_reference_count(sub_pod_target)
|
69
46
|
end
|
70
47
|
end
|
71
|
-
|
72
48
|
thin_pods
|
73
49
|
end
|
74
|
-
|
75
|
-
# 递归更新引用计数
|
76
|
-
# @return nil
|
77
50
|
def thin_update_reference_count(pod_target)
|
78
51
|
pod = thin_pods[pod_target.to_s]
|
79
52
|
pod.reference_count += 1
|
@@ -81,12 +54,8 @@ module Pod
|
|
81
54
|
thin_update_reference_count(sub_pod_target)
|
82
55
|
end
|
83
56
|
end
|
84
|
-
|
85
|
-
# 获取在壳工程里使用的依赖库
|
86
|
-
# @return thin_pods
|
87
57
|
def thin_all_deps_shell_targets
|
88
58
|
shell = Shell.new
|
89
|
-
|
90
59
|
shell.deps_shell.each { |shell_pod|
|
91
60
|
if thin_pods.has_key?(shell_pod)
|
92
61
|
thin_pods[shell_pod].max_reference_count
|
@@ -94,9 +63,6 @@ module Pod
|
|
94
63
|
}
|
95
64
|
thin_pods
|
96
65
|
end
|
97
|
-
|
98
|
-
# 获取在local_yaml里使用的依赖库
|
99
|
-
# @return thin_pods
|
100
66
|
def thin_all_deps_local_yaml
|
101
67
|
local = Local.new
|
102
68
|
local.deps_yaml.each do |yaml_pod|
|
@@ -104,44 +70,31 @@ module Pod
|
|
104
70
|
thin_pods[yaml_pod].max_reference_count
|
105
71
|
end
|
106
72
|
end
|
107
|
-
|
108
73
|
thin_pods
|
109
74
|
end
|
110
|
-
|
111
|
-
# 删除某些依赖库
|
112
|
-
# @return nil
|
113
75
|
def thin_delete_pods_unused
|
114
76
|
if thin_unused_pods.empty?
|
115
77
|
return
|
116
78
|
end
|
117
|
-
|
118
79
|
thin_unused_pods.each do |unused_pod|
|
119
80
|
title_options = { :verbose_prefix => '-> '.red }
|
120
81
|
UI.titled_section("忽略安装 #{unused_pod}".red, title_options) do
|
121
82
|
thin_delete_pod(unused_pod)
|
122
83
|
end
|
123
84
|
end
|
124
|
-
|
125
85
|
end
|
126
|
-
|
127
|
-
# 删除某个依赖库
|
128
|
-
# @param unused_pod: String 依赖库名字
|
129
|
-
# @return nil
|
130
86
|
def thin_delete_pod(unused_pod)
|
131
87
|
sandbox_state.added.delete(unused_pod)
|
132
88
|
sandbox_state.changed.delete(unused_pod)
|
133
89
|
sandbox_state.unchanged.delete(unused_pod)
|
134
|
-
|
135
90
|
pod_targets.delete_if { |pod_target|
|
136
91
|
pod_target.to_s == unused_pod
|
137
92
|
}
|
138
|
-
|
139
93
|
aggregate_targets.each { |aggregate_target|
|
140
94
|
aggregate_target.pod_targets.delete_if { |pod_target|
|
141
95
|
pod_target.to_s == unused_pod
|
142
96
|
}
|
143
97
|
}
|
144
|
-
|
145
98
|
aggregate_targets.each do |aggregate_target|
|
146
99
|
aggregate_target.user_build_configurations.each_key do |config|
|
147
100
|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
|
@@ -150,7 +103,6 @@ module Pod
|
|
150
103
|
}
|
151
104
|
end
|
152
105
|
end
|
153
|
-
|
154
106
|
analysis_result.specifications.delete_if { |specification|
|
155
107
|
real_specification = specification.to_s.split(" (")[0]
|
156
108
|
real_pod = real_specification.split("/")[0]
|
@@ -158,4 +110,4 @@ module Pod
|
|
158
110
|
}
|
159
111
|
end
|
160
112
|
end
|
161
|
-
end
|
113
|
+
end
|
@@ -1,31 +1,19 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require_relative '../yaml/yaml_dep'
|
3
|
-
|
4
3
|
module Pod
|
5
4
|
class Local
|
6
|
-
|
7
5
|
def initialize
|
8
6
|
super
|
9
7
|
@reference_pods = []
|
10
8
|
end
|
11
|
-
|
12
|
-
# PODFILE_LOCAL_YAML指定的依赖库
|
13
|
-
# @return [String]
|
14
9
|
attr_accessor :reference_pods
|
15
|
-
|
16
10
|
def deps_yaml
|
17
|
-
|
18
11
|
yaml_dep = YamlDep.new
|
19
|
-
|
20
12
|
yaml_dep.generate_yaml
|
21
|
-
|
22
13
|
podfile_local_yaml = yaml_dep.podfile_local_yaml
|
23
14
|
yaml_dep.read_yaml_deps_file(podfile_local_yaml)
|
24
|
-
|
25
15
|
yaml_dependencies = yaml_dep.yaml_deps[podfile_local_yaml]
|
26
|
-
|
27
16
|
if yaml_dependencies
|
28
|
-
# 处理烦人的子模块
|
29
17
|
yaml_dependencies.keys.each do |pod|
|
30
18
|
real_pod = pod.split("/")[0]
|
31
19
|
unless reference_pods.include?(real_pod)
|
@@ -33,8 +21,7 @@ module Pod
|
|
33
21
|
end
|
34
22
|
end
|
35
23
|
end
|
36
|
-
|
37
24
|
reference_pods
|
38
25
|
end
|
39
26
|
end
|
40
|
-
end
|
27
|
+
end
|
@@ -1,32 +1,20 @@
|
|
1
1
|
module Pod
|
2
2
|
class PodTarget < Target
|
3
|
-
|
4
|
-
# 被引用的次数
|
5
|
-
# @return Int
|
6
3
|
attr_accessor :reference_count
|
7
|
-
|
8
|
-
# 引用计数最大
|
9
4
|
def max_reference_count
|
10
5
|
self.reference_count = 99999
|
11
6
|
self.dependent_targets.each do |dep|
|
12
7
|
dep.max_reference_count
|
13
8
|
end
|
14
9
|
end
|
15
|
-
|
16
|
-
# 引用计数减1
|
17
10
|
def reduce_reference_count
|
18
11
|
self.reference_count -= 1
|
19
|
-
|
20
12
|
self.dependent_targets.each do |dep|
|
21
13
|
dep.reduce_reference_count
|
22
14
|
end
|
23
15
|
end
|
24
|
-
|
25
|
-
# 获取引用计数
|
26
|
-
# @return Int
|
27
16
|
def reference_count
|
28
17
|
@reference_count ? @reference_count : 0
|
29
18
|
end
|
30
|
-
|
31
19
|
end
|
32
|
-
end
|
20
|
+
end
|
@@ -1,43 +1,23 @@
|
|
1
1
|
require 'xcodeproj'
|
2
2
|
require 'pathname'
|
3
|
-
|
4
3
|
module Pod
|
5
4
|
class Shell
|
6
|
-
|
7
5
|
def initialize
|
8
6
|
super
|
9
7
|
@reference_files = []
|
10
8
|
@reference_pods = []
|
11
9
|
end
|
12
|
-
|
13
|
-
# 壳工程project对象
|
14
|
-
# @return Xcodeproj::Project
|
15
10
|
attr_accessor :project_shell
|
16
|
-
|
17
|
-
# 壳工程引用的文件列表
|
18
|
-
# @return [Pathname]
|
19
11
|
attr_accessor :reference_files
|
20
|
-
|
21
|
-
# 壳工程引用的依赖库
|
22
|
-
# @return [String]
|
23
12
|
attr_accessor :reference_pods
|
24
|
-
|
25
|
-
# 获取壳工程所引用的依赖库
|
26
|
-
# @return [String]
|
27
13
|
def deps_shell
|
28
14
|
init_project_shell
|
29
|
-
|
30
15
|
reference_code_file(project_shell.root_object.main_group)
|
31
|
-
|
32
16
|
reference_files.each do |reference_file|
|
33
17
|
pod_in_file(reference_file)
|
34
18
|
end
|
35
|
-
|
36
19
|
reference_pods
|
37
20
|
end
|
38
|
-
|
39
|
-
# 初始化project对象
|
40
|
-
# @return project_shell
|
41
21
|
def init_project_shell
|
42
22
|
xcodeproj_file = nil
|
43
23
|
Dir.foreach(Dir.pwd) do |file|
|
@@ -46,27 +26,19 @@ module Pod
|
|
46
26
|
break
|
47
27
|
end
|
48
28
|
end
|
49
|
-
|
50
29
|
xcodeproj_path = "#{Dir.pwd}/#{xcodeproj_file}"
|
51
30
|
unless File.exist?(xcodeproj_path)
|
52
31
|
return nil
|
53
32
|
end
|
54
|
-
|
55
33
|
@project_shell = Xcodeproj::Project.open(xcodeproj_path)
|
56
34
|
end
|
57
|
-
|
58
|
-
# 获取其对应的引用代码文件和路径
|
59
|
-
# @return reference_files
|
60
35
|
def reference_code_file(group)
|
61
|
-
# 文件引用
|
62
36
|
file_reference = Xcodeproj::Project::Object::PBXFileReference
|
63
37
|
group.children.each {|child|
|
64
|
-
|
65
38
|
if child.class != file_reference
|
66
39
|
self.reference_code_file(child)
|
67
40
|
next
|
68
41
|
end
|
69
|
-
|
70
42
|
file_name = child.real_path.basename
|
71
43
|
extend_name = file_name.extname
|
72
44
|
if not extend_name == ".h" and
|
@@ -79,50 +51,36 @@ module Pod
|
|
79
51
|
not extend_name == ".cpp"
|
80
52
|
next
|
81
53
|
end
|
82
|
-
|
83
|
-
# 引用关系路径
|
84
54
|
hierarchy_path_array = child.hierarchy_path.split("/")
|
85
55
|
if hierarchy_path_array.size < 2
|
86
56
|
next
|
87
57
|
end
|
88
|
-
|
89
58
|
reference_files << child.real_path
|
90
59
|
}
|
91
60
|
end
|
92
|
-
|
93
|
-
# 获取某个文件里引用的依赖库名字
|
94
|
-
# @param file_path 文件路径
|
95
|
-
# @return reference_pods
|
96
61
|
def pod_in_file(file_path)
|
97
62
|
if File.directory?(file_path)
|
98
63
|
return reference_pods
|
99
64
|
end
|
100
|
-
|
101
65
|
line_array = IO.readlines(file_path)
|
102
66
|
line_array.each_with_index { |line|
|
103
67
|
unless line.start_with?("#import <")
|
104
68
|
next
|
105
69
|
end
|
106
|
-
|
107
70
|
unless line.include?("/")
|
108
71
|
next
|
109
72
|
end
|
110
|
-
|
111
73
|
line_split_array = line.split("/")
|
112
74
|
if line_split_array.size < 1
|
113
75
|
next
|
114
76
|
end
|
115
|
-
|
116
77
|
line_module_name = line_split_array[0].gsub("#import <","")
|
117
|
-
|
118
78
|
real_module_name = line_module_name.include?("/") ? line_module_name.split("/")[0] : line_module_name #处理有子模块的情况
|
119
|
-
|
120
79
|
unless reference_pods.include?(real_module_name)
|
121
80
|
reference_pods << real_module_name
|
122
81
|
end
|
123
82
|
}
|
124
83
|
reference_pods
|
125
84
|
end
|
126
|
-
|
127
85
|
end
|
128
|
-
end
|
86
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
$quick_build = nil
|