From 0fcb3dcc78a74d271cca9f09fecb96f5b656655f Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Tue, 16 Oct 2018 21:35:31 +1100 Subject: [PATCH] use context --- Package.resolved | 2 +- Sources/XcodeGenKit/PBXProjGenerator.swift | 11 +++++------ Sources/XcodeGenKit/SourceGenerator.swift | 2 -- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Package.resolved b/Package.resolved index e5c80559..4e21b93c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -69,7 +69,7 @@ "repositoryURL": "https://github.com/tuist/xcodeproj.git", "state": { "branch": "id_conflicts", - "revision": "7f382d029fcf01bfd62ec1658f0fdf1d9aafcbb1", + "revision": "7b71bda001e28790e82c61c65f9b2e32e632d625", "version": null } }, diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 2905ac84..2539a22c 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -32,8 +32,9 @@ public class PBXProjGenerator { } } - func addObject(_ object: T) -> T { + func addObject(_ object: T, context: String? = nil) -> T { pbxProj.add(object: object) + object.context = context return object } @@ -131,9 +132,9 @@ public class PBXProjGenerator { lastKnownFileType: lastKnownFileType, path: target.filename, includeInIndex: false - ) + ), + context: target.name ) - fileReference.identifier = target.name targetFileReferences[target.name] = fileReference } @@ -377,7 +378,7 @@ public class PBXProjGenerator { if child1.nameOrPath != child2.nameOrPath { return child1.nameOrPath.localizedStandardCompare(child2.nameOrPath) == .orderedAscending } else { - return child1.identifier ?? "" < child2.identifier ?? "" + return child1.context ?? "" < child2.context ?? "" } } } @@ -389,8 +390,6 @@ public class PBXProjGenerator { } func generateTarget(_ target: Target) throws { - - sourceGenerator.targetName = target.name let carthageDependencies = getAllCarthageDependencies(target: target) let sourceFiles = try sourceGenerator.getAllSourceFiles(targetType: target.type, sources: target.sources) diff --git a/Sources/XcodeGenKit/SourceGenerator.swift b/Sources/XcodeGenKit/SourceGenerator.swift index cf2f23c0..a99e5ded 100644 --- a/Sources/XcodeGenKit/SourceGenerator.swift +++ b/Sources/XcodeGenKit/SourceGenerator.swift @@ -24,8 +24,6 @@ class SourceGenerator { ".DS_Store", ] - var targetName: String = "" - private(set) var knownRegions: Set = [] init(project: Project, addObjectClosure: @escaping (PBXObject) -> Void) {