Commit eadeb144 authored by Drew's avatar Drew

Support whole-module-optimization

Due to SR-881, whole-module-optimization is more complicated than simply
adding it to compile options.

As a workaround, we compile twice.
parent da9dce6b
Pipeline #1167 passed with stage
......@@ -220,6 +220,7 @@ final class ATllbuild : Tool {
case PublishProduct = "publish-product"
case UmbrellaHeader = "umbrella-header"
case ModuleMap = "module-map"
case WholeModuleOptimization = "whole-module-optimization"
static var allOptions : [Options] {
......@@ -239,12 +240,17 @@ final class ATllbuild : Tool {
XCTestStrict,
IncludeWithUser,
PublishProduct,
UmbrellaHeader
UmbrellaHeader,
WholeModuleOptimization
]
}
}
func run(task: Task) {
run(task, wmoHack: false)
}
func run(task: Task, wmoHack : Bool = false) {
//warn if we don't understand an option
var knownOptions = Options.allOptions.map({$0.rawValue})
......@@ -304,6 +310,11 @@ final class ATllbuild : Tool {
compileOptions.append(os)
}
}
if wmoHack {
compileOptions.append("-whole-module-optimization")
}
if let includePaths = task[Options.IncludeWithUser.rawValue]?.vector {
for path_s in includePaths {
guard let path = path_s.string else { fatalError("Non-string path \(path_s)") }
......@@ -447,6 +458,12 @@ final class ATllbuild : Tool {
}
}
if task[Options.WholeModuleOptimization.rawValue]?.bool == true && !wmoHack {
print("Work around SR-881")
run(task, wmoHack: true)
}
}
}
......
(package
:name "wmo"
:tasks {
:default {
:tool "atllbuild"
:sources ["src/**.swift"]
:name "wmo"
:output-type "static-library"
:publish-product true
:whole-module-optimization true
}
}
)
class Bar { }
\ No newline at end of file
class Foo { }
\ No newline at end of file
......@@ -10,6 +10,10 @@ pwd
echo "****************SELF-HOSTING TEST**************"
$ATBUILD atbuild
echo "****************WMO TEST**************"
cd $DIR/tests/fixtures/wmo
$ATBUILD
echo "****************UMBRELLA TEST**************"
cd $DIR/tests/fixtures/umbrella_header
$ATBUILD check
......
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