Class: Pod::Generate::PodfileGenerator
- Inherits:
-
Object
- Object
- Pod::Generate::PodfileGenerator
- Defined in:
- lib/cocoapods-tj/native/podfile_generator.rb
Instance Method Summary collapse
-
#podfile_for_spec(spec) ⇒ Object
alias old_podfile_for_spec podfile_for_spec.
Instance Method Details
#podfile_for_spec(spec) ⇒ Object
alias old_podfile_for_spec podfile_for_spec
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 101 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 |
# File 'lib/cocoapods-tj/native/podfile_generator.rb', line 16 def podfile_for_spec(spec) generator = self dir = configuration.gen_dir_for_pod(spec.name) Pod::Podfile.new do project "#{spec.name}.xcodeproj" workspace "#{spec.name}.xcworkspace" plugin 'cocoapods-generate' install! 'cocoapods', generator. generator.podfile_plugins.each do |name, | plugin(*[name, ].compact) end use_frameworks!(generator.configuration.use_frameworks?) if (supported_swift_versions = generator.supported_swift_versions) supports_swift_versions(supported_swift_versions) end # Explicitly set sources generator.configuration.sources.each do |source_url| source(source_url) end self.defined_in_file = dir.join('CocoaPods.podfile.yaml') test_specs = spec.recursive_subspecs.select(&:test_specification?) app_specs = if spec.respond_to?(:app_specification?) spec.recursive_subspecs.select(&:app_specification?) else [] end spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name| !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase) end spec_platform_names.sort.each do |platform_name| target "App-#{platform_name}" do current_target_definition.swift_version = generator.swift_version if generator.swift_version end end inhibit_all_warnings! if generator.inhibit_all_warnings? use_modular_headers! if generator.use_modular_headers? = generator.dependency_compilation_kwargs(spec.name) [:path] = spec.defined_in_file.relative_path_from(dir).to_s { testspecs: test_specs, appspecs: app_specs }.each do |key, specs| [key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty? end pod spec.name, ** if Pod::Config.instance.podfile target_definitions['Pods'].instance_exec do target_definition = nil Pod::Config.instance.podfile.target_definition_list.each do |target| if target.label == "Pods-#{spec.name}" target_definition = target break end end if(target_definition && target_definition.use_modular_headers_hash.values.any?) target_definition.use_modular_headers_hash.values.each do |f| f.each { | pod_name| self.set_use_modular_headers_for_pod(pod_name, true) } end end if target_definition value = target_definition.to_hash['dependencies'] next if value.blank? value.each do |f| if f.is_a?(Hash) && f.keys.first == spec.name value.delete f break end end old_value = self.to_hash['dependencies'].first value << old_value unless (old_value == nil || value.include?(old_value)) set_hash_value(%w(dependencies).first, value) value = target_definition.to_hash['configuration_pod_whitelist'] next if value.blank? set_hash_value(%w(configuration_pod_whitelist).first, value) end end end next if generator.configuration.local_sources.empty? generator.transitive_local_dependencies(spec, generator.configuration.local_sources).each do |dependency, podspec_file| = generator.dependency_compilation_kwargs(dependency.name) [:path] = if podspec_file[0] == '/' # absolute path podspec_file else '../../' + podspec_file end pod dependency.name, ** end end end |