mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Removed localPackages variable
This commit is contained in:
@@ -20,7 +20,6 @@ public struct Project: BuildSettingsContainer {
|
||||
}
|
||||
|
||||
public var packages: [String: SwiftPackage]
|
||||
public var localPackages: [String: LocalSwiftPackage]
|
||||
|
||||
public var settings: Settings
|
||||
public var settingGroups: [String: Settings]
|
||||
@@ -51,7 +50,6 @@ public struct Project: BuildSettingsContainer {
|
||||
settingGroups: [String: Settings] = [:],
|
||||
schemes: [Scheme] = [],
|
||||
packages: [String: SwiftPackage] = [:],
|
||||
localPackages: [String: LocalSwiftPackage] = [:],
|
||||
options: SpecOptions = SpecOptions(),
|
||||
fileGroups: [String] = [],
|
||||
configFiles: [String: String] = [:],
|
||||
@@ -69,7 +67,6 @@ public struct Project: BuildSettingsContainer {
|
||||
self.settingGroups = settingGroups
|
||||
self.schemes = schemes
|
||||
self.packages = packages
|
||||
self.localPackages = localPackages
|
||||
self.options = options
|
||||
self.fileGroups = fileGroups
|
||||
self.configFiles = configFiles
|
||||
@@ -147,7 +144,6 @@ extension Project: Equatable {
|
||||
lhs.configFiles == rhs.configFiles &&
|
||||
lhs.options == rhs.options &&
|
||||
lhs.packages == rhs.packages &&
|
||||
lhs.localPackages == rhs.localPackages &&
|
||||
NSDictionary(dictionary: lhs.attributes).isEqual(to: rhs.attributes)
|
||||
}
|
||||
}
|
||||
@@ -188,12 +184,10 @@ extension Project {
|
||||
} else {
|
||||
packages = [:]
|
||||
}
|
||||
if let localPackages: [String: LocalSwiftPackage] = jsonDictionary.json(atKeyPath: "localPackages") {
|
||||
self.localPackages = localPackages
|
||||
if let localPackages: [String: SwiftPackage] = jsonDictionary.json(atKeyPath: "localPackages") {
|
||||
packages.merge(localPackages)
|
||||
} else if let localPackages: [String] = jsonDictionary.json(atKeyPath: "localPackages") {
|
||||
self.localPackages = localPackages.reduce(into: [String: LocalSwiftPackage](), { $0[$1] = LocalSwiftPackage(path: $1) })
|
||||
} else {
|
||||
self.localPackages = [:]
|
||||
packages.merge(localPackages.reduce(into: [String: SwiftPackage](), { $0[$1] = SwiftPackage(kind: .local(path: $1)) }))
|
||||
}
|
||||
if jsonDictionary["options"] != nil {
|
||||
options = try jsonDictionary.json(atKeyPath: "options")
|
||||
@@ -224,7 +218,6 @@ extension Project: PathContainer {
|
||||
static var pathProperties: [PathProperty] {
|
||||
[
|
||||
.string("configFiles"),
|
||||
.string("localPackages"),
|
||||
.object("options", SpecOptions.pathProperties),
|
||||
.object("targets", Target.pathProperties),
|
||||
.object("targetTemplates", Target.pathProperties),
|
||||
@@ -291,7 +284,6 @@ extension Project: JSONEncodable {
|
||||
dictionary["include"] = include
|
||||
dictionary["attributes"] = attributes
|
||||
dictionary["packages"] = packages.mapValues { $0.toJSONValue() }
|
||||
dictionary["localPackages"] = localPackages.mapValues { $0.toJSONValue() }
|
||||
dictionary["targets"] = Dictionary(uniqueKeysWithValues: targetPairs)
|
||||
dictionary["configs"] = Dictionary(uniqueKeysWithValues: configsPairs)
|
||||
dictionary["aggregateTargets"] = Dictionary(uniqueKeysWithValues: aggregateTargetsPairs)
|
||||
|
||||
@@ -52,12 +52,6 @@ extension Project {
|
||||
errors.append(.invalidFileGroup(fileGroup))
|
||||
}
|
||||
}
|
||||
|
||||
for (name, package) in localPackages {
|
||||
if !(basePath + Path(package.path).normalize()).exists {
|
||||
errors.append(.invalidLocalPackage(name))
|
||||
}
|
||||
}
|
||||
|
||||
for (name, package) in packages {
|
||||
if case let .local(path) = package.kind, !(basePath + Path(path).normalize()).exists {
|
||||
@@ -179,7 +173,7 @@ extension Project {
|
||||
}
|
||||
}
|
||||
case .package:
|
||||
if packages[dependency.reference] == nil, localPackages[dependency.reference] == nil {
|
||||
if packages[dependency.reference] == nil {
|
||||
errors.append(.invalidSwiftPackage(name: dependency.reference, target: target.name))
|
||||
}
|
||||
default: break
|
||||
|
||||
@@ -55,12 +55,7 @@ public class PBXProjGenerator {
|
||||
for group in project.fileGroups {
|
||||
try sourceGenerator.getFileGroups(path: group)
|
||||
}
|
||||
|
||||
let sortedlocalPackages = project.localPackages.sorted { $0.key < $1.key }
|
||||
for (_, package) in sortedlocalPackages {
|
||||
try sourceGenerator.createLocalPackage(path: Path(package.path))
|
||||
}
|
||||
|
||||
|
||||
let buildConfigs: [XCBuildConfiguration] = project.configs.map { config in
|
||||
let buildSettings = project.getProjectBuildSettings(config: config)
|
||||
var baseConfiguration: PBXFileReference?
|
||||
@@ -602,7 +597,7 @@ public class PBXProjGenerator {
|
||||
var packageDependencies: [XCSwiftPackageProductDependency] = []
|
||||
var extensions: [PBXBuildFile] = []
|
||||
var carthageFrameworksToEmbed: [String] = []
|
||||
var localPackageReferences: [String] = project.localPackages.keys + project.packages.compactMap { $0.value.kind.isLocal ? $0.key : nil }
|
||||
var localPackageReferences: [String] = project.packages.compactMap { $0.value.kind.isLocal ? $0.key : nil }
|
||||
|
||||
let targetDependencies = (target.transitivelyLinkDependencies ?? project.options.transitivelyLinkDependencies) ?
|
||||
getAllDependenciesPlusTransitiveNeedingEmbedding(target: target) : target.dependencies
|
||||
|
||||
@@ -97,7 +97,7 @@ class ProjectSpecTests: XCTestCase {
|
||||
project.settings = invalidSettings
|
||||
project.configFiles = ["invalidConfig": "invalidConfigFile"]
|
||||
project.fileGroups = ["invalidFileGroup"]
|
||||
project.localPackages = ["invalidLocalPackage" : LocalSwiftPackage(path: "invalidLocalPackage")]
|
||||
project.packages = ["invalidLocalPackage" : SwiftPackage(kind: .local(path: "invalidLocalPackage"))]
|
||||
project.settingGroups = ["settingGroup1": Settings(
|
||||
configSettings: ["invalidSettingGroupConfig": [:]],
|
||||
groups: ["invalidSettingGroupSettingGroup"]
|
||||
@@ -523,7 +523,6 @@ class ProjectSpecTests: XCTestCase {
|
||||
)
|
||||
),
|
||||
],
|
||||
localPackages: ["../../Package" : LocalSwiftPackage(path: "../../Package")],
|
||||
options: SpecOptions(minimumXcodeGenVersion: Version(major: 3, minor: 4, patch: 5),
|
||||
carthageBuildPath: "carthageBuildPath",
|
||||
carthageExecutablePath: "carthageExecutablePath",
|
||||
@@ -563,7 +562,6 @@ class ProjectSpecTests: XCTestCase {
|
||||
try expect(proj.settingGroups) == restoredProj.settingGroups
|
||||
try expect(proj.targets) == restoredProj.targets
|
||||
try expect(proj.packages) == restoredProj.packages
|
||||
try expect(proj.localPackages) == restoredProj.localPackages
|
||||
|
||||
try expect(proj) == restoredProj
|
||||
}
|
||||
|
||||
@@ -1107,10 +1107,9 @@ class SpecLoadingTests: XCTestCase {
|
||||
"package6": SwiftPackage(kind: .remote(url: "package.git", versionRequirement: .range(from: "1.2.0", to: "1.2.5"))),
|
||||
"package7": SwiftPackage(kind: .remote(url: "package.git", versionRequirement: .exact("1.2.2"))),
|
||||
"package8": SwiftPackage(kind: .remote(url: "package.git", versionRequirement: .upToNextMajorVersion("4.0.0-beta.5"))),
|
||||
"package9": SwiftPackage(kind: .local(path: "package/package"))
|
||||
],
|
||||
localPackages: ["../../Package" : LocalSwiftPackage(path: "../../Package")],
|
||||
options: .init(localPackagesGroup: "MyPackages"))
|
||||
"package9": SwiftPackage(kind: .local(path: "package/package")),
|
||||
"package10": SwiftPackage(kind: .local(path: "../XcodeGen"))
|
||||
], options: .init(localPackagesGroup: "MyPackages"))
|
||||
|
||||
let dictionary: [String: Any] = [
|
||||
"name": "spm",
|
||||
@@ -1128,7 +1127,9 @@ class SpecLoadingTests: XCTestCase {
|
||||
"package8": ["url": "package.git", "majorVersion": "4.0.0-beta.5"],
|
||||
"package9": ["path": "package/package"]
|
||||
],
|
||||
"localPackages": ["../../Package"],
|
||||
"localPackages": [
|
||||
"package10": ["path": "../XcodeGen"]
|
||||
]
|
||||
]
|
||||
let parsedSpec = try getProjectSpec(dictionary)
|
||||
try expect(parsedSpec) == project
|
||||
|
||||
@@ -992,7 +992,7 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
"XcodeGen": SwiftPackage(kind: .remote(url: "http://github.com/yonaskolb/XcodeGen", versionRequirement: .branch("master"))),
|
||||
"Codability": SwiftPackage(kind: .remote(url: "http://github.com/yonaskolb/Codability", versionRequirement: .exact("1.0.0"))),
|
||||
"Yams": SwiftPackage(kind: .local(path: "../Yams"))
|
||||
], localPackages: ["XcodeGen" : LocalSwiftPackage(path: "../XcodeGen")], options: .init(localPackagesGroup: "MyPackages"))
|
||||
], options: .init(localPackagesGroup: "MyPackages"))
|
||||
|
||||
let pbxProject = try project.generatePbxProj(specValidate: false)
|
||||
let nativeTarget = try unwrap(pbxProject.nativeTargets.first(where: { $0.name == app.name }))
|
||||
@@ -1010,11 +1010,6 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
|
||||
let localPackagesGroup = try unwrap(try pbxProject.getMainGroup().children.first(where: { $0.name == "MyPackages" }) as? PBXGroup)
|
||||
|
||||
let xcodeLocalPackageFile = try unwrap(pbxProject.fileReferences.first(where: { $0.path == "../XcodeGen" }))
|
||||
try expect(localPackagesGroup.children.contains(xcodeLocalPackageFile)) == true
|
||||
try expect(xcodeLocalPackageFile.lastKnownFileType) == "folder"
|
||||
|
||||
|
||||
let yamsLocalPackageFile = try unwrap(pbxProject.fileReferences.first(where: { $0.path == "../Yams" }))
|
||||
try expect(localPackagesGroup.children.contains(yamsLocalPackageFile)) == true
|
||||
try expect(yamsLocalPackageFile.lastKnownFileType) == "folder"
|
||||
@@ -1030,7 +1025,7 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
]
|
||||
)
|
||||
|
||||
let project = Project(name: "test", targets: [app], localPackages: ["XcodeGen" : LocalSwiftPackage(path: "../XcodeGen")])
|
||||
let project = Project(name: "test", targets: [app], packages: ["XcodeGen" : SwiftPackage(kind: .local(path: "../XcodeGen"))])
|
||||
|
||||
let pbxProject = try project.generatePbxProj(specValidate: false)
|
||||
let nativeTarget = try unwrap(pbxProject.nativeTargets.first(where: { $0.name == app.name }))
|
||||
|
||||
Reference in New Issue
Block a user