Commit f41fc1d9 authored by Drew's avatar Drew

Disable SDK linking with `linkSDK` option

Close #3
parent badf3937
......@@ -23,4 +23,5 @@ tasks:
source: ["src/**.swift"]
name: "atbuild"
bootstrapOnly: true
llbuildyaml: "llbuild-linux.yaml"
\ No newline at end of file
llbuildyaml: "llbuild-linux.yaml"
linkSDK: false
\ No newline at end of file
......@@ -17,7 +17,7 @@ commands:
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"]
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"]
......
......@@ -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"
......@@ -125,6 +127,12 @@ final class ATllbuild : Tool {
bootstrapOnly = false
}
let sdk: Bool
if args["linkSDK"]?.bool == false {
sdk = false
}
else { sdk = true }
let llbuildyamlpath : String
if args ["llbuildyaml"]?.string != nil {
......@@ -134,7 +142,7 @@ final class ATllbuild : Tool {
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
......
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