akcache 1.1.0 → 1.1.1
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/kcache.gemspec +1 -1
- data/lib/kcache/version.rb +1 -1
- data/lib/kcache.rb +29 -33
- data/lib/pod_plugin.rb +0 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a09a77cf0dd1f6e164eedf0a94b3e2f87009416c2ca271acb24a2823c26dd190
|
4
|
+
data.tar.gz: 636c83770b0dfc9d78219333daf57cb33b548d69c4f58a85eb753a5355f62f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca2435c52e371036a4465960eb3504ecf587628becff5f3dd1a15ff5f92b745bcf02ad5d77d23dad0aac0614cd196d3f7c1b906b976dc04e8ff5e42b9b976bd
|
7
|
+
data.tar.gz: 8b2185ff6a399a12af7c297c690596d8ac4989d0d3e30bfc41276186fdc98196050773f2a3b0e2aa84a163cfa2e18a81ae6a493011e607c0b9f633bedc2b0346
|
data/kcache.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.email = ["1433233832@qq.com"]
|
13
13
|
|
14
14
|
spec.summary = "a cache tool"
|
15
|
-
spec.description = "a cache tool that can
|
15
|
+
spec.description = "a cache tool that can reduce xcode archive time"
|
16
16
|
spec.homepage = "https://github.com/yusheng00"
|
17
17
|
spec.license = "MIT"
|
18
18
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
data/lib/kcache/version.rb
CHANGED
data/lib/kcache.rb
CHANGED
@@ -40,7 +40,7 @@ $podfile_spec_checksums = nil
|
|
40
40
|
$file_md5_hash = {}
|
41
41
|
$exclude_target = []
|
42
42
|
|
43
|
-
|
43
|
+
class CacheManager
|
44
44
|
|
45
45
|
def get_cache_root
|
46
46
|
return Dir.home + "/ysCache"
|
@@ -82,23 +82,24 @@ $exclude_target = []
|
|
82
82
|
end
|
83
83
|
return wrapper_project_paths.uniq
|
84
84
|
end
|
85
|
+
|
85
86
|
|
86
87
|
def backup_project(project)
|
87
|
-
command = "cp \"#{project.path}/project.pbxproj\" \"#{project.path}/
|
88
|
+
command = "cp \"#{project.path}/project.pbxproj\" \"#{project.path}/ysTest_backup.pbxproj\""
|
88
89
|
raise unless system command
|
89
90
|
end
|
90
91
|
|
91
92
|
def clean_temp_files
|
92
|
-
command = "rm -rf Pods/*.xcodeproj/
|
93
|
-
raise unless system command
|
93
|
+
# command = "rm -rf Pods/*.xcodeproj/ysTest_backup.pbxproj"
|
94
|
+
# raise unless system command
|
94
95
|
|
95
96
|
command = "rm -rf Pods/*.xcodeproj/*.#{FILE_NAME_TARGET_CONTEXT}"
|
96
97
|
raise unless system command
|
97
98
|
end
|
98
99
|
|
99
100
|
def restore_project(project)
|
100
|
-
if File.exist? "#{project.path}/
|
101
|
-
command = "mv \"#{project.path}/
|
101
|
+
if File.exist? "#{project.path}/ysTest_backup.pbxproj"
|
102
|
+
command = "mv \"#{project.path}/ysTest_backup.pbxproj\" \"#{project.path}/project.pbxproj\""
|
102
103
|
raise unless system command
|
103
104
|
end
|
104
105
|
end
|
@@ -152,6 +153,7 @@ $exclude_target = []
|
|
152
153
|
file_path = file.file_ref.real_path.to_s
|
153
154
|
files.push file_path
|
154
155
|
end
|
156
|
+
|
155
157
|
#获取所有头文件(.h)
|
156
158
|
target.headers_build_phase.files.each do | file |
|
157
159
|
file_path = file.file_ref.real_path.to_s
|
@@ -296,7 +298,7 @@ $exclude_target = []
|
|
296
298
|
if target_context[:target_md5] != target_md5 or target_context[:product_md5] != get_file_md5(target_cache_dir + "/" + FILE_NAME_PRODUCT)
|
297
299
|
command = "rm -rf \"#{target_cache_dir}\""
|
298
300
|
raise unless system command
|
299
|
-
puts "<ERROR> #{target.name} target md5
|
301
|
+
puts "<ERROR> #{target.name} target md5 does not match: #{target_cache_dir}"
|
300
302
|
end
|
301
303
|
|
302
304
|
dependency_exit = true
|
@@ -306,12 +308,12 @@ $exclude_target = []
|
|
306
308
|
dependency_file = item[0]
|
307
309
|
dependency_md5 = item[1]
|
308
310
|
unless File.exist? dependency_file
|
309
|
-
|
311
|
+
puts "<WARNING> #{target.name} dependency file miss: #{dependency_file}"
|
310
312
|
dependency_exit = false
|
311
313
|
break
|
312
314
|
end
|
313
315
|
unless get_file_md5(dependency_file) == dependency_md5
|
314
|
-
|
316
|
+
puts "<WARNING> #{target.name} dependency file md5 does not match: #{dependency_file}"
|
315
317
|
dependency_exit = false
|
316
318
|
break
|
317
319
|
end
|
@@ -352,8 +354,6 @@ $exclude_target = []
|
|
352
354
|
|
353
355
|
def inject_copy_action(project, target, target_context)
|
354
356
|
target_cache_dir = target_context[:hit_target_cache_dir]
|
355
|
-
target_product_dir = target_context[:build_product_dir]
|
356
|
-
build_intermediate_dir = target_context[:build_intermediate_dir]
|
357
357
|
|
358
358
|
target.build_phases.delete_if { | build_phase |
|
359
359
|
build_phase.class == Xcodeproj::Project::Object::PBXHeadersBuildPhase or
|
@@ -361,14 +361,9 @@ $exclude_target = []
|
|
361
361
|
build_phase.class == Xcodeproj::Project::Object::PBXResourcesBuildPhase
|
362
362
|
}
|
363
363
|
|
364
|
-
# if target.name == "EURLocalizedStrings"
|
365
|
-
# target.build_phases.delete_if { |phase|
|
366
|
-
# phase.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase
|
367
|
-
# }
|
368
|
-
# end
|
369
364
|
command_exec = "\"#{$0}\""
|
370
365
|
inject_phase = target.new_shell_script_build_phase("ys_copy_#{target.name}")
|
371
|
-
inject_phase.shell_script = "#{command_exec} #{"copy"} \"#{target_cache_dir}\"
|
366
|
+
inject_phase.shell_script = "#{command_exec} #{"copy"} \"#{target_cache_dir}\""
|
372
367
|
inject_phase.show_env_vars_in_log = '1'
|
373
368
|
end
|
374
369
|
|
@@ -378,10 +373,10 @@ $exclude_target = []
|
|
378
373
|
start_time = Time.now
|
379
374
|
target_cache_dir = ARGV[1]
|
380
375
|
cache_product_path = target_cache_dir + "/#{FILE_NAME_PRODUCT}"
|
381
|
-
|
376
|
+
|
382
377
|
[SYMROOT, CONFIGURATION_BUILD_DIR, CONFIGURATION_TEMP_DIR, OBJROOT, TARGET_BUILD_DIR, TARGET_TEMP_DIR, SRCROOT, FULL_PRODUCT_NAME].sort.each do | key |
|
383
378
|
unless ENV.has_key? key and ENV[key] and ENV[key].size > 0
|
384
|
-
raise "<INFO> #{
|
379
|
+
raise "<INFO> #{$0} should have #{key}"
|
385
380
|
break
|
386
381
|
end
|
387
382
|
end
|
@@ -412,7 +407,6 @@ $exclude_target = []
|
|
412
407
|
def add_cache(target, target_info)
|
413
408
|
target_md5 = target_info[:target_md5]
|
414
409
|
product_dir = target_info[CONFIGURATION_BUILD_DIR]
|
415
|
-
# intermediate_dir = target_info[TARGET_TEMP_DIR]
|
416
410
|
full_product_name = target_info[FULL_PRODUCT_NAME]
|
417
411
|
|
418
412
|
Dir.glob("#{product_dir}/**/*.modulemap").each do | modulemap |
|
@@ -521,8 +515,7 @@ $exclude_target = []
|
|
521
515
|
|
522
516
|
|
523
517
|
def project_task_begin
|
524
|
-
|
525
|
-
clean_temp_files
|
518
|
+
|
526
519
|
projects = get_projects
|
527
520
|
total_count = 0
|
528
521
|
hit_count = 0
|
@@ -534,11 +527,18 @@ $exclude_target = []
|
|
534
527
|
get_custom_config_information
|
535
528
|
|
536
529
|
pre_targets_info = {}
|
530
|
+
|
531
|
+
projects.each do |project|
|
532
|
+
restore_project(project)
|
533
|
+
backup_project(project)
|
534
|
+
end
|
535
|
+
|
536
|
+
clean_temp_files
|
537
|
+
|
538
|
+
projects = get_projects
|
539
|
+
|
537
540
|
projects.each do |project|
|
538
541
|
project.native_targets.each do |target|
|
539
|
-
target.build_phases.delete_if { |phase|
|
540
|
-
phase.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase and phase.name.include? "ys_"
|
541
|
-
}
|
542
542
|
if can_cache_target(target)
|
543
543
|
total_count = total_count + 1
|
544
544
|
source_files = get_target_source_files(target)
|
@@ -568,8 +568,8 @@ $exclude_target = []
|
|
568
568
|
end
|
569
569
|
end
|
570
570
|
end
|
571
|
-
|
572
|
-
while
|
571
|
+
|
572
|
+
while true
|
573
573
|
projects.each do |project|
|
574
574
|
project.native_targets.each do |target|
|
575
575
|
target_info = pre_targets_info[target]
|
@@ -595,14 +595,14 @@ $exclude_target = []
|
|
595
595
|
end
|
596
596
|
|
597
597
|
if miss_target_cache_set.include? "#{dependency_target}"
|
598
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5}
|
598
|
+
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5} does not hit"
|
599
599
|
target_really_miss = true
|
600
600
|
all_dependency_target_exist = false
|
601
601
|
break
|
602
602
|
end
|
603
603
|
|
604
604
|
unless hit_target_md5_cache_set.include? "#{dependency_target}-#{dependency_target_md5}"
|
605
|
-
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5}
|
605
|
+
puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5} does not hit"
|
606
606
|
all_dependency_target_exist = false
|
607
607
|
target_really_miss = true
|
608
608
|
break
|
@@ -640,10 +640,7 @@ $exclude_target = []
|
|
640
640
|
end
|
641
641
|
|
642
642
|
File.write("#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}", target_info.to_yaml)
|
643
|
-
|
644
643
|
end
|
645
|
-
|
646
|
-
backup_project(project)
|
647
644
|
project.save
|
648
645
|
end
|
649
646
|
if total_count == hit_count + miss_count + error_count
|
@@ -801,7 +798,6 @@ $exclude_target = []
|
|
801
798
|
|
802
799
|
puts "<INFO> total add cache count: #{total_add_count}"
|
803
800
|
end
|
804
|
-
|
805
801
|
|
806
802
|
end
|
807
803
|
|
data/lib/pod_plugin.rb
ADDED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akcache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yusheng
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
description: a cache tool that can
|
27
|
+
description: a cache tool that can reduce xcode archive time
|
28
28
|
email:
|
29
29
|
- 1433233832@qq.com
|
30
30
|
executables:
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/kcache.rb
|
50
50
|
- lib/kcache/README.md
|
51
51
|
- lib/kcache/version.rb
|
52
|
+
- lib/pod_plugin.rb
|
52
53
|
homepage: https://github.com/yusheng00
|
53
54
|
licenses:
|
54
55
|
- MIT
|
@@ -56,7 +57,7 @@ metadata:
|
|
56
57
|
homepage_uri: https://github.com/yusheng00
|
57
58
|
source_code_uri: https://github.com/yusheng00
|
58
59
|
changelog_uri: https://github.com/yusheng00
|
59
|
-
post_install_message:
|
60
|
+
post_install_message:
|
60
61
|
rdoc_options: []
|
61
62
|
require_paths:
|
62
63
|
- lib
|
@@ -71,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
72
|
- !ruby/object:Gem::Version
|
72
73
|
version: '0'
|
73
74
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
75
|
+
rubygems_version: 3.1.6
|
76
|
+
signing_key:
|
76
77
|
specification_version: 4
|
77
78
|
summary: a cache tool
|
78
79
|
test_files: []
|