Skip to content

Commit

Permalink
Exclude fileSystemSynchronizedGroups key from PBXNativeTarget when th…
Browse files Browse the repository at this point in the history
…e list is empty
  • Loading branch information
amorde committed Oct 26, 2024
1 parent 6473e92 commit d6d937a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/xcodeproj/project/object/native_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -689,19 +689,28 @@ def sort(_options = nil)

def to_hash_as(method = :to_hash)
hash_as = super
if !hash_as['packageProductDependencies'].nil? && hash_as['packageProductDependencies'].empty?
hash_as.delete('packageProductDependencies')
excluded_keys_for_serialization_when_empty.each do |key|
if !hash_as[key].nil? && hash_as[key].empty?
hash_as.delete(key)
end
end
hash_as
end

def to_ascii_plist
plist = super
if !plist.value['packageProductDependencies'].nil? && plist.value['packageProductDependencies'].empty?
plist.value.delete('packageProductDependencies')
excluded_keys_for_serialization_when_empty.each do |key|
if !plist.value[key].nil? && plist.value[key].empty?
plist.value.delete(key)
end
end
plist
end

# @return [Array<String>] array of keys to exclude from serialization when the value is empty
def excluded_keys_for_serialization_when_empty
%w(packageProductDependencies fileSystemSynchronizedGroups)
end
end

#-----------------------------------------------------------------------#
Expand Down

0 comments on commit d6d937a

Please sign in to comment.