Skip to content

Commit d6c3dc4

Browse files
authored
Merge pull request #13 from yokomotod/feature/fixBug
fix bugs
2 parents ea7e0f4 + 2edd2a9 commit d6c3dc4

File tree

2 files changed

+63
-64
lines changed

2 files changed

+63
-64
lines changed

Sources/PBXObject.swift

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public /* abstract */ class PBXObject {
5858
func dictionary(_ key: String) -> [String: Any]? {
5959
return dict[key] as? [String: Any]
6060
}
61-
61+
6262
func toDictionary() -> JsonObject {
6363
return [:]
6464
}
@@ -79,14 +79,14 @@ public class PBXProject : PBXContainer {
7979
public lazy var projectRoot: String = self.string("projectRoot")!
8080

8181
override func toDictionary() -> JsonObject {
82-
return [
83-
"developmentRegion": self.developmentRegion,
84-
"hasScannedForEncodings": self.hasScannedForEncodings,
85-
"knownRegions": self.knownRegions,
86-
"targets": self.targets.map { $0.toDictionary() },
87-
"mainGroup": self.mainGroup.toDictionary(),
88-
"buildConfigurationList": self.buildConfigurationList.toDictionary()
89-
]
82+
var result: JsonObject = super.toDictionary()
83+
result["developmentRegion"] = self.developmentRegion
84+
result["hasScannedForEncodings"] = self.hasScannedForEncodings
85+
result["knownRegions"] = self.knownRegions
86+
result["targets"] = self.targets.map { $0.toDictionary() }
87+
result["mainGroup"] = self.mainGroup.toDictionary()
88+
result["buildConfigurationList"] = self.buildConfigurationList.toDictionary()
89+
return result
9090
}
9191
}
9292

@@ -96,16 +96,16 @@ public /* abstract */ class PBXContainerItem : PBXObject {
9696
public class PBXContainerItemProxy : PBXContainerItem {
9797
public lazy var containerPortal: PBXProject = self.object("containerPortal")
9898
public lazy var proxyType: String = self.string("proxyType")!
99-
public lazy var remoteGlobalIDString: PBXProject = self.object("remoteGlobalIDString")
99+
//public lazy var remoteGlobalIDString: PBXProject = self.object("remoteGlobalIDString")
100100
public lazy var remoteInfo: String = self.string("remoteInfo")!
101101

102102
override func toDictionary() -> JsonObject {
103-
return [
104-
"containerPortal": self.containerPortal.toDictionary(),
105-
"proxyType": self.proxyType,
106-
"remoteGlobalIDString": self.remoteGlobalIDString.toDictionary(),
107-
"remoteInfo": self.remoteInfo
108-
]
103+
var result: JsonObject = super.toDictionary()
104+
result["proxyType"] = self.proxyType
105+
//result["containerPortal"] = self.containerPortal.toDictionary()
106+
//result["remoteGlobalIDString"] = self.remoteGlobalIDString.toDictionary()
107+
result["remoteInfo"] = self.remoteInfo
108+
return result
109109
}
110110
}
111111

@@ -118,7 +118,6 @@ public class PBXBuildFile : PBXProjectItem {
118118
override func toDictionary() -> JsonObject {
119119
var result: JsonObject = super.toDictionary()
120120
if let fileRef = self.fileRef { result["fileRef"] = fileRef.toDictionary() }
121-
122121
return result
123122
}
124123
}
@@ -127,22 +126,22 @@ public class PBXBuildFile : PBXProjectItem {
127126
public /* abstract */ class PBXBuildPhase : PBXProjectItem {
128127
public lazy var files: [PBXBuildFile] = self.objects("files")
129128
public lazy var runOnlyForDeploymentPostprocessing: String = self.string("runOnlyForDeploymentPostprocessing")!
130-
129+
131130
override public func toDictionary() -> JsonObject {
132-
return [
133-
"files": self.files.map { $0.toDictionary() },
134-
"runOnlyForDeploymentPostprocessing": self.runOnlyForDeploymentPostprocessing
135-
]
131+
var result: JsonObject = super.toDictionary()
132+
result["files"] = self.files.map { $0.toDictionary() }
133+
result["runOnlyForDeploymentPostprocessing"] = self.runOnlyForDeploymentPostprocessing
134+
return result
136135
}
137136
}
138137

139138
public class PBXCopyFilesBuildPhase : PBXBuildPhase {
140139
public lazy var name: String? = self.string("name")
141-
140+
142141
override public func toDictionary() -> JsonObject {
143-
return [
144-
"name": self.name!
145-
]
142+
var result = super.toDictionary()
143+
result["name"] = self.name!
144+
return result
146145
}
147146
}
148147

@@ -158,14 +157,14 @@ public class PBXResourcesBuildPhase : PBXBuildPhase {
158157
public class PBXShellScriptBuildPhase : PBXBuildPhase {
159158
public lazy var name: String? = self.string("name")
160159
public lazy var shellScript: String = self.string("shellScript")!
161-
160+
162161
override public func toDictionary() -> JsonObject {
163-
return [
164-
"name": self.name!,
165-
"shellScript": self.shellScript
166-
]
162+
var result = super.toDictionary()
163+
result["name"] = self.name!
164+
result["shellScript"] = self.shellScript
165+
return result
167166
}
168-
167+
169168
}
170169

171170
public class PBXSourcesBuildPhase : PBXBuildPhase {
@@ -179,10 +178,10 @@ public class XCBuildConfiguration : PBXBuildStyle {
179178
public lazy var buildSettings: [String: Any] = self.dictionary("buildSettings")!
180179

181180
override public func toDictionary() -> JsonObject {
182-
return [
183-
"name": self.name,
184-
"shellScript": self.buildSettings
185-
]
181+
var result = super.toDictionary()
182+
result["name"] = self.name
183+
result["buildSettings"] = self.buildSettings
184+
return result
186185
}
187186
}
188187

@@ -191,14 +190,14 @@ public /* abstract */ class PBXTarget : PBXProjectItem {
191190
public lazy var name: String = self.string("name")!
192191
public lazy var productName: String = self.string("productName")!
193192
public lazy var buildPhases: [PBXBuildPhase] = self.objects("buildPhases")
194-
193+
195194
override func toDictionary() -> JsonObject {
196-
return [
197-
"buildConfigurationList": self.buildConfigurationList.toDictionary(),
198-
"name": self.name,
199-
"productName": self.productName,
200-
"buildPhases": self.buildPhases.map { $0.toDictionary() }
201-
]
195+
var result = super.toDictionary()
196+
result["buildConfigurationList"] = self.buildConfigurationList.toDictionary()
197+
result["name"] = self.name
198+
result["productName"] = self.productName
199+
result["buildPhases"] = self.buildPhases.map { $0.toDictionary() }
200+
return result
202201
}
203202
}
204203

@@ -208,27 +207,27 @@ public class PBXAggregateTarget : PBXTarget {
208207
public class PBXNativeTarget : PBXTarget {
209208
// TODO: buildRules
210209
public lazy var dependencies: [PBXTargetDependency] = self.objects("dependencies")
211-
public lazy var productReference: [PBXFileReference] = self.objects("productReference")
210+
public lazy var productReference: PBXFileReference = self.object("productReference")
212211
public lazy var productType: String = self.string("productType")!
213212

214213
override public func toDictionary() -> JsonObject {
215-
return[
216-
"dependencies": self.dependencies.map { $0.toDictionary() },
217-
"productReference": self.productReference.map { $0.toDictionary() },
218-
"productType": self.productType
219-
]
214+
var result = super.toDictionary()
215+
result["dependencies"] = self.dependencies.map { $0.toDictionary() }
216+
result["productReference"] = self.productReference.toDictionary()
217+
result["productType"] = self.productType
218+
return result
220219
}
221220
}
222221

223222
public class PBXTargetDependency : PBXProjectItem {
224223
public lazy var target: PBXNativeTarget = self.object("target")
225-
public lazy var targetProxy: PBXContainerItemProxy = self.object("targetProxy")
224+
public lazy var targetProxy: String = self.string("targetProxy")! //self.object("targetProxy")
226225

227226
override public func toDictionary() -> JsonObject {
228-
return[
229-
"target": self.target.toDictionary(),
230-
"targetProxy": self.targetProxy.toDictionary()
231-
]
227+
var result = super.toDictionary()
228+
result["target"] = self.target.toDictionary()
229+
result["targetProxy"] = self.targetProxy
230+
return result
232231
}
233232
}
234233

@@ -238,11 +237,11 @@ public class XCConfigurationList : PBXProjectItem {
238237
public lazy var defaultConfigurationName: String = self.string("defaultConfigurationName")!
239238

240239
override public func toDictionary() -> JsonObject {
241-
return[
242-
"buildConfigurations": self.buildConfigurations.map { $0.toDictionary() },
243-
"defaultConfigurationIsVisible": self.defaultConfigurationIsVisible,
244-
"defaultConfigurationName": self.defaultConfigurationName
245-
]
240+
var result = super.toDictionary()
241+
result["buildConfigurations"] = self.buildConfigurations.map { $0.toDictionary() }
242+
result["defaultConfigurationIsVisible"] = self.defaultConfigurationIsVisible
243+
result["defaultConfigurationName"] = self.defaultConfigurationName
244+
return result
246245
}
247246
}
248247

@@ -277,11 +276,11 @@ public class PBXFileReference : PBXReference {
277276
public class PBXReferenceProxy : PBXReference {
278277

279278
// convenience accessor
280-
public lazy var remoteRef: PBXContainerItemProxy = self.object("remoteRef")
279+
public lazy var remoteRef: String = self.string("remoteRef")!
281280

282281
override func toDictionary() -> JsonObject {
283282
var result: JsonObject = super.toDictionary()
284-
result["remoteRef"] = self.remoteRef.toDictionary()
283+
result["remoteRef"] = self.remoteRef
285284

286285
return result
287286
}
@@ -329,7 +328,7 @@ public enum SourceTree {
329328
self = .relativeTo(sourceTreeFolder)
330329
}
331330
}
332-
331+
333332
func toString() -> String {
334333
return "SourceTree"
335334
}
@@ -345,7 +344,7 @@ public enum SourceTreeFolder: String {
345344
public enum Path {
346345
case absolute(String)
347346
case relativeTo(SourceTreeFolder, String)
348-
347+
349348
func toString() -> String {
350349
return "Path"
351350
}

Sources/PrintCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct PrintCommand: CommandProtocol {
3030
//"attributes": rootObject["attributes"]!,
3131
"buildConfigurationList": rootObject.buildConfigurationList.toDictionary(),
3232
//"compatibilityVersion": rootObject.["compatibilityVersion"]!,
33-
"developmentRegion": rootObject.developmentRegion,
33+
//"developmentRegion": rootObject.developmentRegion,
3434
"hasScannedForEncodings": rootObject.hasScannedForEncodings,
3535
"knownRegions": rootObject.knownRegions,
3636
//"projectDirPath": rootObject["projectDirPath"]!,

0 commit comments

Comments
 (0)