Allow nil values

This commit is contained in:
ryohey
2019-04-20 12:12:26 +09:00
parent 117b90d13f
commit d5649a1bd3
10 changed files with 80 additions and 204 deletions
+5 -11
View File
@@ -63,25 +63,19 @@ extension BuildScript: JSONObjectConvertible {
}
extension BuildScript: JSONEncodable {
public func toJSONValue() -> Any {
var dict: JSONDictionary = [
var dict: [String: Any?] = [
"inputFiles": inputFiles,
"inputFileLists": inputFileLists,
"outputFiles": outputFiles,
"outputFileLists": outputFileLists
"outputFileLists": outputFileLists,
"runOnlyWhenInstalling": runOnlyWhenInstalling,
"name": name,
"shell": shell
]
if runOnlyWhenInstalling {
dict["runOnlyWhenInstalling"] = runOnlyWhenInstalling
}
if !showEnvVars {
dict["showEnvVars"] = showEnvVars
}
if let name = name {
dict["name"] = name
}
if let shell = shell {
dict["shell"] = shell
}
switch script {
case .path(let string):