Skip to content

Instantly share code, notes, and snippets.

@vi4m
Last active September 14, 2016 08:30
Show Gist options
  • Save vi4m/6488e0aa08d72407f3faff9e5004eb0d to your computer and use it in GitHub Desktop.
Save vi4m/6488e0aa08d72407f3faff9e5004eb0d to your computer and use it in GitHub Desktop.
XCode 7 fix for zewo packages
#!/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-31-a.xctoolchain/usr/bin/swift
import Foundation
func currentPath() -> String {
let pathPointer = UnsafeMutablePointer<Int8>(allocatingCapacity: 1024)
defer { pathPointer.deallocateCapacity(1024) }
getcwd(pathPointer, 1024)
return String(validatingUTF8: pathPointer)! + "/"
}
let basePath = currentPath()
let buildOutputPath = basePath + ".build/debug"
print(buildOutputPath)
var projectName = basePath.characters.split(separator: "/").last!.reduce("") { $0 + String($1) }
projectName = "mesosbilling"
//projectName = "swidamio"
let xcodeprojPath = basePath + projectName + ".xcodeproj/project.pbxproj"
print(xcodeprojPath)
var xcodeproj = NSDictionary(contentsOfFile: xcodeprojPath) as! [String:AnyObject]
var objects = xcodeproj["objects"]! as! [String:AnyObject]
var libs = ["Mustache", "POSIX", "HTTPParser", "URI", "Venice", "File", "IP", "TCP", "HTTPServer", "HTTPClient", "HTTPSClient", "SessionMiddleware" ]
libs = ["HTTPServer", "HTTPParser", "CURIParser", "POSIX", "File", "HTTPClient", "HTTPSClient", "JSON", "Venice", "TCP", "IP", "URI"]
for target in libs {
print(target)
for prefix in ["___DebugConf_", "_ReleaseConf_"] {
let key = prefix + target
if objects[key] == nil { continue }
var configuration = objects[key]! as! [String:AnyObject]
print(configuration)
var settings = configuration["buildSettings"]! as! [String:AnyObject]
print(settings)
print(buildOutputPath)
settings["LIBRARY_SEARCH_PATHS"] = buildOutputPath
configuration["buildSettings"] = settings
objects[key] = configuration
}
}
xcodeproj["objects"] = objects
(xcodeproj as NSDictionary).write(toFile: xcodeprojPath, atomically: false)
print("Done!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment