mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Make sure to create parent group structure for local packages (#1417)
* Make sure to create parent group structure for local packages * Remove redundant localPackageGroup variable --------- Co-authored-by: Jaap Manenschijn <jaap.maneschijn@rabobank.nl>
This commit is contained in:
co-authored by
Jaap Manenschijn
parent
19109ac8c1
commit
54139090a3
@@ -18,7 +18,6 @@ class SourceGenerator {
|
||||
private var fileReferencesByPath: [String: PBXFileElement] = [:]
|
||||
private var groupsByPath: [Path: PBXGroup] = [:]
|
||||
private var variantGroupsByPath: [Path: PBXVariantGroup] = [:]
|
||||
private var localPackageGroup: PBXGroup?
|
||||
|
||||
private let project: Project
|
||||
let pbxProj: PBXProj
|
||||
@@ -54,19 +53,11 @@ class SourceGenerator {
|
||||
}
|
||||
|
||||
func createLocalPackage(path: Path, group: Path?) throws {
|
||||
var pbxGroup: PBXGroup?
|
||||
|
||||
if let location = group {
|
||||
let fullLocationPath = project.basePath + location
|
||||
pbxGroup = getGroup(path: fullLocationPath, mergingChildren: [], createIntermediateGroups: true, hasCustomParent: false, isBaseGroup: true)
|
||||
var parentGroup: String = project.options.localPackagesGroup ?? "Packages"
|
||||
if let group {
|
||||
parentGroup = group.string
|
||||
}
|
||||
|
||||
if localPackageGroup == nil && group == nil {
|
||||
let groupName = project.options.localPackagesGroup ?? "Packages"
|
||||
localPackageGroup = addObject(PBXGroup(sourceTree: .sourceRoot, name: groupName))
|
||||
rootGroups.insert(localPackageGroup!)
|
||||
}
|
||||
|
||||
|
||||
let absolutePath = project.basePath + path.normalize()
|
||||
|
||||
// Get the local package's relative path from the project root
|
||||
@@ -80,11 +71,9 @@ class SourceGenerator {
|
||||
path: fileReferencePath
|
||||
)
|
||||
)
|
||||
if let pbxGroup = pbxGroup {
|
||||
pbxGroup.children.append(fileReference)
|
||||
} else {
|
||||
localPackageGroup!.children.append(fileReference)
|
||||
}
|
||||
|
||||
let parentGroups = parentGroup.components(separatedBy: "/")
|
||||
createParentGroups(parentGroups, for: fileReference)
|
||||
}
|
||||
|
||||
/// Collects an array complete of all `SourceFile` objects that make up the target based on the provided `TargetSource` definitions.
|
||||
|
||||
Reference in New Issue
Block a user