66// Copyright © 2017 Geoffrey Foster. All rights reserved.
77//
88
9- public final class PBXBuildFile : PBXObject {
9+ public final class PBXBuildFile : PBXProjectItem {
1010 private enum CodingKeys : String , CodingKey {
1111 case fileRef
1212 case settings
13+ case productRef
1314 }
1415 public enum Attribute : String , Comparable , Encodable {
1516 public static func < ( lhs: PBXBuildFile . Attribute , rhs: PBXBuildFile . Attribute ) -> Bool {
@@ -18,6 +19,7 @@ public final class PBXBuildFile: PBXObject {
1819
1920 case `public` = " Public "
2021 case `private` = " Private "
22+ case required = " Required "
2123 case `weak` = " Weak "
2224 case client = " Client "
2325 case server = " Server "
@@ -61,6 +63,8 @@ public final class PBXBuildFile: PBXObject {
6163 }
6264 var settings : Settings ?
6365
66+ private( set) var productReference : PBXProductDependency ?
67+
6468 public convenience init ( globalID: PBXGlobalID , fileReference: PBXReference ) {
6569 self . init ( globalID: globalID)
6670 fileRef = fileReference
@@ -71,24 +75,27 @@ public final class PBXBuildFile: PBXObject {
7175 var container = encoder. container ( keyedBy: CodingKeys . self)
7276 try container. encodeIfPresent ( fileRef, forKey: . fileRef)
7377 try container. encodeIfPresent ( settings, forKey: . settings)
78+ try container. encodeIfPresent ( productReference, forKey: . productRef)
7479 }
7580
7681 override func update( with plist: PropertyList , objectCache: ObjectCache ) {
7782 super. update ( with: plist, objectCache: objectCache)
78- self . fileRef = objectCache. object ( for: PBXGlobalID ( rawValue: plist [ " fileRef " ] ? . string) )
83+ self . fileRef = objectCache. object ( for: PBXGlobalID ( rawValue: plist [ CodingKeys . fileRef] ? . string) )
84+ self . productReference = objectCache. object ( for: PBXGlobalID ( rawValue: plist [ CodingKeys . productRef] ? . string) )
7985 self . settings = Settings ( plist [ " settings " ] ? . dictionary)
8086 }
8187
8288 override var archiveComment : String {
83- guard let fileRef = fileRef , let parent = parent else {
89+ guard let parent = parent , let refComment = fileRef ? . archiveComment ?? productReference ? . archiveComment else {
8490 return super. archiveComment
8591 }
86- return " \( fileRef . archiveComment ) in \( parent. archiveComment) "
92+ return " \( refComment ) in \( parent. archiveComment) "
8793 }
8894
8995 override func visit( _ visitor: ObjectVisitor ) {
9096 super. visit ( visitor)
9197 visitor. visit ( object: fileRef)
98+ visitor. visit ( object: productReference)
9299 }
93100
94101 override var archiveInPlistOnSingleLine : Bool {
0 commit comments