podfileDep 2.5.6 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29c63f45d7c8ec8ccf0b2207cddfed7a72fa36fb8e89c55ab7428bbf401b22d9
4
- data.tar.gz: 31e948d17abce16ed2f4668a4e6955a074cd82db5e0b75e6689b87a5a2d02c7b
3
+ metadata.gz: 0d32097193876845e685b951363a7b4476654390db321ffbed66677c5e056184
4
+ data.tar.gz: 10b832fbc8d5ec05f36f11f6b6a9603cb2bfcc22d51f96b3bde839251b8d2d35
5
5
  SHA512:
6
- metadata.gz: 6891629a75f951be1fe57520613bb32e71d9054008de534929bc2c71a77788ff065bff725a15bf2964be158bd2d252d950ea483c7696d8d3d76989ae0f8b6d15
7
- data.tar.gz: 5539aed163e0536545ff77a7faacf4624921ad830ef5d338c0153a1bd0db9217df293ddef3f7a1deac569fa0f57134e1219304991236dfc1067eb028a03e1402
6
+ metadata.gz: 6135afcbd4cac979bb16cf41152c0f0c02a16e2ce33f6931f02afe446938164cfcd919f85115da1a45845508b0e0e9e0bc4f9d834f056e0e2a1ca7e5433608cd
7
+ data.tar.gz: 3ac770ccd5ce158c71b1b5c3c018d34a465881868da6adef69b0b11831197454682fc8258a8a323576f346b7785553070166261873090da46e6cc898c7503f51
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [Released]
2
+ ### [2.7.0] - 2024-08-08
3
+ - 新增功能反转依赖的查询和打印pod dep
4
+
5
+ ### [2.6.0] - 2024-07-17
6
+ - 新增命令pod install all
7
+
1
8
  ## [Released]
2
9
  ### [2.5.6] - 2023-11-22
3
10
  - 兼容一个pod库都没有的场景
data/docs/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'podfileDep', path: './podfileDep'
4
+
5
+ group :debug do
6
+ gem 'ruby-debug-ide'
7
+ gem 'debase'
8
+ end
9
+
@@ -1,4 +1,6 @@
1
1
  require 'cocoapods'
2
+ require_relative 'podfileDep/command/dep'
3
+ require_relative 'podfileDep/command/quick'
2
4
  require_relative 'podfileDep/command/quick'
3
5
  require_relative 'podfileDep/check/project'
4
6
  require_relative 'podfileDep/check/podspec'
@@ -0,0 +1,24 @@
1
+ require 'cocoapods'
2
+ require_relative '../variable'
3
+
4
+ module Pod
5
+ class Command
6
+ class All < Install
7
+
8
+ self.summary = '单次关闭编译优化'
9
+
10
+ self.description = <<-DESC
11
+ * 开启编译优化命令
12
+ * pod install all
13
+ DESC
14
+
15
+
16
+ def initialize(argv)
17
+ super
18
+ $quick_build = false
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,36 @@
1
+ require_relative '../dep/find'
2
+ require_relative '../version'
3
+ module Pod
4
+ class Command
5
+ class Dep < Command
6
+
7
+ self.summary = '从Podfile.lock文件里检索出依赖反转后的情况'
8
+
9
+ self.description = <<-DESC
10
+ 从Podfile.lock文件里检索出依赖反转后的情况
11
+ DESC
12
+
13
+ def self.options
14
+ [
15
+ %w[--name=xx xx为要查询的组件的名字],
16
+ %w[--sort 输出反转依赖时按数量从小到大排序],
17
+ ].concat(super).reject { |(name, _)| (name == '--no-ansi' or name == '--silent' or name == '--allow-root' or name == '--verbose') }
18
+ end
19
+
20
+ def initialize(argv)
21
+ super
22
+ puts "插件版本号: #{PodfileDep::VERSION}"
23
+ @name = argv.option('name')
24
+ @sort_count = argv.flag?('sort', false)
25
+ end
26
+
27
+ def run
28
+ verify_lockfile_exists!
29
+ finder = Pod::DepFinder.new
30
+ finder.find_name = @name
31
+ finder.sort_count = @sort_count
32
+ finder.find
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,7 +5,7 @@ module Pod
5
5
  class Command
6
6
  class Quick < Install
7
7
 
8
- self.summary = '编译优化'
8
+ self.summary = '单次开启编译优化'
9
9
 
10
10
  self.description = <<-DESC
11
11
  * 开启编译优化命令
@@ -0,0 +1,118 @@
1
+ require 'yaml'
2
+
3
+ module Pod
4
+ class DepFinder
5
+
6
+ # @param [Hash] podfileLock内容
7
+ attr_accessor :lockfile_content
8
+
9
+ # @param [String] 要查询的组件名
10
+ attr_accessor :find_name
11
+
12
+ # @param [bool] 是否按数量从小到大排序
13
+ attr_accessor :sort_count
14
+
15
+ def initialize
16
+ super
17
+ init_lock
18
+ end
19
+
20
+ def init_lock
21
+ # 读取名为Podfile.lock的yaml文件, 并通过分析里面的PODS数组,输出依赖的第三方库的名字
22
+ unless File.exist?("Podfile.lock")
23
+ puts "Podfile.lock文件不存在,请先执行pod install或pod update"
24
+ end
25
+
26
+ @sort_count = false
27
+
28
+ @lockfile_content = YAML.load_file('Podfile.lock')
29
+
30
+ end
31
+
32
+ # @api 反向依赖查询
33
+ def find
34
+
35
+ if @find_name
36
+ find_for_name
37
+ else
38
+ find_all
39
+ end
40
+ end
41
+
42
+ def find_all
43
+
44
+ reverse_map = Hash.new
45
+ # 循环遍历lockfile对象中的PODS数组
46
+ @lockfile_content['PODS'].each do |pod|
47
+ # 拿到所有的组件名
48
+ key = pod.is_a?(Hash) ? pod.keys[0] : pod
49
+ key = key.split(" (")[0]
50
+ results = find_with_name(key)
51
+
52
+ reverse_map[key] = results
53
+
54
+ end
55
+
56
+ puts ""
57
+ sorted_hash = reverse_map
58
+ if @sort_count
59
+ puts "反转后依赖如下(数量从少到多):"
60
+ sorted_hash = Hash[reverse_map.sort_by { |key, value| value.length }]
61
+ else
62
+ puts "反转后依赖如下:"
63
+ end
64
+
65
+ sorted_hash.each do |key, array|
66
+ puts "依赖#{key}的组件有(#{array.length}个):"
67
+ array.each do |obj|
68
+ puts obj
69
+ end
70
+ puts "\n"
71
+ end
72
+
73
+ unless @sort_count
74
+ puts "==> 按数量从少到多排序,可使用pod dep --sort"
75
+ end
76
+ puts "==> 查询单个依赖的情况,可使用pod dep --name=xx"
77
+ end
78
+
79
+ def find_for_name
80
+ results = find_with_name(@find_name)
81
+
82
+ if results.empty?
83
+ puts "组件#{@find_name}没有被任何其他组件依赖"
84
+ return
85
+ end
86
+
87
+ puts "依赖#{@find_name}的组件有:"
88
+ results.each do |res|
89
+ puts res
90
+ end
91
+ end
92
+
93
+ def find_with_name(name)
94
+ results = Array.new
95
+ # 循环遍历lockfile对象中的PODS数组
96
+ @lockfile_content['PODS'].each do |pod|
97
+ if pod.is_a?(Hash)
98
+ pod.values.each do |value|
99
+ # 如果value是一个数组,则判断数组中是否包含name
100
+ if value.is_a?(Array)
101
+ value.each { |sub_value|
102
+ # 这里的处理包含了子模块的情况
103
+ sub_module = sub_value.split(" (")[0]
104
+ if sub_module == name
105
+ results << pod.keys.first
106
+ end
107
+ }
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ # 去重
114
+ results.uniq
115
+ end
116
+ end
117
+ end
118
+
@@ -7,7 +7,7 @@ module MyConstants
7
7
  PODFILE_LOCK = 'Podfile.lock'
8
8
  PODFILE = 'Podfile'
9
9
 
10
- LIBLIBARYS = ["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
- FRAMEWORKS = ["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"]
10
+ 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
+ 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
12
 
13
13
  end
@@ -11,11 +11,13 @@ module Unused
11
11
  yaml_dep = Pod::YamlDep.new
12
12
 
13
13
  if yaml_dep.quick_build
14
- msg = "🔰已开启编译优化选项,请关注上方日志 '下载依赖...'部分内容"
15
- msg += "\n #{MyConstants::PODFILE_LOCAL_YAML}文件内的依赖库,将不会被优化忽略掉"
14
+ msg = "💚当前已开启编译优化选项,请关注上方日志 '下载依赖...'部分内容。"
15
+ msg += "\n #{MyConstants::PODFILE_LOCAL_YAML}文件内的依赖库,将不会被优化忽略掉。如需关闭优化,有2种方式任选其一"
16
+ msg += "\n1. 在#{MyConstants::PODFILE_LOCAL_YAML}中 最外层 QUICK_BUILD字段设置为false,然后重新pod install"
17
+ msg += "\n2. 执行 pod install all 可单次关闭"
16
18
  puts msg.green
17
19
  else
18
- msg = "检测到你未开启编译优化选项,如你处于开发模式,可开启此功能,移除不被引用的依赖库来加速编译,有2种方式任选其一"
20
+ msg = "💛检测到你未开启编译优化选项,如你处于开发模式,可开启此功能,移除不被引用的依赖库来加速编译,有2种方式任选其一"
19
21
  msg += "\n1. 在#{MyConstants::PODFILE_LOCAL_YAML}中 最外层 QUICK_BUILD字段设置为true,然后重新pod install"
20
22
  msg += "\n2. 执行 pod install quick 可单次开启"
21
23
  puts msg.yellow
@@ -1,2 +1,2 @@
1
- # 编译优化
2
- $quick_build = false
1
+ # 编译优化 初始化时不定义
2
+ $quick_build = nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PodfileDep
4
- VERSION = "2.5.6"
4
+ VERSION = "2.7.0"
5
5
  end
@@ -4,6 +4,7 @@ require_relative '../my_constants'
4
4
  require_relative '../check/xcodeproj'
5
5
  require_relative '../variable'
6
6
  require 'colored2'
7
+ require 'yaml'
7
8
 
8
9
  module Pod
9
10
  class YamlDep
@@ -531,8 +532,10 @@ module Pod
531
532
  #是否开启了编译优化开关
532
533
  def quick_build
533
534
  yaml_content = read_yaml_content(podfile_local_yaml)
534
- quick1 = yaml_content ? !!(yaml_content["QUICK_BUILD"]) : false
535
- quick1 or $quick_build
535
+ if $quick_build != nil
536
+ return $quick_build
537
+ end
538
+ yaml_content ? !!(yaml_content["QUICK_BUILD"]) : false
536
539
  end
537
540
 
538
541
  #是否禁用检查podspec文件
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podfileDep
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.6
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 王帅朋
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-22 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -63,6 +63,9 @@ files:
63
63
  - Gemfile
64
64
  - README.md
65
65
  - Rakefile
66
+ - docs/Gemfile
67
+ - docs/debug目录.png
68
+ - docs/debug配置.png
66
69
  - lib/cocoapods_plugin.rb
67
70
  - lib/podfileDep.rb
68
71
  - lib/podfileDep/check/import.rb
@@ -71,7 +74,10 @@ files:
71
74
  - lib/podfileDep/check/project.rb
72
75
  - lib/podfileDep/check/util.rb
73
76
  - lib/podfileDep/check/xcodeproj.rb
77
+ - lib/podfileDep/command/all.rb
78
+ - lib/podfileDep/command/dep.rb
74
79
  - lib/podfileDep/command/quick.rb
80
+ - lib/podfileDep/dep/find.rb
75
81
  - lib/podfileDep/indirect/indirect.rb
76
82
  - lib/podfileDep/modify/modify_code.rb
77
83
  - lib/podfileDep/my_constants.rb