Commit 695de063 authored by David Owens II's avatar David Owens II

Merge branch 'master' into clj-parser

parents f2d8e224 42eb7813
bin/
*xcuserdata*
<<<<<<< HEAD
.atllbuild/
atbuild
build.db
=======
.atllbuild
atbuild
build.db
>>>>>>> master
......@@ -8,7 +8,7 @@ tasks:
default:
tool: "atllbuild"
source: ["src/**.swift"]
source: ["cli/src/**.swift", "parsers/yaml/**.swift"]
name: "atbuild"
tests:
......@@ -20,8 +20,17 @@ tasks:
tool: "shell"
script: "./.atllbuild/tests"
bootstrap:
bootstrap-osx:
tool: "atllbuild"
source: ["src/**.swift"]
source: ["cli/src/**.swift", "parsers/yaml/**.swift"]
name: "atbuild"
bootstrapOnly: true
\ No newline at end of file
bootstrapOnly: true
llbuildyaml: "llbuild-osx.yaml"
bootstrap-linux:
tool: "atllbuild"
source: ["cli/src/**.swift", "parsers/yaml/**.swift"]
name: "atbuild"
bootstrapOnly: true
llbuildyaml: "llbuild-linux.yaml"
linkSDK: false
\ 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
......@@ -41,7 +41,7 @@ final class ATllbuild : Tool {
- parameter workdir: A temporary working directory for `atllbuild` to use
- parameter modulename: The name of the module to be built.
- returns: The string contents for llbuild.yaml suitable for processing by swift-build-tool */
func llbuildyaml(sources: [String], workdir: String, modulename: String) -> String {
func llbuildyaml(sources: [String], workdir: String, modulename: String, linkSDK: Bool) -> String {
//this format is largely undocumented, but I reverse-engineered it from SwiftPM.
var yaml = "client:\n name: swift-build\n\n"
......@@ -77,9 +77,11 @@ final class ATllbuild : Tool {
yaml += " temps-path: \(workdir)/llbuildtmp\n"
var args : [String] = []
#if os(OSX)
args.appendContentsOf(["-j8","-sdk",SDKPath])
#endif
args.appendContentsOf(["-j8"])
if linkSDK {
args.appendContentsOf(["-sdk", SDKPath])
}
yaml += " other-args: \(args)\n"
......@@ -102,6 +104,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,30 +119,30 @@ 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)
let sdk: Bool
if args["linkSDK"]?.bool == false {
sdk = false
}
try manager.createDirectoryAtPath(workDirectory, withIntermediateDirectories: false, attributes: nil)
else { sdk = true }
//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)
try llbuildyaml(sources, workdir: workDirectory, modulename: name, linkSDK: sdk).writeToFile(llbuildyamlpath, atomically: false, encoding: NSUTF8StringEncoding)
if bootstrapOnly { return }
//now we try running sbt
......
......@@ -15,8 +15,11 @@ tasks:
#walk the src directory and recursively find all swift files
source: ["src/**.swift"]
#If true, we don't build, we only emit llbuild.yaml to the working directory. False is the default value.
#If true, we don't build, llbuild.yaml False is the default value.
bootstrapOnly: false
llbuildyaml: "llbuild.yaml" #path to emit llbuild.yaml
linkSDK: true #Whether to link the platform SDK. True is the default value.
```
## Implementation
......
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: ["cli/src/atllbuild.swift", "cli/src/config.swift", "cli/src/errors.swift", "cli/src/main.swift", "cli/src/PlatformPaths.swift", "cli/src/Shell.swift", "cli/src/Task.swift", "cli/src/Tools.swift", "parsers/yaml/src/Operators.swift", "parsers/yaml/src/Parser.swift", "parsers/yaml/src/Regex.swift", "parsers/yaml/src/Result.swift", "parsers/yaml/src/Tokenizer.swift", "parsers/yaml/src/Yaml.swift"]
sources: ["cli/src/atllbuild.swift", "cli/src/config.swift", "cli/src/errors.swift", "cli/src/main.swift", "cli/src/PlatformPaths.swift", "cli/src/Shell.swift", "cli/src/Task.swift", "cli/src/Tools.swift", "parsers/yaml/src/Operators.swift", "parsers/yaml/src/Parser.swift", "parsers/yaml/src/Regex.swift", "parsers/yaml/src/Result.swift", "parsers/yaml/src/Tokenizer.swift", "parsers/yaml/src/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"]
<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
......@@ -10,8 +10,8 @@ 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"]
inputs: ["cli/src/atllbuild.swift", "cli/src/config.swift", "cli/src/errors.swift", "cli/src/main.swift", "cli/src/PlatformPaths.swift", "cli/src/Shell.swift", "cli/src/Task.swift", "cli/src/Tools.swift", "parsers/yaml/src/Operators.swift", "parsers/yaml/src/Parser.swift", "parsers/yaml/src/Regex.swift", "parsers/yaml/src/Result.swift", "parsers/yaml/src/Tokenizer.swift", "parsers/yaml/src/Yaml.swift"]
sources: ["cli/src/atllbuild.swift", "cli/src/config.swift", "cli/src/errors.swift", "cli/src/main.swift", "cli/src/PlatformPaths.swift", "cli/src/Shell.swift", "cli/src/Task.swift", "cli/src/Tools.swift", "parsers/yaml/src/Operators.swift", "parsers/yaml/src/Parser.swift", "parsers/yaml/src/Regex.swift", "parsers/yaml/src/Result.swift", "parsers/yaml/src/Tokenizer.swift", "parsers/yaml/src/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
......
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