Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 372f20f

Browse files
OdNairyyonaskolb
andauthored
Reuse ReferenceProxy references when possible (yonaskolb#1354)
* Reuse ReferenceProxy references when possible * Add changelog * Update CHANGELOG.md --------- Co-authored-by: Yonas Kolb <[email protected]>
1 parent 9766326 commit 372f20f

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22

33
## Next Version
44

5+
### Added
6+
7+
### Fixed
8+
9+
- Fix external dependencies from being removed by Xcode #1354 @OdNairy
10+
511
## 2.35.0
612

713
### Added
814

915
- Added support for shared breakpoints #177 @alexruperez @myihsan
10-
- Added support for `putResourcesBeforeSourcesBuildPhase` in a target #1351 @mat1th
16+
- Added support for `putResourcesBeforeSourcesBuildPhase` in a target #1351 @mat1th
1117

1218
### Fixed
1319

Sources/XcodeGenKit/PBXProjGenerator.swift

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,16 +423,32 @@ public class PBXProjGenerator {
423423
path = "lib\(tmpPath)"
424424
}
425425

426-
let productReferenceProxy = addObject(
427-
PBXReferenceProxy(
428-
fileType: targetObject.productNameWithExtension().flatMap { Xcode.fileType(path: Path($0)) },
429-
path: path,
430-
remote: productProxy,
431-
sourceTree: .buildProductsDir
426+
let productReferenceProxyFileType = targetObject.productNameWithExtension()
427+
.flatMap { Xcode.fileType(path: Path($0)) }
428+
429+
let existingValue = self.pbxProj.referenceProxies.first { referenceProxy in
430+
referenceProxy.path == path &&
431+
referenceProxy.remote == productProxy &&
432+
referenceProxy.sourceTree == .buildProductsDir &&
433+
referenceProxy.fileType == productReferenceProxyFileType
434+
}
435+
436+
let productReferenceProxy: PBXReferenceProxy
437+
if let existingValue = existingValue {
438+
productReferenceProxy = existingValue
439+
} else {
440+
productReferenceProxy = addObject(
441+
PBXReferenceProxy(
442+
fileType: productReferenceProxyFileType,
443+
path: path,
444+
remote: productProxy,
445+
sourceTree: .buildProductsDir
446+
)
432447
)
433-
)
434448

435-
productsGroup.children.append(productReferenceProxy)
449+
productsGroup.children.append(productReferenceProxy)
450+
}
451+
436452

437453
let targetDependency = addObject(
438454
PBXTargetDependency(

0 commit comments

Comments
 (0)