Commit 93be5ea3 authored by Drew's avatar Drew

more bootstrap

parent a32a0855
......@@ -9,5 +9,10 @@ tasks:
default:
tool: "atllbuild"
source: ["src/**.swift"]
bootstrap: true
name: "atbuild"
bootstrap:
tool: "atllbuild"
source: ["src/**.swift"]
name: "atbuild"
bootstrapOnly: true
\ No newline at end of file
#!/bin/bash
swift-build-tool -f llbuild.yaml
cp .atllbuild/atbuild .
\ No newline at end of file
client:
name: swift-build
tools: {}
targets:
"": [<atllbuild>]
atllbuild: [<atllbuild>]
commands:
<atllbuild-swiftc>:
tool: swift-compiler
executable: "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc"
inputs: ["src/atllbuild.swift", "src/config.swift", "src/errors.swift", "src/main.swift", "src/PlatformPaths.swift", "src/Shell.swift", "src/Task.swift", "src/Tools.swift", "src/yaml/Operators.swift", "src/yaml/Parser.swift", "src/yaml/Regex.swift", "src/yaml/Result.swift", "src/yaml/Tokenizer.swift", "src/yaml/Yaml.swift"]
sources: ["src/atllbuild.swift", "src/config.swift", "src/errors.swift", "src/main.swift", "src/PlatformPaths.swift", "src/Shell.swift", "src/Task.swift", "src/Tools.swift", "src/yaml/Operators.swift", "src/yaml/Parser.swift", "src/yaml/Regex.swift", "src/yaml/Result.swift", "src/yaml/Tokenizer.swift", "src/yaml/Yaml.swift"]
objects: [".atllbuild/atllbuild.swift.o", ".atllbuild/config.swift.o", ".atllbuild/errors.swift.o", ".atllbuild/main.swift.o", ".atllbuild/PlatformPaths.swift.o", ".atllbuild/Shell.swift.o", ".atllbuild/Task.swift.o", ".atllbuild/Tools.swift.o", ".atllbuild/Operators.swift.o", ".atllbuild/Parser.swift.o", ".atllbuild/Regex.swift.o", ".atllbuild/Result.swift.o", ".atllbuild/Tokenizer.swift.o", ".atllbuild/Yaml.swift.o"]
outputs: ["<atllbuild-swiftc>", ".atllbuild/atllbuild.swift.o", ".atllbuild/config.swift.o", ".atllbuild/errors.swift.o", ".atllbuild/main.swift.o", ".atllbuild/PlatformPaths.swift.o", ".atllbuild/Shell.swift.o", ".atllbuild/Task.swift.o", ".atllbuild/Tools.swift.o", ".atllbuild/Operators.swift.o", ".atllbuild/Parser.swift.o", ".atllbuild/Regex.swift.o", ".atllbuild/Result.swift.o", ".atllbuild/Tokenizer.swift.o", ".atllbuild/Yaml.swift.o"]
module-name: atbuild
module-output-path: .atllbuild/atbuild.swiftmodule
temps-path: .atllbuild//llbuildtmp
other-args: ["-j8", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"]
<atllbuild>:
tool: shell
inputs: ["<atllbuild-swiftc>", ".atllbuild/atllbuild.swift.o", ".atllbuild/config.swift.o", ".atllbuild/errors.swift.o", ".atllbuild/main.swift.o", ".atllbuild/PlatformPaths.swift.o", ".atllbuild/Shell.swift.o", ".atllbuild/Task.swift.o", ".atllbuild/Tools.swift.o", ".atllbuild/Operators.swift.o", ".atllbuild/Parser.swift.o", ".atllbuild/Regex.swift.o", ".atllbuild/Result.swift.o", ".atllbuild/Tokenizer.swift.o", ".atllbuild/Yaml.swift.o"]
outputs: ["<atllbuild>", ".atllbuild/atbuild"]
args: ["/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc", "-o", ".atllbuild/atbuild", ".atllbuild/atllbuild.swift.o", ".atllbuild/config.swift.o", ".atllbuild/errors.swift.o", ".atllbuild/main.swift.o", ".atllbuild/PlatformPaths.swift.o", ".atllbuild/Shell.swift.o", ".atllbuild/Task.swift.o", ".atllbuild/Tools.swift.o", ".atllbuild/Operators.swift.o", ".atllbuild/Parser.swift.o", ".atllbuild/Regex.swift.o", ".atllbuild/Result.swift.o", ".atllbuild/Tokenizer.swift.o", ".atllbuild/Yaml.swift.o"]
description: Linking executable atbuild
......@@ -11,7 +11,7 @@ final class ATllbuild : Tool {
let enumerator = manager.enumeratorAtPath(basepath)!
while let source = enumerator.nextObject() as? String {
if source.hasSuffix("swift") {
sources.append(manager.currentDirectoryPath + "/" + basepath + "/" + source)
sources.append(basepath + "/" + source)
}
}
}
......@@ -38,11 +38,7 @@ final class ATllbuild : Tool {
yaml += "commands:\n"
yaml += " <atllbuild-swiftc>:\n"
yaml += " tool: swift-compiler\n"
#if os(OSX)
yaml += " executable: \"\(SwiftCPath)\"\n"
#else
Unsupported!
#endif
yaml += " inputs: \(sources)\n"
yaml += " sources: \(sources)\n"
......@@ -92,8 +88,17 @@ final class ATllbuild : Tool {
let sources = collectSources(sourceDescriptions)
guard let name = args["name"]?.string else { throw AnarchyBuildError.CantParseYaml("No name for atllbuild task") }
let bootstrapOnly: Bool
if args["bootstrapOnly"] != nil && args["bootstrapOnly"]?.bool == true {
bootstrapOnly = true
}
else {
bootstrapOnly = false
}
//create the working directory
let workDirectory = NSFileManager.defaultManager().currentDirectoryPath + "/.atllbuild/"
let workDirectory = ".atllbuild/"
let manager = NSFileManager.defaultManager()
if manager.fileExistsAtPath(workDirectory) {
try manager.removeItemAtPath(workDirectory)
......@@ -101,9 +106,15 @@ final class ATllbuild : Tool {
try manager.createDirectoryAtPath(workDirectory, withIntermediateDirectories: false, attributes: nil)
//emit the llbuild.yaml
let llbuildyamlpath = workDirectory + "llbuild.yaml"
let llbuildyamlpath : String
if bootstrapOnly {
llbuildyamlpath = "llbuild.yaml"
}
else {
llbuildyamlpath = workDirectory + "llbuild.yaml"
}
try llbuildyaml(sources, workdir: workDirectory, modulename: name).writeToFile(llbuildyamlpath, atomically: false, encoding: NSUTF8StringEncoding)
if bootstrapOnly { return }
//now we try running sbt
let args = ["-f",llbuildyamlpath]
let sbt = NSTask.launchedTaskWithLaunchPath(SwiftBuildToolpath, arguments: args)
......
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