Fixed issue on localPackage when specified as absolute path and when using -p

This commit is contained in:
freddi
2020-03-05 09:50:45 +09:00
parent d184a9d2b6
commit d8bf945ca2
3 changed files with 11 additions and 6 deletions
+1 -2
View File
@@ -57,8 +57,7 @@ public class PBXProjGenerator {
}
for (_, package) in project.localPackages {
let path = project.basePath + Path(package.path).normalize()
try sourceGenerator.createLocalPackage(path: path)
try sourceGenerator.createLocalPackage(path: Path(package.path))
}
let buildConfigs: [XCBuildConfiguration] = project.configs.map { config in
+8 -2
View File
@@ -60,12 +60,18 @@ class SourceGenerator {
localPackageGroup = addObject(PBXGroup(sourceTree: .sourceRoot, name: groupName))
rootGroups.insert(localPackageGroup!)
}
let absolutePath = path.isAbsolute ? path : project.basePath + path.normalize()
// Get local pakcage's relative path from generating project's root
let fileReferencePath = try? absolutePath.relativePath(from: projectDirectory ?? project.basePath).string
let fileReference = addObject(
PBXFileReference(
sourceTree: .sourceRoot,
sourceTree: .group,
name: path.lastComponent,
lastKnownFileType: "folder",
path: try path.relativePath(from: project.basePath).string
path: fileReferencePath
)
)
localPackageGroup!.children.append(fileReference)