akcache 1.0.2 → 1.1.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: e3229f591d1e3e0a9f2ac7c46569c018e8738a530b474e0f10d7da6911a7843d
4
- data.tar.gz: 297e492a42510ebe3822c7b43af56f4ea0d0f1478a19536a2510fa439352d139
3
+ metadata.gz: e111a87e7b115115b7fe107f4973a6860e4932a9fd60bf39a618b1ecef70a71a
4
+ data.tar.gz: e64335df77ccde462d563a4824d56e8ddb8e121f25b63154fd04447d3d435953
5
5
  SHA512:
6
- metadata.gz: 3bd43ec15c23d3aff54471c2ab3eea726fc1a4845d51287baaf710e8201c5dc29de13d6a97ab14fed66e98bc1231b1b3bc70b6e6023589deda5b80a4e7c50790
7
- data.tar.gz: eb0a3cb807d8e8b3212080202ff61925c9fdda0dd7001bd7369ad76ae801f87c9be6fbcf98a4d5299ae56eb426c13fba64141543873c204e9bc9c2714edb374c
6
+ metadata.gz: 9ae37bcf39f37c9189f204fde4a90bb38dc0902058cd0c82c83d43dc32ba867e5d250fdc39ccfa9ef177e75fab597e4ad707016ed6b1dab0b54d85ccc26499f2
7
+ data.tar.gz: 73c4cace947c1c93670f139d568edcb7d8091ddd7a406da832c7c8fa5363c1647843a20a09293ac064cd9b935cb7f205489b5853ee8c960316a990232f7986ca
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- akcache (1.0.0)
4
+ akcache (1.0.2)
5
5
  xcodeproj (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Kcache
1
+ # AKCache
2
+
2
3
 
3
4
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/kcache`. To experiment with that code, run `bin/console` for an interactive prompt.
4
5
 
@@ -0,0 +1,29 @@
1
+ # AKMall
2
+
3
+ [![CI Status](https://img.shields.io/travis/pangyulei/AKMall.svg?style=flat)](https://travis-ci.org/pangyulei/AKMall)
4
+ [![Version](https://img.shields.io/cocoapods/v/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
5
+ [![License](https://img.shields.io/cocoapods/l/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
6
+ [![Platform](https://img.shields.io/cocoapods/p/AKMall.svg?style=flat)](https://cocoapods.org/pods/AKMall)
7
+
8
+ ## Example
9
+
10
+ To run the example project, clone the repo, and run `pod install` from the Example directory first.
11
+
12
+ ## Requirements
13
+
14
+ ## Installation
15
+
16
+ AKMall is available through [CocoaPods](https://cocoapods.org). To install
17
+ it, simply add the following line to your Podfile:
18
+
19
+ ```ruby
20
+ pod 'AKMall'
21
+ ```
22
+
23
+ ## Author
24
+
25
+ pangyulei, pangyulei@gmail.com
26
+
27
+ ## License
28
+
29
+ AKMall is available under the MIT license. See the LICENSE file for more info.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kcache
4
- VERSION = "1.0.2"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/kcache.rb CHANGED
@@ -38,7 +38,7 @@ OBJROOT = "OBJROOT"
38
38
  #变量
39
39
  $podfile_spec_checksums = nil
40
40
  $file_md5_hash = {}
41
-
41
+ $exclude_target = []
42
42
 
43
43
  class CacheManager
44
44
 
@@ -492,6 +492,33 @@ $file_md5_hash = {}
492
492
  return true
493
493
 
494
494
  end
495
+
496
+ def get_custom_config_information
497
+ if File.exist? "project_cache_config.yml"
498
+ custom_config = YAML.load (File.read("project_cache_config.yml"))
499
+ $exclude_target = custom_config[:exclude_targets]
500
+ else
501
+ source = {
502
+ :description => nil,
503
+ :dependency_check => true,
504
+ :exclude_targets => ["target1", "target2"],
505
+ }.to_yaml
506
+
507
+ substitution_list = {
508
+ /:description:/ => "# You can assign values to these parameters to achieve some custom functions\n",
509
+ /:dependency_check:/ => "\n\n# Whether to check the dependencies of the target. For exzample: target A depends on target B. Under normal circumstances, target B is recompiled, then target A will be recompiled, but if the dependencies are not checked, target A will not be recompiled at this time\n:dependency_check:",
510
+ /:exclude_targets:/ => "\n\n# the targets that will not participate in cache dependency detection\n:exclude_targets:",
511
+ }
512
+
513
+ substitution_list.each do |pattern, replacement|
514
+ source.gsub!(pattern, replacement)
515
+ end
516
+ puts source
517
+ File.write("project_cache_config.yml", source)
518
+ end
519
+
520
+ end
521
+
495
522
 
496
523
  def project_task_begin
497
524
 
@@ -502,6 +529,9 @@ $file_md5_hash = {}
502
529
  miss_count = 0
503
530
  error_count = 0
504
531
  hit_target_md5_cache_set = Set.new
532
+ miss_target_cache_set = Set.new
533
+
534
+ get_custom_config_information
505
535
 
506
536
  pre_targets_info = {}
507
537
  projects.each do |project|
@@ -538,58 +568,89 @@ $file_md5_hash = {}
538
568
  end
539
569
  end
540
570
  end
541
-
542
- projects.each do |project|
543
- project.native_targets.each do |target|
544
- target_info = pre_targets_info[target]
545
- next unless target_info and target_info[:target_status] != CACHE_STATUS_MISS
546
- hit_target_cache_dirs = target_info[:hit_target_cache_dir]
547
- next unless hit_target_cache_dirs and hit_target_cache_dirs.count > 0
548
- target_md5 = target_info[:target_md5]
549
-
550
- really_hit_dir = ""
551
- hit_target_cache_dirs.each do |hit_target_cache_dir|
552
- all_dependency_target_exist = true
553
- hit_targets_info = YAML.load(File.read(hit_target_cache_dir + "/" + FILE_NAME_CONTEXT))
554
- if hit_targets_info[:dependency_targets_md5]
555
- hit_targets_info[:dependency_targets_md5].each do | item |
556
- dependency_target = item[0]
557
- dependency_target_md5 = item[1]
558
- unless hit_target_md5_cache_set.include? "#{dependency_target}-#{dependency_target_md5}"
559
- puts "<INFO> #{target.name} #{target_md5} hit cache, but dependency target #{dependency_target}-#{dependency_target_md5} dose not hit"
560
- all_dependency_target_exist = false
571
+
572
+ while 1
573
+ projects.each do |project|
574
+ project.native_targets.each do |target|
575
+ target_info = pre_targets_info[target]
576
+ next unless target_info and target_info[:target_status] != CACHE_STATUS_MISS
577
+ next unless target_info and target_info[:target_status] != CACHE_STATUS_HIT
578
+ hit_target_cache_dirs = target_info[:hit_target_cache_dir]
579
+ next unless hit_target_cache_dirs and hit_target_cache_dirs.count > 0
580
+ target_md5 = target_info[:target_md5]
581
+
582
+ target_really_hit_dir = ""
583
+ target_really_miss = false
584
+ hit_target_cache_dirs.each do |hit_target_cache_dir|
585
+ all_dependency_target_exist = true
586
+ target_really_miss = false
587
+ hit_targets_info = YAML.load(File.read(hit_target_cache_dir + "/" + FILE_NAME_CONTEXT))
588
+ if hit_targets_info[:dependency_targets_md5]
589
+ hit_targets_info[:dependency_targets_md5].each do | item |
590
+ dependency_target = item[0]
591
+ dependency_target_md5 = item[1]
592
+ if $exclude_target.include? dependency_target
593
+ puts "<INFO> #{target.name} #{target_md5} hit cache, dependency target #{dependency_target}-#{dependency_target_md5} skip check"
594
+ next
595
+ end
596
+
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} dose not hit"
599
+ target_really_miss = true
600
+ all_dependency_target_exist = false
601
+ break
602
+ end
603
+
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} dose not hit"
606
+ all_dependency_target_exist = false
607
+ target_really_miss = true
608
+ break
609
+ end
610
+ end
611
+
612
+ if all_dependency_target_exist
613
+ target_really_hit_dir = hit_target_cache_dir
614
+ break
615
+ end
616
+
617
+ if target_really_miss
561
618
  break
562
619
  end
563
- end
564
-
565
- if all_dependency_target_exist
566
- really_hit_dir = hit_target_cache_dir
567
- break
568
620
  end
569
621
  end
622
+
623
+ if target_really_hit_dir.length > 0
624
+ puts "<INFO> #{target.name} #{target_md5} hit cache"
625
+ hit_count = hit_count + 1
626
+ hit_target_info = YAML.load(File.read(target_really_hit_dir + "/" + FILE_NAME_CONTEXT))
627
+ target_info = target_info.merge!(hit_target_info)
628
+ target_info[:target_status] = CACHE_STATUS_HIT
629
+ target_info[:hit_target_cache_dir] = target_really_hit_dir
630
+ inject_copy_action(project, target, target_info)
631
+ end
632
+
633
+ if target_really_miss
634
+ miss_count = miss_count + 1
635
+ miss_target_cache_set.add "#{target.name}"
636
+ hit_target_md5_cache_set.delete "#{target.name}-#{target_info[:target_md5]}"
637
+ target_info[:target_status] = CACHE_STATUS_MISS
638
+ target_info.delete(:hit_target_cache_dir)
639
+ inject_flag_action(project, target)
640
+ end
641
+
642
+ File.write("#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}", target_info.to_yaml)
643
+
570
644
  end
571
-
572
- if really_hit_dir.length > 0
573
- puts "<INFO> #{target.name} #{target_md5} hit cache"
574
- hit_count = hit_count + 1
575
- hit_target_info = YAML.load(File.read(really_hit_dir + "/" + FILE_NAME_CONTEXT))
576
- target_info = target_info.merge!(hit_target_info)
577
- target_info[:target_status] = CACHE_STATUS_HIT
578
- target_info[:hit_target_cache_dir] = really_hit_dir
579
- inject_copy_action(project, target, target_info)
580
- else
581
- puts "<INFO> #{target.name} #{target_md5} miss cache for reason dependency miss"
582
- target_info[:target_status] = CACHE_STATUS_MISS
583
- target_info.delete(:hit_target_cache_dir)
584
- inject_flag_action(project, target)
585
- miss_count = miss_count + 1
586
- end
587
- File.write("#{project.path}/#{target.name}.#{FILE_NAME_TARGET_CONTEXT}", target_info.to_yaml)
588
-
645
+
646
+ backup_project(project)
647
+ project.save
648
+ end
649
+ if total_count == hit_count + miss_count + error_count
650
+ break
651
+ else
652
+ puts "<INFO> continue to find hit cache"
589
653
  end
590
-
591
- backup_project(project)
592
- project.save
593
654
  end
594
655
  puts "<INFO> total count: #{total_count}, hit count: #{hit_count}, miss_count: #{miss_count}, error_count: #{error_count}"
595
656
  end
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.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yusheng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -47,6 +47,7 @@ files:
47
47
  - bin/setup
48
48
  - kcache.gemspec
49
49
  - lib/kcache.rb
50
+ - lib/kcache/README.md
50
51
  - lib/kcache/version.rb
51
52
  homepage: https://github.com/yusheng00
52
53
  licenses: