cocoapods-binary-cache 0.1.5 → 0.1.10

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-binary-cache/cache/validation_result.rb +4 -0
  3. data/lib/cocoapods-binary-cache/cache/validator.rb +1 -1
  4. data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +7 -2
  5. data/lib/cocoapods-binary-cache/dependencies_graph/dependencies_graph.rb +20 -25
  6. data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
  7. data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +9 -1
  8. data/lib/cocoapods-binary-cache/diagnosis/integration.rb +7 -3
  9. data/lib/cocoapods-binary-cache/env.rb +1 -1
  10. data/lib/cocoapods-binary-cache/helper/checksum.rb +10 -4
  11. data/lib/cocoapods-binary-cache/helper/lockfile.rb +1 -1
  12. data/lib/cocoapods-binary-cache/helper/podspec.rb +4 -2
  13. data/lib/cocoapods-binary-cache/hooks/post_install.rb +2 -12
  14. data/lib/cocoapods-binary-cache/hooks/pre_install.rb +22 -39
  15. data/lib/cocoapods-binary-cache/main.rb +0 -1
  16. data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +37 -0
  17. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
  18. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +2 -9
  19. data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -14
  20. data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
  21. data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
  22. data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
  23. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
  24. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
  25. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
  26. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +27 -12
  27. data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -62
  28. data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +45 -121
  29. data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -63
  30. data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
  31. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +195 -0
  32. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +48 -0
  33. data/lib/cocoapods-binary-cache/prebuild_output/output.rb +7 -5
  34. data/lib/cocoapods-binary-cache/state_store.rb +16 -6
  35. data/lib/command/binary.rb +20 -1
  36. data/lib/command/config.rb +177 -8
  37. data/lib/command/executor/base.rb +9 -1
  38. data/lib/command/executor/fetcher.rb +5 -3
  39. data/lib/command/executor/prebuilder.rb +9 -7
  40. data/lib/command/executor/pusher.rb +2 -0
  41. data/lib/command/executor/visualizer.rb +3 -2
  42. data/lib/command/fetch.rb +0 -1
  43. data/lib/command/prebuild.rb +19 -3
  44. data/lib/command/push.rb +0 -1
  45. metadata +9 -11
  46. data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
  47. data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
  48. data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
  49. data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
  50. data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -248
  51. data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
@@ -18,5 +18,4 @@ require_relative "pod-binary/prebuild_hook"
18
18
  require_relative "pod-binary/prebuild"
19
19
  require_relative "prebuild_output/metadata"
20
20
  require_relative "prebuild_output/output"
21
- require_relative "scheme_editor"
22
21
  require_relative "diagnosis/diagnosis"
@@ -0,0 +1,37 @@
1
+ require_relative "../../pod-rome/xcodebuild_raw"
2
+ require_relative "../../pod-rome/xcodebuild_command"
3
+
4
+ module PodPrebuild
5
+ def self.build(options)
6
+ targets = options[:targets] || []
7
+ return if targets.empty?
8
+
9
+ options[:sandbox] = Pod::Sandbox.new(Pathname(options[:sandbox])) unless options[:sandbox].is_a?(Pod::Sandbox)
10
+ options[:build_dir] = build_dir(options[:sandbox].root)
11
+
12
+ case targets[0].platform.name
13
+ when :ios, :tvos, :watchos
14
+ PodPrebuild::XcodebuildCommand.new(options).run
15
+ when :osx
16
+ xcodebuild(
17
+ sandbox: options[:sandbox],
18
+ targets: targets,
19
+ configuration: options[:configuration],
20
+ sdk: "macosx",
21
+ args: options[:args]
22
+ )
23
+ else
24
+ raise "Unsupported platform for '#{targets[0].name}': '#{targets[0].platform.name}'"
25
+ end
26
+ raise "The build directory was not found in the expected location" unless options[:build_dir].directory?
27
+ end
28
+
29
+ def self.remove_build_dir(sandbox_root)
30
+ path = build_dir(sandbox_root)
31
+ path.rmtree if path.exist?
32
+ end
33
+
34
+ def self.build_dir(sandbox_root)
35
+ sandbox_root.parent + "build"
36
+ end
37
+ end
@@ -3,7 +3,7 @@ module Pod
3
3
  # Returns the names of pod targets detected as prebuilt, including
4
4
  # those declared in Podfile and their dependencies
5
5
  def prebuilt_pod_names
6
- prebuilt_pod_targets.map(&:name)
6
+ prebuilt_pod_targets.map(&:name).to_set
7
7
  end
8
8
 
9
9
  # Returns the pod targets detected as prebuilt, including
@@ -17,7 +17,7 @@ module Pod
17
17
  targets = pod_targets.select { |target| explicit_prebuilt_pod_names.include?(target.pod_name) }
18
18
  dependencies = targets.flat_map(&:recursive_dependent_targets) # Treat dependencies as prebuilt pods
19
19
  all = (targets + dependencies).uniq
20
- all = all.reject { |target| sandbox.local?(target.pod_name) } unless Podfile::DSL.dev_pods_enabled?
20
+ all = all.reject { |target| sandbox.local?(target.pod_name) } unless PodPrebuild.config.dev_pods_enabled?
21
21
  all
22
22
  end
23
23
  end
@@ -4,19 +4,12 @@ module Pod
4
4
  def detect_prebuilt_pod(name, requirements)
5
5
  @explicit_prebuilt_pod_names ||= []
6
6
  options = requirements.last || {}
7
- if Pod::Podfile::DSL.prebuild_all?
8
- @explicit_prebuilt_pod_names << Specification.root_name(name)
9
- elsif options.is_a?(Hash) && options[:binary]
10
- @explicit_prebuilt_pod_names << Specification.root_name(name)
11
- end
7
+ @explicit_prebuilt_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options[:binary]
12
8
  options.delete(:binary) if options.is_a?(Hash)
13
9
  requirements.pop if options.empty?
14
10
  end
15
11
 
16
- # Returns the names of pod targets explicitly declared as prebuilt in Podfile
17
- # using `:binary => true`.
18
- # In case `prebuild_all` is ON via `config_cocoapods_binary_cache`, returns the
19
- # name of all pod targets
12
+ # Returns the names of pod targets explicitly declared as prebuilt in Podfile using `:binary => true`.
20
13
  def explicit_prebuilt_pod_names
21
14
  names = @explicit_prebuilt_pod_names || []
22
15
  names += parent.explicit_prebuilt_pod_names if !parent.nil? && parent.is_a?(TargetDefinition)
@@ -4,43 +4,44 @@ module Pod
4
4
  class PrebuildSandbox < Sandbox
5
5
  # [String] standard_sandbox_path
6
6
  def self.from_standard_sanbox_path(path)
7
- prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild::Config.instance.prebuild_path
8
- self.new(prebuild_sandbox_path)
7
+ prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild.config.prebuild_sandbox_path
8
+ new(prebuild_sandbox_path)
9
9
  end
10
10
 
11
11
  def self.from_standard_sandbox(sandbox)
12
- self.from_standard_sanbox_path(sandbox.root)
12
+ from_standard_sanbox_path(sandbox.root)
13
13
  end
14
14
 
15
15
  def standard_sanbox_path
16
- self.root.parent
16
+ root.parent
17
17
  end
18
18
 
19
19
  def generate_framework_path
20
- self.root + "GeneratedFrameworks"
20
+ root + "GeneratedFrameworks"
21
21
  end
22
22
 
23
23
  # @param name [String] pass the target.name (may containing platform suffix)
24
24
  # @return [Pathname] the folder containing the framework file.
25
25
  def framework_folder_path_for_target_name(name)
26
- self.generate_framework_path + name
26
+ generate_framework_path + name
27
27
  end
28
28
 
29
29
  def exsited_framework_target_names
30
- exsited_framework_name_pairs.map { |pair| pair[0] }.uniq
30
+ existed_framework_name_pairs.map { |pair| pair[0] }.uniq
31
31
  end
32
32
 
33
33
  def exsited_framework_pod_names
34
- exsited_framework_name_pairs.map { |pair| pair[1] }.uniq
34
+ existed_framework_name_pairs.map { |pair| pair[1] }.uniq
35
35
  end
36
36
 
37
37
  def existed_target_names_for_pod_name(pod_name)
38
- exsited_framework_name_pairs.select { |pair| pair[1] == pod_name }.map { |pair| pair[0] }
38
+ existed_framework_name_pairs.select { |pair| pair[1] == pod_name }.map { |pair| pair[0] }
39
39
  end
40
40
 
41
41
  def save_pod_name_for_target(target)
42
42
  folder = framework_folder_path_for_target_name(target.name)
43
43
  return unless folder.exist?
44
+
44
45
  flag_file_path = folder + "#{target.pod_name}.pod_name"
45
46
  File.write(flag_file_path.to_s, "")
46
47
  end
@@ -53,16 +54,16 @@ module Pod
53
54
  end
54
55
  name = name.basename(".pod_name").to_s unless name.nil?
55
56
  name ||= Pathname.new(target_folder_path).basename.to_s # for compatibility with older version
57
+ name
56
58
  end
57
59
 
58
60
  # Array<[target_name, pod_name]>
59
- def exsited_framework_name_pairs
61
+ def existed_framework_name_pairs
60
62
  return [] unless generate_framework_path.exist?
61
- generate_framework_path.children().map do |framework_path|
62
- if framework_path.directory? && (not framework_path.children.empty?)
63
+
64
+ generate_framework_path.children.map do |framework_path|
65
+ if framework_path.directory? && !framework_path.children.empty?
63
66
  [framework_path.basename.to_s, pod_name_for_target_folder(framework_path)]
64
- else
65
- nil
66
67
  end
67
68
  end.reject(&:nil?).uniq
68
69
  end
@@ -1,16 +1,15 @@
1
1
  module Pod
2
2
  class Prebuild
3
-
4
3
  # Check the targets, for the current limitation of the plugin
5
4
  #
6
5
  # @param [Array<PodTarget>] prebuilt_targets
7
6
  def self.check_one_pod_should_have_only_one_target(prebuilt_targets)
8
- targets_have_different_platforms = prebuilt_targets.select { |t| t.pod_name != t.name }
7
+ targets_have_different_platforms = prebuilt_targets.reject { |t| t.pod_name == t.name }
8
+ return unless targets_have_different_platforms.empty?
9
9
 
10
- if targets_have_different_platforms.count > 0
11
- names = targets_have_different_platforms.map(&:pod_name)
12
- raw_names = targets_have_different_platforms.map(&:name)
13
- message = "Oops, you came across a limitation of cocoapods-binary.
10
+ names = targets_have_different_platforms.map(&:pod_name)
11
+ raw_names = targets_have_different_platforms.map(&:name)
12
+ message = "Oops, you came across a limitation of cocoapods-binary.
14
13
 
15
14
  The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
16
15
  causing this problem:
@@ -36,10 +35,8 @@ causing this problem:
36
35
  end
37
36
  ```
38
37
 
39
- Related pods: #{names}, target names: #{raw_names}
40
- "
41
- raise Informative, message
42
- end
38
+ Related pods: #{names}, target names: #{raw_names}"
39
+ raise Informative, message
43
40
  end
44
41
  end
45
42
  end
@@ -1,11 +1,10 @@
1
1
  require_relative "helper/podfile_options"
2
2
  require_relative "helper/prebuild_sandbox"
3
- require_relative "helper/passer"
4
3
  require_relative "helper/names"
5
4
  require_relative "helper/target_checker"
6
5
  require_relative "integration/alter_specs"
7
- require_relative "integration/remove_target_files"
8
6
  require_relative "integration/validation"
9
7
  require_relative "integration/patch/embed_framework_script"
8
+ require_relative "integration/patch/sandbox_analyzer_state"
10
9
  require_relative "integration/patch/resolve_dependencies"
11
10
  require_relative "integration/patch/source_installation"
@@ -15,6 +15,7 @@ module Pod
15
15
  # as to compitable with older version and be less wordy.
16
16
  framework_file_path = target.framework_name
17
17
  framework_file_path = target.name + "/" + framework_file_path if targets.count > 1
18
+ framework_file_path = PodPrebuild.config.prebuilt_path(path: framework_file_path)
18
19
  add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
19
20
  end
20
21
 
@@ -61,7 +62,9 @@ module Pod
61
62
  attributes["resource_bundles"] = nil
62
63
  attributes["resources"] ||= []
63
64
  attributes["resources"] = [attributes["resources"]] if attributes["resources"].is_a?(String)
64
- attributes["resources"] += resource_bundle_names.map { |n| n + ".bundle" }
65
+ attributes["resources"] += resource_bundle_names.map do |name|
66
+ PodPrebuild.config.prebuilt_path(path: "#{name}.bundle")
67
+ end
65
68
  end
66
69
 
67
70
  add_resource_bundles_to_resources.call(spec.attributes_hash)
@@ -9,7 +9,7 @@ module Pod
9
9
  class EmbedFrameworksScript
10
10
  old_method = instance_method(:script)
11
11
  define_method(:script) do
12
- script = old_method.bind(self).()
12
+ script = old_method.bind(self).call
13
13
  patch = <<-SH.strip_heredoc
14
14
  #!/bin/sh
15
15
  # ---- this is added by cocoapods-binary ---
@@ -7,9 +7,6 @@ module Pod
7
7
  # Modify specification to use only the prebuild framework after analyzing
8
8
  original_resolve_dependencies = instance_method(:resolve_dependencies)
9
9
  define_method(:resolve_dependencies) do
10
- # Remove the old target files. Otherwise, it will not notice file changes.
11
- # This call is to make sure subsequent pod installations function properly
12
- remove_target_files_if_needed
13
10
  original_resolve_dependencies.bind(self).call
14
11
 
15
12
  # check the pods
@@ -0,0 +1,29 @@
1
+ module Pod
2
+ class Installer
3
+ class Analyzer
4
+ class SandboxAnalyzer
5
+ original_analyze = instance_method(:analyze)
6
+ define_method(:analyze) do
7
+ state = original_analyze.bind(self).call
8
+ state = alter_state(state)
9
+ state
10
+ end
11
+
12
+ private
13
+
14
+ def alter_state(state)
15
+ return state if PodPrebuild.config.tracked_prebuilt_pod_names.empty?
16
+
17
+ prebuilt = PodPrebuild.config.tracked_prebuilt_pod_names
18
+ Pod::UI.message "Alter sandbox state: treat prebuilt frameworks as added: #{prebuilt.to_a}"
19
+ SpecsState.new(
20
+ :added => (state.added + prebuilt).uniq,
21
+ :changed => state.changed - prebuilt,
22
+ :removed => state.deleted - prebuilt,
23
+ :unchanged => state.unchanged - prebuilt
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,27 +3,42 @@ require_relative "../source_installer"
3
3
  module Pod
4
4
  class Installer
5
5
  # Override the download step to skip download and prepare file in target folder
6
- define_method(:install_source_of_pod) do |pod_name|
7
- pod_installer = create_pod_installer(pod_name)
8
- # Injected code
9
- # ------------------------------------------
10
- if should_integrate_prebuilt_pod?(pod_name)
11
- pod_installer.install_for_prebuild!(sandbox)
6
+ alias original_create_pod_installer create_pod_installer
7
+ def create_pod_installer(name)
8
+ if should_integrate_prebuilt_pod?(name)
9
+ create_prebuilt_source_installer(name)
12
10
  else
13
- pod_installer.install!
11
+ create_normal_source_installer(name)
14
12
  end
15
- # ------------------------------------------
16
- @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)
13
+ end
14
+
15
+ private
16
+
17
+ def create_normal_source_installer(name)
18
+ original_create_pod_installer(name)
19
+ end
20
+
21
+ def create_prebuilt_source_installer(name)
22
+ source_installer = PodSourceInstaller.new(sandbox, podfile, specs_for_pod(name))
23
+ pod_installer = PrebuiltSourceInstaller.new(
24
+ sandbox,
25
+ podfile,
26
+ specs_for_pod(name),
27
+ source_installer: source_installer
28
+ )
29
+ pod_installers << pod_installer
30
+ pod_installer
17
31
  end
18
32
 
19
33
  def should_integrate_prebuilt_pod?(name)
20
- if Pod::Podfile::DSL.prebuild_job?
34
+ if PodPrebuild.config.prebuild_job? && PodPrebuild.config.targets_to_prebuild_from_cli.empty?
21
35
  # In a prebuild job, at the integration stage, all prebuilt frameworks should be
22
36
  # ready for integration regardless of whether there was any cache miss or not.
23
37
  # Those that are missed were prebuilt in the prebuild stage.
24
- PodPrebuild::StateStore.cache_validation.include?(name)
38
+ PodPrebuild.state.cache_validation.include?(name)
25
39
  else
26
- PodPrebuild::StateStore.cache_validation.hit?(name)
40
+ prebuilt = PodPrebuild.state.cache_validation.hit + PodPrebuild.config.targets_to_prebuild_from_cli
41
+ prebuilt.include?(name)
27
42
  end
28
43
  end
29
44
  end
@@ -1,80 +1,50 @@
1
- # NOTE:
2
- # This file will only be loaded on normal pod install step
3
- # so there's no need to check is_prebuild_stage
4
-
5
- # Provide a special "download" process for prebuilded pods.
6
- #
7
- # As the frameworks is already exsited in local folder. We
8
- # just create a symlink to the original target folder.
9
- #
10
1
  module Pod
11
2
  class Installer
12
- class PodSourceInstaller
13
- def install_for_prebuild!(standard_sanbox)
14
- return if !Podfile::DSL.dev_pods_enabled && standard_sanbox.local?(name)
3
+ class PrebuiltSourceInstaller < PodSourceInstaller
4
+ def initialize(*args, **kwargs)
5
+ @source_installer = kwargs.delete(:source_installer)
6
+ super(*args, **kwargs)
7
+ end
15
8
 
16
- # make a symlink to target folder
17
- # TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
18
- prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
19
- # if spec used in multiple platforms, it may return multiple paths
20
- target_names = prebuild_sandbox.existed_target_names_for_pod_name(self.name)
9
+ def prebuild_sandbox
10
+ @prebuild_sandbox ||= Pod::PrebuildSandbox.from_standard_sandbox(sandbox)
11
+ end
21
12
 
22
- def walk(path, &action)
23
- return unless path.exist?
24
- path.children.each do |child|
25
- result = action.call(child, &action)
26
- if child.directory?
27
- walk(child, &action) if result
28
- end
29
- end
30
- end
13
+ def install!
14
+ @source_installer.install! if PodPrebuild.config.still_download_sources?(name)
15
+ install_prebuilt_framework!
16
+ end
31
17
 
32
- def make_link(source, target)
33
- source = Pathname.new(source)
34
- target = Pathname.new(target)
35
- target.parent.mkpath unless target.parent.exist?
36
- relative_source = source.relative_path_from(target.parent)
37
- FileUtils.ln_sf(relative_source, target)
38
- end
18
+ private
39
19
 
40
- def mirror_with_symlink(source, basefolder, target_folder)
41
- target = target_folder + source.relative_path_from(basefolder)
42
- make_link(source, target)
43
- end
20
+ def install_prebuilt_framework!
21
+ return if !PodPrebuild.config.dev_pods_enabled? && sandbox.local?(name)
44
22
 
23
+ # make a symlink to target folder
24
+ # TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
25
+ # if spec used in multiple platforms, it may return multiple paths
26
+ target_names = prebuild_sandbox.existed_target_names_for_pod_name(name)
45
27
  target_names.each do |name|
46
-
47
- # symbol link copy all substructure
48
28
  real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
49
29
 
50
30
  # If have only one platform, just place int the root folder of this pod.
51
31
  # If have multiple paths, we use a sperated folder to store different
52
32
  # platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
53
-
54
- target_folder = standard_sanbox.pod_dir(self.name)
55
- if target_names.count > 1
56
- target_folder += real_file_folder.basename
57
- end
58
-
59
- if !standard_sanbox.local?(name)
60
- target_folder.rmtree if target_folder.exist?
61
- target_folder.mkpath
62
- else
63
- system "find #{target_folder} -type l -delete" # Only clean up symlink, keep source code for local pod
64
- end
33
+ target_folder = sandbox.pod_dir(self.name)
34
+ target_folder += real_file_folder.basename if target_names.count > 1
35
+ target_folder += PodPrebuild.config.prebuilt_path
36
+ target_folder.rmtree if target_folder.exist?
37
+ target_folder.mkpath
65
38
 
66
39
  walk(real_file_folder) do |child|
67
40
  source = child
68
41
  # only make symlink to file and `.framework` folder
69
- if child.directory? and [".framework", ".dSYM"].include? child.extname
70
- if child.extname == ".framework"
71
- mirror_with_symlink(source, real_file_folder, target_folder)
72
- else
73
- # Ignore dsym here to avoid cocoapods from adding install_dsym to buildphase-script
74
- # That can cause duplicated output files error in Xcode 11 (warning in Xcode 10)
75
- # We need more setup to support local debuging with prebuilt dSYM
76
- end
77
- next false # return false means don't go deeper
42
+ if child.directory? && [".framework", ".dSYM"].include?(child.extname)
43
+ mirror_with_symlink(source, real_file_folder, target_folder) if child.extname == ".framework"
44
+ # Ignore dsym here to avoid cocoapods from adding install_dsym to buildphase-script
45
+ # That can cause duplicated output files error in Xcode 11 (warning in Xcode 10)
46
+ # We need more setup to support local debuging with prebuilt dSYM
47
+ next false # Don't go deeper
78
48
  elsif child.file?
79
49
  mirror_with_symlink(source, real_file_folder, target_folder)
80
50
  next true
@@ -88,8 +58,9 @@ module Pod
88
58
  next unless metadata.static_framework?
89
59
 
90
60
  metadata.resources.each do |path|
91
- target_file_path = path.sub("${PODS_ROOT}", sandbox.root.to_path)
92
- .sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
61
+ target_file_path = path
62
+ .sub("${PODS_ROOT}", sandbox.root.to_path)
63
+ .sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
93
64
  real_file_path = real_file_folder + metadata.framework_name + File.basename(path)
94
65
  case File.extname(path)
95
66
  when ".xib"
@@ -107,6 +78,30 @@ module Pod
107
78
  end
108
79
  end
109
80
  end
81
+
82
+ def walk(path, &action)
83
+ return unless path.exist?
84
+
85
+ path.children.each do |child|
86
+ result = action.call(child, &action)
87
+ if child.directory?
88
+ walk(child, &action) if result
89
+ end
90
+ end
91
+ end
92
+
93
+ def make_link(source, target)
94
+ source = Pathname.new(source)
95
+ target = Pathname.new(target)
96
+ target.rmtree if target.exist?
97
+ target.parent.mkpath unless target.parent.exist?
98
+ relative_source = source.relative_path_from(target.parent)
99
+ FileUtils.ln_sf(relative_source, target)
100
+ end
101
+
102
+ def mirror_with_symlink(source, basefolder, target_folder)
103
+ make_link(source, target_folder + source.relative_path_from(basefolder))
104
+ end
110
105
  end
111
106
  end
112
107
  end