Commit 21c3d66a authored by Johannes Schriewer's avatar Johannes Schriewer

Make it compile in snapshot 04-12

parent 8f7175e3
Pipeline #1516 failed with stage
...@@ -27,7 +27,7 @@ enum Options: String { ...@@ -27,7 +27,7 @@ enum Options: String {
case Help = "--help" case Help = "--help"
case Clean = "--clean" case Clean = "--clean"
case Toolchain = "--toolchain" case Toolchain = "--toolchain"
static var allOptions : [Options] { return [Overlay, CustomFile, Help, Clean, Toolchain] } static var allOptions : [Options] { return [Overlay, CustomFile, Help, Clean, Toolchain] }
} }
...@@ -66,19 +66,19 @@ if Process.arguments.contains("--help") { ...@@ -66,19 +66,19 @@ if Process.arguments.contains("--help") {
print("") print("")
print("Usage:") print("Usage:")
print("atbuild [--toolchain (/toolchain/path | xcode)] [-f packagefile] [task] [--clean]") print("atbuild [--toolchain (/toolchain/path | xcode)] [-f packagefile] [task] [--clean]")
print("tasks:") print("tasks:")
for (key, task) in package.tasks { for (key, task) in package.tasks {
print(" \(key)") print(" \(key)")
} }
exit(1) exit(1)
} }
func runTask(taskName: String, package: Package) { func runTask(taskName: String, package: Package) {
guard let task = package.tasks[taskName] else { fatalError("No \(taskName) task in build configuration.") } guard let task = package.tasks[taskName] else { fatalError("No \(taskName) task in build configuration.") }
for task in package.prunedDependencyGraph(task) { for task in package.prunedDependencyGraph(task: task) {
TaskRunner.runTask(task, package: package, toolchain: toolchain) TaskRunner.runTask(task: task, package: package, toolchain: toolchain)
} }
} }
...@@ -103,7 +103,7 @@ if focusOnTask == nil { ...@@ -103,7 +103,7 @@ if focusOnTask == nil {
print("Building package \(package.name)...") print("Building package \(package.name)...")
runTask(focusOnTask!, package: package) runTask(taskName: focusOnTask!, package: package)
//success message //success message
print("Built package \(package.name).") print("Built package \(package.name).")
\ No newline at end of file
Subproject commit d6ea8b9fea7af70e3d16c9f1485738d5ba2db7bb Subproject commit a6be2b03eef68fd8ea1137fd43b29fb326a3f1a9
...@@ -56,7 +56,7 @@ extension NSFileManager { ...@@ -56,7 +56,7 @@ extension NSFileManager {
let permission_ = (try! attributesOfItem(atPath: srcPath)[NSFilePosixPermissions] as! NSNumber) let permission_ = (try! attributesOfItem(atPath: srcPath)[NSFilePosixPermissions] as! NSNumber)
#if os(OSX) || os(iOS) #if os(OSX) || os(iOS)
let permission = permission_.unsignedShortValue let permission = permission_.uint16Value
#elseif os(Linux) #elseif os(Linux)
let permission = permission_.unsignedIntValue let permission = permission_.unsignedIntValue
#endif #endif
...@@ -65,15 +65,15 @@ extension NSFileManager { ...@@ -65,15 +65,15 @@ extension NSFileManager {
throw CopyError.CantOpenDestFile(errno) throw CopyError.CantOpenDestFile(errno)
} }
defer { precondition(close(fd_to) >= 0) } defer { precondition(close(fd_to) >= 0) }
var buf = [UInt8](repeating: 0, count: 4096) var buf = [UInt8](repeating: 0, count: 4096)
while true { while true {
let nread = read(fd_from, &buf, buf.count) let nread = read(fd_from, &buf, buf.count)
if nread < 0 { throw CopyError.CantReadSourceFile(errno) } if nread < 0 { throw CopyError.CantReadSourceFile(errno) }
if nread == 0 { break } if nread == 0 { break }
var writeSlice = buf[0..<nread] var writeSlice = buf[0..<nread]
while true { while true {
var nwritten: Int! = nil var nwritten: Int! = nil
writeSlice.withUnsafeBufferPointer({ (ptr) -> () in writeSlice.withUnsafeBufferPointer({ (ptr) -> () in
......
...@@ -70,21 +70,21 @@ class PackageFramework: Tool { ...@@ -70,21 +70,21 @@ class PackageFramework: Tool {
//copy payload //copy payload
let payloadPath = task.importedPath + "bin/" + name + DynamicLibraryExtension let payloadPath = task.importedPath + "bin/" + name + DynamicLibraryExtension
print(payloadPath) print(payloadPath)
try! manager.copyItemAtPath_SWIFTBUG(payloadPath, toPath: "\(AVersionPath)/\(name)") try! manager.copyItemAtPath_SWIFTBUG(srcPath: payloadPath, toPath: "\(AVersionPath)/\(name)")
try! manager.createSymbolicLink(atPath: "\(frameworkPath)/\(name)", withDestinationPath: "\(relativeAVersionPath)/\(name)") try! manager.createSymbolicLink(atPath: "\(frameworkPath)/\(name)", withDestinationPath: "\(relativeAVersionPath)/\(name)")
//copy modules //copy modules
let modulePath = "\(AVersionPath)/Modules/\(name).swiftmodule" let modulePath = "\(AVersionPath)/Modules/\(name).swiftmodule"
try! manager.createDirectory(atPath: modulePath, withIntermediateDirectories: true, attributes: nil) try! manager.createDirectory(atPath: modulePath, withIntermediateDirectories: true, attributes: nil)
try! manager.copyItemAtPath_SWIFTBUG("bin/\(name).swiftmodule", toPath: "\(modulePath)/\(Architecture).swiftmodule") try! manager.copyItemAtPath_SWIFTBUG(srcPath: "bin/\(name).swiftmodule", toPath: "\(modulePath)/\(Architecture).swiftmodule")
try! manager.copyItemAtPath_SWIFTBUG("bin/\(name).swiftdoc", toPath: "\(modulePath)/\(Architecture).swiftdoc") try! manager.copyItemAtPath_SWIFTBUG(srcPath: "bin/\(name).swiftdoc", toPath: "\(modulePath)/\(Architecture).swiftdoc")
try! manager.createSymbolicLink(atPath: "\(frameworkPath)/Modules", withDestinationPath: "\(relativeAVersionPath)/Modules") try! manager.createSymbolicLink(atPath: "\(frameworkPath)/Modules", withDestinationPath: "\(relativeAVersionPath)/Modules")
//copy resources //copy resources
let resourcesPath = AVersionPath + "/Resources" let resourcesPath = AVersionPath + "/Resources"
try! manager.createDirectory(atPath: resourcesPath, withIntermediateDirectories: true, attributes: nil) try! manager.createDirectory(atPath: resourcesPath, withIntermediateDirectories: true, attributes: nil)
for resource in resources { for resource in resources {
try! manager.copyItemAtPath_SWIFTBUG(task.importedPath + resource, toPath: "\(resourcesPath)/\(resource)") try! manager.copyItemAtPath_SWIFTBUG(srcPath: task.importedPath + resource, toPath: "\(resourcesPath)/\(resource)")
} }
try! manager.createSymbolicLink(atPath: "\(frameworkPath)/Resources", withDestinationPath: "\(relativeAVersionPath)/Resources") try! manager.createSymbolicLink(atPath: "\(frameworkPath)/Resources", withDestinationPath: "\(relativeAVersionPath)/Resources")
......
...@@ -25,13 +25,13 @@ final class Shell : Tool { ...@@ -25,13 +25,13 @@ final class Shell : Tool {
func run(task: Task, toolchain: String) { func run(task: Task, toolchain: String) {
setenv("ATBUILD_USER_PATH", userPath(), 1) setenv("ATBUILD_USER_PATH", userPath(), 1)
guard var script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") } guard var script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") }
script = evaluateSubstitutions(script, package: task.package) script = evaluateSubstitutions(input: script, package: task.package)
do { do {
let oldPath = NSFileManager.defaultManager().currentDirectoryPath let oldPath = NSFileManager.defaultManager().currentDirectoryPath
defer { NSFileManager.defaultManager().changeCurrentDirectoryPath(oldPath) } defer { NSFileManager.defaultManager().changeCurrentDirectoryPath(oldPath) }
NSFileManager.defaultManager().changeCurrentDirectoryPath(task.importedPath) NSFileManager.defaultManager().changeCurrentDirectoryPath(task.importedPath)
if system("/bin/sh -c \"\(script)\"") != 0 { if system("/bin/sh -c \"\(script)\"") != 0 {
fatalError("/bin/sh -c \(script)") fatalError("/bin/sh -c \(script)")
} }
......
...@@ -22,10 +22,10 @@ import atpkg ...@@ -22,10 +22,10 @@ import atpkg
final public class TaskRunner { final public class TaskRunner {
private init() {} private init() {}
static public func runTask(task: Task, package: Package, toolchain: String) { static public func runTask(task: Task, package: Package, toolchain: String) {
print("Running task \(task.qualifiedName) with overlays \(task.appliedOverlays)") print("Running task \(task.qualifiedName) with overlays \(task.appliedOverlays)")
let tool = toolByName(task.tool) let tool = toolByName(name: task.tool)
tool.run(task, toolchain: toolchain) tool.run(task: task, toolchain: toolchain)
print("Completed task \(task.qualifiedName).") print("Completed task \(task.qualifiedName).")
} }
} }
\ No newline at end of file
...@@ -25,9 +25,9 @@ class XCTestRun : Tool { ...@@ -25,9 +25,9 @@ class XCTestRun : Tool {
} }
#if os(OSX) #if os(OSX)
var workingDirectory = "/tmp/XXXXXXXXXXX" var workingDirectory = "/tmp/XXXXXXXXXXX"
var template = workingDirectory.cString(usingEncoding: NSUTF8StringEncoding)! var template = workingDirectory.cString(using: NSUTF8StringEncoding)!
workingDirectory = String(cString: mkdtemp(&template), encoding: NSUTF8StringEncoding)! workingDirectory = String(cString: mkdtemp(&template), encoding: NSUTF8StringEncoding)!
let manager = NSFileManager.defaultManager() let manager = NSFileManager.defaultManager()
let executablePath = workingDirectory + "/XCTestRun.xctest/Contents/MacOS" let executablePath = workingDirectory + "/XCTestRun.xctest/Contents/MacOS"
try! manager.createDirectory(atPath: executablePath, withIntermediateDirectories: true, attributes: nil) try! manager.createDirectory(atPath: executablePath, withIntermediateDirectories: true, attributes: nil)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment