Commit 573176c4 authored by Drew's avatar Drew

Override swiftC from .atpkg

We need this to bootstrap a linux build on OSX.
parent f387c817
Pipeline #717 passed with stage
Subproject commit 9337c33285e9432592d7f5ea695432649d144bf3
Subproject commit eb09cb50c7c551bf736028f9136bb058bcff5442
......@@ -31,7 +31,7 @@ final class ATllbuild : Tool {
* - 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, linkSDK: Bool, compileOptions: [String], outputType: OutputType, linkWithProduct:[String]) -> String {
func llbuildyaml(sources: [String], workdir: String, modulename: String, linkSDK: Bool, compileOptions: [String], outputType: OutputType, linkWithProduct:[String], swiftCPath: String) -> String {
let productPath = workdir + "products/"
//this format is largely undocumented, but I reverse-engineered it from SwiftPM.
var yaml = "client:\n name: swift-build\n\n"
......@@ -48,7 +48,7 @@ final class ATllbuild : Tool {
yaml += "commands:\n"
yaml += " <atllbuild-swiftc>:\n"
yaml += " tool: swift-compiler\n"
yaml += " executable: \"\(SwiftCPath)\"\n"
yaml += " executable: \"\(swiftCPath)\"\n"
yaml += " inputs: \(sources)\n"
yaml += " sources: \(sources)\n"
......@@ -98,7 +98,7 @@ final class ATllbuild : Tool {
yaml += " inputs: \(llbuild_inputs)\n"
yaml += " outputs: [\"<atllbuild>\", \"\(executablePath)\"]\n"
//and now we have the crazy 'args'
args = [SwiftCPath, "-o",executablePath]
args = [swiftCPath, "-o",executablePath]
args.appendContentsOf(objects)
args.appendContentsOf(builtProducts)
yaml += " args: \(args)\n"
......@@ -195,8 +195,16 @@ final class ATllbuild : Tool {
else {
llbuildyamlpath = workDirectory + "llbuild.yaml"
}
let swiftCPath: String
if let c = task["swiftCPath"]?.string {
swiftCPath = c
}
else {
swiftCPath = SwiftCPath
}
let yaml = llbuildyaml(sources, workdir: workDirectory, modulename: name, linkSDK: sdk, compileOptions: compileOptions, outputType: outputType, linkWithProduct: linkWithProduct)
let yaml = llbuildyaml(sources, workdir: workDirectory, modulename: name, linkSDK: sdk, compileOptions: compileOptions, outputType: outputType, linkWithProduct: linkWithProduct, swiftCPath: swiftCPath)
let _ = try? yaml.writeToFile(llbuildyamlpath, atomically: false, encoding: NSUTF8StringEncoding)
if bootstrapOnly { return }
......
......@@ -9,7 +9,7 @@ targets:
commands:
<atllbuild-swiftc>:
tool: swift-compiler
executable: "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc"
executable: "/usr/local/bin/swiftc"
inputs: ["atbuild/src/main.swift"]
sources: ["atbuild/src/main.swift"]
objects: [".atllbuild/objects/main.swift.o"]
......@@ -22,5 +22,5 @@ commands:
tool: shell
inputs: ["<atllbuild-swiftc>", ".atllbuild/objects/main.swift.o", ".atllbuild/products/attools.a", ".atllbuild/products/atpkg.a"]
outputs: ["<atllbuild>", ".atllbuild/products/atbuild"]
args: ["/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc", "-o", ".atllbuild/products/atbuild", ".atllbuild/objects/main.swift.o", ".atllbuild/products/attools.a", ".atllbuild/products/atpkg.a"]
args: ["/usr/local/bin/swiftc", "-o", ".atllbuild/products/atbuild", ".atllbuild/objects/main.swift.o", ".atllbuild/products/attools.a", ".atllbuild/products/atpkg.a"]
description: Linking executable .atllbuild/products/atbuild
......@@ -34,10 +34,14 @@
:attools {
:bootstrapOnly true
:llbuildyaml "bootstrap/bootstrap-linux-attools.swift-build"
:swiftCPath "/usr/local/bin/swiftc"
}
:atbuild {
:bootstrapOnly true
:llbuildyaml "bootstrap/bootstrap-linux.swift-build"
:swiftCPath "/usr/local/bin/swiftc"
}
}
}
......
......@@ -34,6 +34,9 @@ The `atllbuild` tool uses the [`swift-llbuild`](https://github.com/apple/swift-l
;;Note that this is for linking dependencies built by atllbuild;
;;or other libraries, you should use UNSUPPORTED https://github.com/AnarchyTools/atbuild/issues/13
:linkWithProduct ["attools.a" "atpkg.a"]
;;The path to swiftC. By default, we guess based on your platform
swiftCPath:"/usr/local/bin/swiftc"
}
}
......
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