mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-10 06:14:38 +03:00
Resolve local package name from abstract path
- Also, added Comment
This commit is contained in:
parent
5c380bf917
commit
af3a7e0596
@ -184,8 +184,13 @@ extension Project {
|
||||
} else {
|
||||
packages = [:]
|
||||
}
|
||||
// For backward compatibility of old `localPackages:` format
|
||||
if let localPackages: [String] = jsonDictionary.json(atKeyPath: "localPackages") {
|
||||
packages.merge(localPackages.reduce(into: [String: SwiftPackage](), { $0[$1] = .local(path: $1) }))
|
||||
packages.merge(localPackages.reduce(into: [String: SwiftPackage](), {
|
||||
// Project name will be obtained by resolved abstractpath's lastComponent for dealing with some path case, like "../"
|
||||
let packageName = (basePath + Path($1).normalize()).lastComponent
|
||||
$0[packageName] = .local(path: $1) })
|
||||
)
|
||||
}
|
||||
if jsonDictionary["options"] != nil {
|
||||
options = try jsonDictionary.json(atKeyPath: "options")
|
||||
|
@ -1108,7 +1108,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
"package7": .remote(url: "package.git", versionRequirement: .exact("1.2.2")),
|
||||
"package8": .remote(url: "package.git", versionRequirement: .upToNextMajorVersion("4.0.0-beta.5")),
|
||||
"package9": .local(path: "package/package"),
|
||||
"../XcodeGen": .local(path: "../XcodeGen")
|
||||
"XcodeGen": .local(path: "../XcodeGen")
|
||||
], options: .init(localPackagesGroup: "MyPackages"))
|
||||
|
||||
let dictionary: [String: Any] = [
|
||||
@ -1135,7 +1135,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
|
||||
$0.it("parses old local package format") {
|
||||
let project = Project(name: "spm", packages: [
|
||||
"../XcodeGen": .local(path: "../XcodeGen"),
|
||||
"XcodeGen": .local(path: "../XcodeGen"),
|
||||
"Yams": .local(path: "Yams")
|
||||
], options: .init(localPackagesGroup: "MyPackages"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user