Skip to content

Commit 59a6615

Browse files
committed
HACK to allow us to pass a -I for CI XCTest use
Will remove shortly with a proper flag.
1 parent 151a973 commit 59a6615

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Sources/Build/describe().swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public func describe(prefix: String, _ conf: Configuration, _ modules: [Module],
2222
fatalError("No modules input") //TODO throw
2323
}
2424

25-
let Xcc = Xcc.flatMap{ ["-Xcc", $0] }
25+
let Xcc = Xcc.flatMap{ ["-Xcc", $0] } + extraImports()
2626
let Xld = Xld.flatMap{ ["-Xlinker", $0] }
2727
let prefix = try mkdir(prefix, conf.dirname)
2828
let yaml = try YAML(path: "\(prefix).yaml")
@@ -147,6 +147,7 @@ public func describe(prefix: String, _ conf: Configuration, _ modules: [Module],
147147
let hack2 = hack1.sources.root.parentDirectory
148148
let hack3 = Path.join(hack2, "LinuxMain.swift")
149149
args.append(hack3)
150+
args += Xcc
150151

151152
args.append("-emit-executable")
152153
args += ["-I", prefix]
@@ -181,3 +182,12 @@ extension Product {
181182
return recursiveDependencies(modules.map{$0}).flatMap{ $0 as? SwiftModule }
182183
}
183184
}
185+
186+
private func extraImports() -> [String] {
187+
//FIXME HACK
188+
if let I = getenv("SWIFTPM_EXTRA_IMPORT") {
189+
return ["-I", I]
190+
} else {
191+
return []
192+
}
193+
}

Utilities/bootstrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ a location ('--prefix').""")
532532

533533
cmd = [os.path.join(sandbox_path, "bin", "swift-build")]
534534
if opts.xctest_path:
535-
cmd.extend(["-Xcc", "-I", "-Xcc", opts.xctest_path])
535+
env_cmd.append("SWIFTPM_EXTRA_IMPORT=" + opts.xctest_path)
536536
# Tell the linker where to look for XCTest, but autolinking
537537
# knows to pass -lXCTest.
538538
cmd.extend(["-Xlinker", "-L", "-Xlinker", opts.xctest_path])

0 commit comments

Comments
 (0)