Update formula internal json v3 to improve dependencies readability
This improves the readability of dependencies in the json we produce for this internally.
This commit is contained in:
		
							parent
							
								
									5e027bffd6
								
							
						
					
					
						commit
						039eb1adff
					
				@ -2361,13 +2361,6 @@ class Formula
 | 
			
		||||
      "ruby_source_sha256"   => ruby_source_checksum&.hexdigest,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dep_hash = dependencies_hash
 | 
			
		||||
               .except("recommended_dependencies", "optional_dependencies")
 | 
			
		||||
               .transform_values(&:presence)
 | 
			
		||||
               .compact
 | 
			
		||||
 | 
			
		||||
    api_hash.merge!(dep_hash)
 | 
			
		||||
 | 
			
		||||
    # Exclude default values.
 | 
			
		||||
    api_hash["revision"] = revision unless revision.zero?
 | 
			
		||||
    api_hash["version_scheme"] = version_scheme unless version_scheme.zero?
 | 
			
		||||
@ -2389,6 +2382,14 @@ class Formula
 | 
			
		||||
      api_hash["versioned_formulae"] = versioned_formulae_list.map(&:name)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if (dependencies = dependencies_list(:stable).presence)
 | 
			
		||||
      api_hash["dependencies"] = dependencies
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if (head_dependencies = dependencies_list(:head).presence)
 | 
			
		||||
      api_hash["head_dependencies"] = head_dependencies
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if (requirements_array = serialized_requirements.presence)
 | 
			
		||||
      api_hash["requirements"] = requirements_array
 | 
			
		||||
    end
 | 
			
		||||
@ -2608,6 +2609,19 @@ class Formula
 | 
			
		||||
    hash
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def dependencies_list(spec_symbol)
 | 
			
		||||
    return if spec_symbol != :stable && spec_symbol != :head
 | 
			
		||||
 | 
			
		||||
    send(spec_symbol)&.declared_deps&.each_with_object({}) do |dep, dep_hash|
 | 
			
		||||
      next if dep.implicit? # Remove all implicit deps
 | 
			
		||||
 | 
			
		||||
      dep_hash[dep.name] = {}.tap do |info|
 | 
			
		||||
        info[:tags] = dep.tags if dep.tags.present?
 | 
			
		||||
        info[:uses_from_macos] = dep.bounds.presence if dep.uses_from_macos?
 | 
			
		||||
      end.presence
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def on_system_blocks_exist?
 | 
			
		||||
    self.class.on_system_blocks_exist? || @on_system_blocks_exist
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user