Commit badf3937 authored by Drew's avatar Drew

Separate osx/linux yaml files

Manually specify yaml path in config (now with less magic!)
parent 7611c57a
......@@ -11,8 +11,16 @@ tasks:
source: ["src/**.swift"]
name: "atbuild"
bootstrap:
bootstrap-osx:
tool: "atllbuild"
source: ["src/**.swift"]
name: "atbuild"
bootstrapOnly: true
\ No newline at end of file
bootstrapOnly: true
llbuildyaml: "llbuild-osx.yaml"
bootstrap-linux:
tool: "atllbuild"
source: ["src/**.swift"]
name: "atbuild"
bootstrapOnly: true
llbuildyaml: "llbuild-linux.yaml"
\ No newline at end of file
#!/bin/bash
swift-build-tool -f llbuild.yaml
swift-build-tool -f llbuild-osx.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
......@@ -102,6 +102,14 @@ final class ATllbuild : Tool {
}
func run(args: [Yaml : Yaml]) throws {
//create the working directory
let workDirectory = ".atllbuild/"
let manager = NSFileManager.defaultManager()
if manager.fileExistsAtPath(workDirectory) {
try manager.removeItemAtPath(workDirectory)
}
try manager.createDirectoryAtPath(workDirectory, withIntermediateDirectories: false, attributes: nil)
//parse arguments
guard let sourceDescriptions = args["source"]?.array?.flatMap({$0.string}) else { throw AnarchyBuildError.CantParseYaml("Can't find sources for atllbuild.") }
let sources = collectSources(sourceDescriptions)
......@@ -109,29 +117,23 @@ final class ATllbuild : Tool {
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 {
if args["bootstrapOnly"]?.bool == true {
bootstrapOnly = true
}
else {
bootstrapOnly = false
}
//create the working directory
let workDirectory = ".atllbuild/"
let manager = NSFileManager.defaultManager()
if manager.fileExistsAtPath(workDirectory) {
try manager.removeItemAtPath(workDirectory)
}
try manager.createDirectoryAtPath(workDirectory, withIntermediateDirectories: false, attributes: nil)
//emit the llbuild.yaml
let llbuildyamlpath : String
if bootstrapOnly {
llbuildyamlpath = "llbuild.yaml"
if args ["llbuildyaml"]?.string != nil {
llbuildyamlpath = args["llbuildyaml"]!.string!
}
else {
llbuildyamlpath = workDirectory + "llbuild.yaml"
}
try llbuildyaml(sources, workdir: workDirectory, modulename: name).writeToFile(llbuildyamlpath, atomically: false, encoding: NSUTF8StringEncoding)
if bootstrapOnly { return }
......
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