Skip to content

Commit

Permalink
write bools with .int property
Browse files Browse the repository at this point in the history
  • Loading branch information
yonaskolb committed Jan 25, 2018
1 parent b3266f5 commit b51f403
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Sources/xcproj/Bool+Extras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ public extension Bool {
return self ? "YES": "NO"
}

/// Returns a 1 for true and 0 for false
var int: UInt {
return self ? 1 : 0
}

}
2 changes: 1 addition & 1 deletion Sources/xcproj/PBXBuildPhase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class PBXBuildPhase: PBXObject {
let comment = (type.flatMap { "\(fileName) in \($0)" }) ?? name
return .string(CommentedString(fileReference, comment: comment))
})
dictionary["runOnlyForDeploymentPostprocessing"] = .string(CommentedString("\(runOnlyForDeploymentPostprocessing)"))
dictionary["runOnlyForDeploymentPostprocessing"] = .string(CommentedString("\(runOnlyForDeploymentPostprocessing.int)"))
return dictionary
}
}
2 changes: 1 addition & 1 deletion Sources/xcproj/PBXBuildRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ extension PBXBuildRule: PlistSerializable {
dictionary["filePatterns"] = .string(CommentedString(filePatterns))
}
dictionary["fileType"] = .string(CommentedString(fileType))
dictionary["isEditable"] = .string(CommentedString("\(isEditable ? 1 : 0)"))
dictionary["isEditable"] = .string(CommentedString("\(isEditable.int)"))
if let name = name {
dictionary["name"] = .string(CommentedString(name))
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/xcproj/PBXFileReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ final public class PBXFileReference: PBXFileElement {
dictionary["explicitFileType"] = .string(CommentedString(explicitFileType))
}
if let includeInIndex = includeInIndex {
dictionary["includeInIndex"] = .string(CommentedString("\(includeInIndex)"))
dictionary["includeInIndex"] = .string(CommentedString("\(includeInIndex.int)"))
}
if let usesTabs = usesTabs {
dictionary["usesTabs"] = .string(CommentedString("\(usesTabs)"))
dictionary["usesTabs"] = .string(CommentedString("\(usesTabs.int)"))
}
if let lineEnding = lineEnding {
dictionary["lineEnding"] = .string(CommentedString("\(lineEnding)"))
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcproj/PBXGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ final public class PBXGroup: PBXFileElement {
return .string(CommentedString(fileReference, comment: comment))
}))
if let usesTabs = usesTabs {
dictionary["usesTabs"] = .string(CommentedString("\(usesTabs)"))
dictionary["usesTabs"] = .string(CommentedString("\(usesTabs.int)"))
}

[("indentWidth" as CommentedString, indentWidth),
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcproj/PBXLegacyTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final public class PBXLegacyTarget: PBXTarget {
PlistValue.string(CommentedString(buildArgumentsString))
}
dict["passBuildSettingsInEnvironment"] =
PlistValue.string(passBuildSettingsInEnvironment ? "1" : "0")
PlistValue.string(CommentedString(passBuildSettingsInEnvironment.int.description))
if let buildWorkingDirectory = buildWorkingDirectory {
dict["buildWorkingDirectory"] =
PlistValue.string(CommentedString(buildWorkingDirectory))
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcproj/PBXShellScriptBuildPhase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ extension PBXShellScriptBuildPhase: PlistSerializable {
if let shellScript = shellScript {
dictionary["shellScript"] = .string(CommentedString(shellScript))
}
dictionary["showEnvVarsInLog"] = .string(CommentedString("\(showEnvVarsInLog)"))
dictionary["showEnvVarsInLog"] = .string(CommentedString("\(showEnvVarsInLog.int)"))
return (key: CommentedString(reference, comment: self.name ?? "ShellScript"), value: .dictionary(dictionary))
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/xcproj/XCConfigurationList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension XCConfigurationList: PlistSerializable {
dictionary["buildConfigurations"] = .array(buildConfigurations
.map { .string(CommentedString($0, comment: proj.objects.configName(configReference: $0)))
})
dictionary["defaultConfigurationIsVisible"] = .string(CommentedString("\(defaultConfigurationIsVisible)"))
dictionary["defaultConfigurationIsVisible"] = .string(CommentedString("\(defaultConfigurationIsVisible.int)"))
if let defaultConfigurationName = defaultConfigurationName {
dictionary["defaultConfigurationName"] = .string(CommentedString(defaultConfigurationName))
}
Expand Down

0 comments on commit b51f403

Please sign in to comment.