Class: PodBuilder::Install
- Inherits:
-
Object
- Object
- PodBuilder::Install
- Defined in:
- lib/pod_builder/install.rb
Class Method Summary collapse
-
.podfile(podfile_content, podfile_items, argument_pods, build_configuration) ⇒ Object
This method will generate prebuilt data by building from “/tmp/pod_builder/Podfile”.
- .prebuilt_info(podfile_items, argument_pods) ⇒ Object
Class Method Details
.podfile(podfile_content, podfile_items, argument_pods, build_configuration) ⇒ Object
This method will generate prebuilt data by building from “/tmp/pod_builder/Podfile”
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/pod_builder/install.rb', line 47 def self.podfile(podfile_content, podfile_items, argument_pods, build_configuration) puts "Preparing build Podfile".yellow podfile_content = copy_development_pods_source_code(podfile_content, podfile_items) podfile_content = Podfile.update_path_entries(podfile_content, Install.method(:podfile_path_transform)) podfile_content = Podfile.update_project_entries(podfile_content, Install.method(:podfile_path_transform)) podfile_content = Podfile.update_require_entries(podfile_content, Install.method(:podfile_path_transform)) if Configuration.react_native_project podfile_content = Podfile.prepare_react_native_compilation_workarounds(podfile_content) end podfile_path = File.join(Configuration.build_path, "Podfile") File.write(podfile_path, podfile_content) begin lock_file = "#{Configuration.build_path}/pod_builder.lock" FileUtils.touch(lock_file) prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items, argument_pods) install copy_prebuilt_items(podfile_items - prebuilt_entries) prebuilt_info = prebuilt_info(podfile_items, argument_pods) licenses = license_specifiers() if !OPTIONS.has_key?(:debug) PodBuilder::safe_rm_rf(Configuration.build_path) end return InstallResult.new(licenses, prebuilt_info) rescue Exception => e if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj") activate_pod_scheme() if ENV["DEBUGGING"] system("xed #{Configuration.build_path}/Pods") elsif !OPTIONS.has_key?(:no_stdin_available) confirm = ask("\n\nOh no! Something went wrong during prebuild phase! Do you want to open the prebuild project to debug the error, you will need to add and run the Pods-Dummy scheme? [Y/N] ".red) { |yn| yn.limit = 1, yn.validate = /[yn]/i } if confirm.downcase == "y" system("xed #{Configuration.build_path}/Pods") end end end raise e ensure FileUtils.rm(lock_file) if File.exist?(lock_file) end end |
.prebuilt_info(podfile_items, argument_pods) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/pod_builder/install.rb', line 102 def self.prebuilt_info(podfile_items, argument_pods) gitignored_files = PodBuilder::gitignoredfiles swift_version = PodBuilder::system_swift_version ret = Hash.new root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq root_names.each do |prebuilt_name| path = PodBuilder::prebuiltpath(prebuilt_name) unless File.directory?(path) puts "Prebuilt items for #{prebuilt_name} not found".blue next end unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name } puts "Prebuilt items for #{prebuilt_name} not found #2".blue next end podbuilder_file = File.join(path, Configuration.prebuilt_info_filename) entry = podfile_item.entry(true, false) data = {} data["entry"] = entry data["is_prebuilt"] = podfile_item.is_prebuilt if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0 data["swift_version"] = swift_version end specs = podfile_items.select { |x| x.root_name == podfile_item.root_name } subspecs_deps = specs.map(&:dependency_names).flatten subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") } data["specs"] = (specs.map(&:name) + subspec_self_deps).uniq data["is_static"] = podfile_item.is_static data["original_compile_path"] = Pathname.new(Configuration.build_path).realpath.to_s if hash = build_folder_hash(podfile_item, gitignored_files) data["build_folder_hash"] = hash end if argument_pods.include?(podfile_item.root_name) data["pb_version"] = PodBuilder::VERSION end ret.merge!({ podbuilder_file => data }) end return ret end |