zabel 1.0.4 → 1.0.5

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/zabel +2 -0
  3. data/lib/zabel/version.rb +1 -1
  4. data/lib/zabel.rb +55 -15
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bbbbd6d01a9148ff002993ceebe5ed44aba4fd905cb1529689ca40406357aff
4
- data.tar.gz: b0ef1fd3e75802bc1ab90f99f3c2910263e84c0fa4352536a7e7515a7e8515c5
3
+ metadata.gz: cc4cbbc3f7bbd44aab6c8956a5bf28ebb5eee811d4d83f1682770ea4ce878627
4
+ data.tar.gz: 034b407ef6ccd3c063d1455be9eab00cc43cbbfa1d59a8412558e320046cb4ba
5
5
  SHA512:
6
- metadata.gz: 842b4eade28085456376de660c8f353108d488caf3f26dcd6308476c2eab2a60cfa67e1c4f5a248cc9a7c4a29d574ecbaa41273d56dd3d323a05a8453698fd11
7
- data.tar.gz: 28fdc857de4f92a8c6c806305e858bdd94c5fb2888bc86eaa7fb7f9a3b67ea311ef28bf132ffb4690ab5bea9449f62eb62c5a983fb5f0a9bc1988d38f343cf3b
6
+ metadata.gz: 66249457f3f78f39421c1d84f7a5ba00cb108e30251dc5fbb7c2b243be1d218b2b1e4a21e62d6714f942638737c11c9773fdbc27c05b9a8a14c07e07fed0ca69
7
+ data.tar.gz: ecc774715a35089f5f9686a24aba6982ad034f4dd7542b4ac1180e298557f3accca60b10ec51669a9f9c9b952c747e214f7e8cc6fc35f39e3965aa0699a0a775
data/bin/zabel CHANGED
@@ -15,6 +15,8 @@ elsif ARGV[0] == Zabel::STAGE_POST
15
15
  elsif ARGV.include?("-configuration") or ARGV.include?("--configuration")
16
16
  total_start_time = Time.now
17
17
 
18
+ puts ARGV.to_s
19
+
18
20
  Zabel::zabel_pre(ARGV)
19
21
 
20
22
  build_start_time = Time.now
data/lib/zabel/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Zabel
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  CACHE_VERSION = "1"
4
4
  end
data/lib/zabel.rb CHANGED
@@ -23,6 +23,7 @@ module Zabel
23
23
 
24
24
  STATUS_HIT = "hit"
25
25
  STATUS_MISS = "miss"
26
+ STATUS_MISS_AND_READY = "miss_ready"
26
27
 
27
28
  STAGE_CLEAN = "clean"
28
29
  STAGE_EXTRACT = "extract"
@@ -130,15 +131,19 @@ module Zabel
130
131
  file = file.gsub("\\ ", " ")
131
132
 
132
133
  unless File.exist? file
133
- puts "[ZABEL/E] #{target.name} #{file} should exist in dependency file #{dependency_file}"
134
+ puts "[ZABEL/E] #{target.name} #{file} should exist in dependency file #{dependency_file} in #{intermediate_dir}/**/*.d"
134
135
  return []
135
136
  end
136
137
 
137
138
  if file.start_with? intermediate_dir + "/" or
138
- file.start_with? product_dir + "/" or
139
- file.start_with? xcframeworks_build_dir + "/"
139
+ file.start_with? product_dir + "/"
140
140
  next
141
141
  end
142
+
143
+ if xcframeworks_build_dir and xcframeworks_build_dir.size > 0 and file.start_with? xcframeworks_build_dir + "/"
144
+ next
145
+ end
146
+
142
147
 
143
148
  dependency_files.push file
144
149
  end
@@ -256,15 +261,13 @@ module Zabel
256
261
  target_configuration = target.build_configurations.detect { | config | config.name == configuration_name}
257
262
  target_configuration_content = target_configuration.pretty_print.to_yaml
258
263
  target_xcconfig = ""
259
- target_spec_name = ""
260
264
  if target_configuration.base_configuration_reference
261
265
  config_file_path = target_configuration.base_configuration_reference.real_path.to_s
262
- target_spec_name = File.basename(File.dirname(config_file_path))
263
266
  if File.exist? config_file_path
264
267
  target_xcconfig = File.read(config_file_path).lines.reject{|line|line.include? "_SEARCH_PATHS"}.sort.join("")
265
268
  end
266
269
  end
267
-
270
+
268
271
  first_configuration = []
269
272
  build_phases = []
270
273
  build_phases.push target.source_build_phase if target.methods.include? :source_build_phase
@@ -300,11 +303,29 @@ module Zabel
300
303
  source_md5_list.push "ARGV : #{key_argv.to_s}"
301
304
 
302
305
  # TODO: to get a explicit spec name from a target.
303
- if target_spec_name.size > 0 and $zabel_podfile_spec_checksums.has_key? target_spec_name
304
- source_md5_list.push "SPEC CHECKSUM : #{target_spec_name} #{$zabel_podfile_spec_checksums[target_spec_name]}"
305
- has_found_checksum = true
306
- else
307
- puts "[ZABEL/E] #{target.name} #{target_spec_name} SPEC CHECKSUM should be found"
306
+ target_possible_spec_names = []
307
+ target_possible_spec_names.push target_configuration.build_settings["PRODUCT_NAME"] if target_configuration.build_settings["PRODUCT_NAME"]
308
+ target_possible_spec_names.push target_configuration.build_settings["IBSC_MODULE"] if target_configuration.build_settings["IBSC_MODULE"]
309
+ target_possible_spec_names.push File.basename(target_configuration.build_settings["CONFIGURATION_BUILD_DIR"]) if target_configuration.build_settings["CONFIGURATION_BUILD_DIR"]
310
+ if target_xcconfig.lines.detect { | line | line.start_with? "CONFIGURATION_BUILD_DIR = "}
311
+ target_possible_spec_names.push File.basename(target_xcconfig.lines.detect { | line | line.start_with? "CONFIGURATION_BUILD_DIR = "}.strip)
312
+ end
313
+ if target_xcconfig.lines.detect { | line | line.start_with? "PODS_TARGET_SRCROOT = "}
314
+ target_possible_spec_names.push File.basename(target_xcconfig.lines.detect { | line | line.start_with? "PODS_TARGET_SRCROOT = "}.strip)
315
+ end
316
+
317
+ target_match_spec_names = []
318
+ target_possible_spec_names.uniq.sort.each do | spec_name |
319
+ if spec_name.size > 0 and $zabel_podfile_spec_checksums.has_key? spec_name
320
+ source_md5_list.push "SPEC CHECKSUM : #{spec_name} #{$zabel_podfile_spec_checksums[spec_name]}"
321
+ target_match_spec_names.push spec_name
322
+ end
323
+ end
324
+
325
+ unless target_match_spec_names.size == 1
326
+ puts "[ZABEL/E] #{target.name} #{target_possible_spec_names.to_s} #{target_match_spec_names.to_s} SPEC CHECKSUM should be found"
327
+ puts target_configuration.build_settings.to_s
328
+ puts target_xcconfig
308
329
  end
309
330
 
310
331
  source_md5_list.push "Project : #{File.basename(project.path)}"
@@ -459,8 +480,18 @@ module Zabel
459
480
  end
460
481
  if zabel_can_cache_target(target)
461
482
  target_context = YAML.load(File.read(target_context_file))
462
-
463
- if target_context[:target_status] == STATUS_MISS
483
+
484
+ if target_context[:target_status] == STATUS_MISS_AND_READY
485
+ environment_valid = true
486
+ [BUILD_KEY_SYMROOT, BUILD_KEY_CONFIGURATION_BUILD_DIR, BUILD_KEY_OBJROOT, BUILD_KEY_TARGET_TEMP_DIR, BUILD_KEY_SRCROOT, BUILD_KEY_FULL_PRODUCT_NAME].sort.each do | key |
487
+ unless target_context.has_key? key and target_context[key] and target_context[key].size > 0
488
+ puts "[ZABEL/E] #{target.name} should have #{key} in #{target_context.to_s}"
489
+ environment_valid = false
490
+ break
491
+ end
492
+ end
493
+ next unless environment_valid
494
+
464
495
  source_files = zabel_get_target_source_files(target)
465
496
 
466
497
  product_dir = target_context[BUILD_KEY_CONFIGURATION_BUILD_DIR]
@@ -510,7 +541,7 @@ module Zabel
510
541
  project.native_targets.each do | target |
511
542
  if post_targets_context.has_key? target
512
543
  target_context = post_targets_context[target]
513
- next unless target_context[:target_status] == STATUS_MISS
544
+ next unless target_context[:target_status] == STATUS_MISS_AND_READY
514
545
 
515
546
  dependency_targets_set = Set.new
516
547
  implicit_dependencies = []
@@ -725,7 +756,7 @@ module Zabel
725
756
  if zabel_can_cache_target(target)
726
757
  source_files = zabel_get_target_source_files(target)
727
758
  unless source_files.size >= zabel_get_min_source_file_count
728
- puts "[ZABEL/I] skip #{target.name} #{source_files.size} >= #{zabel_get_min_source_file_count}"
759
+ puts "[ZABEL/I] skip #{target.name} #{source_files.size} < #{zabel_get_min_source_file_count}"
729
760
  next
730
761
  end
731
762
  target_md5_content = zabel_get_target_md5_content(project, target, configuration_name, argv, source_files)
@@ -846,6 +877,13 @@ module Zabel
846
877
 
847
878
  start_time = Time.now
848
879
 
880
+ [BUILD_KEY_SYMROOT, BUILD_KEY_CONFIGURATION_BUILD_DIR, BUILD_KEY_OBJROOT, BUILD_KEY_TARGET_TEMP_DIR, BUILD_KEY_SRCROOT, BUILD_KEY_FULL_PRODUCT_NAME].sort.each do | key |
881
+ unless ENV.has_key? key and ENV[key] and ENV[key].size > 0
882
+ raise "[ZABEL/E] #{target.name} should have #{key}"
883
+ break
884
+ end
885
+ end
886
+
849
887
  if ENV[BUILD_KEY_CONFIGURATION_BUILD_DIR] != ENV[BUILD_KEY_TARGET_BUILD_DIR]
850
888
  command = "mkdir -p \"#{ENV[BUILD_KEY_CONFIGURATION_BUILD_DIR]}\" && cd \"#{File.dirname(ENV[BUILD_KEY_CONFIGURATION_BUILD_DIR])}/\" && tar -xf \"#{cache_product_path}\""
851
889
  puts command
@@ -877,6 +915,7 @@ module Zabel
877
915
  end
878
916
 
879
917
  def self.zabel_printenv
918
+ puts ARGV.to_s
880
919
  target_name = ARGV[1]
881
920
  project_path = ARGV[2]
882
921
 
@@ -888,6 +927,7 @@ module Zabel
888
927
  target_context[key] = ENV[key]
889
928
  end
890
929
  end
930
+ target_context[:target_status] = STATUS_MISS_AND_READY
891
931
  File.write("#{project_path}/#{target_name}.#{FILE_NAME_TARGET_CONTEXT}", target_context.to_yaml)
892
932
  end
893
933
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - dengweijun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-14 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj