@@ -14,13 +14,20 @@ import Basics
14
14
@testable import Build
15
15
import PackageGraph
16
16
import PackageModel
17
+ import SPMBuildCore
17
18
import SPMTestSupport
18
19
import XCTest
19
20
20
21
final class ClangTargetBuildDescriptionTests : XCTestCase {
21
22
func testClangIndexStorePath( ) throws {
22
- let targetDescription = try makeTargetBuildDescription ( )
23
+ let targetDescription = try makeTargetBuildDescription ( " test " )
23
24
XCTAssertTrue ( try targetDescription. basicArguments ( ) . contains ( " -index-store-path " ) )
25
+ XCTAssertFalse ( try targetDescription. basicArguments ( ) . contains ( " -w " ) )
26
+ }
27
+
28
+ func testWarningSuppressionForRemotePackages( ) throws {
29
+ let targetDescription = try makeTargetBuildDescription ( " test-warning-supression " , usesSourceControl: true )
30
+ XCTAssertTrue ( try targetDescription. basicArguments ( ) . contains ( " -w " ) )
24
31
}
25
32
26
33
private func makeClangTarget( ) throws -> ClangTarget {
@@ -47,18 +54,25 @@ final class ClangTargetBuildDescriptionTests: XCTestCase {
47
54
)
48
55
}
49
56
50
- private func makeTargetBuildDescription( ) throws -> ClangTargetBuildDescription {
57
+ private func makeTargetBuildDescription( _ packageName: String ,
58
+ buildParameters: BuildParameters ? = nil ,
59
+ usesSourceControl: Bool = false ) throws -> ClangTargetBuildDescription {
51
60
let observability = ObservabilitySystem . makeForTesting ( verbose: false )
52
61
53
- let manifest = Manifest . createRootManifest (
54
- displayName: " dummy " ,
55
- toolsVersion: . v5,
56
- targets: [ try TargetDescription ( name: " dummy " ) ]
57
- )
62
+ let manifest : Manifest
63
+ if usesSourceControl {
64
+ manifest = Manifest . createLocalSourceControlManifest (
65
+ displayName: packageName, path: AbsolutePath ( " / \( packageName) " ) )
66
+ } else {
67
+ manifest = Manifest . createRootManifest (
68
+ displayName: packageName,
69
+ toolsVersion: . v5,
70
+ targets: [ try TargetDescription ( name: " dummy " ) ] )
71
+ }
58
72
59
73
let target = try makeResolvedTarget ( )
60
74
61
- let package = Package ( identity: . plain( " dummy " ) ,
75
+ let package = Package ( identity: . plain( packageName ) ,
62
76
manifest: manifest,
63
77
path: . root,
64
78
targets: [ target. underlying] ,
@@ -77,7 +91,7 @@ final class ClangTargetBuildDescriptionTests: XCTestCase {
77
91
platformVersionProvider: . init( implementation: . minimumDeploymentTargetDefault) ) ,
78
92
target: target,
79
93
toolsVersion: . current,
80
- buildParameters: mockBuildParameters (
94
+ buildParameters: buildParameters ?? mockBuildParameters (
81
95
toolchain: try UserToolchain . default,
82
96
indexStoreMode: . on
83
97
) ,
0 commit comments