Skip to content

Commit cd397c7

Browse files
committed
Rename xctest executable to avoid inferring it as module name
1 parent 2d8ded1 commit cd397c7

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Sources/Build/Command.link().swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ extension Command {
5252
case .Library(.Static):
5353
args.append(outpath)
5454
case .Test:
55+
args += ["-module-name", product.name]
5556
#if os(OSX)
5657
args += ["-Xlinker", "-bundle"]
5758
args += ["-F", try platformFrameworksPath()]

Sources/Transmute/Package+products.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ extension Package {
3434
if !testModules.isEmpty {
3535
let modules: [SwiftModule] = testModules.map{$0} // or linux compiler crash (2016-02-03)
3636
//TODO and then we should prefix all modules with their package probably
37-
let product = Product(name: self.name, type: .Test, modules: modules)
37+
//Suffix 'Tests' to test product so the module name of linux executable don't collide with
38+
//main package, if present.
39+
let product = Product(name: "\(self.name)Tests", type: .Test, modules: modules)
3840
products.append(product)
3941
}
4042

Sources/swift-test/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ do {
3434
// that makes us depend on the whole Manifest system
3535

3636
let packageName = opts.path.root.basename //FIXME probably not true
37-
let maybePath = Path.join(opts.path.build, configuration, "\(packageName).xctest")
37+
let maybePath = Path.join(opts.path.build, configuration, "\(packageName)Tests.xctest")
3838

3939
if maybePath.exists {
4040
return maybePath

0 commit comments

Comments
 (0)