@@ -43,7 +43,7 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
43
43
" PRODUCT_NAME " : " $(TARGET_NAME) " ,
44
44
" CLANG_ENABLE_MODULES " : " NO " ,
45
45
" GENERATE_INFOPLIST_FILE " : " YES " ,
46
- " DEPENDENCIES " : " Foundation UIKit " ,
46
+ " DEPENDENCIES " : " Foundation " ,
47
47
// Disable the SetOwnerAndGroup action by setting them to empty values.
48
48
" INSTALL_GROUP " : " " ,
49
49
" INSTALL_OWNER " : " " ,
@@ -54,7 +54,8 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
54
54
TestStandardTarget (
55
55
" CoreFoo " , type: . framework,
56
56
buildPhases: [
57
- TestSourcesBuildPhase ( [ " CoreFoo.m " ] )
57
+ TestSourcesBuildPhase ( [ " CoreFoo.m " ] ) ,
58
+ TestFrameworksBuildPhase ( )
58
59
] )
59
60
] )
60
61
]
@@ -66,22 +67,36 @@ fileprivate struct DependencyVerificationBuildOperationTests: CoreBasedTests {
66
67
// Write the source files.
67
68
try await tester. fs. writeFileContents ( SRCROOT . join ( " Sources/CoreFoo.m " ) ) { contents in
68
69
contents <<< """
69
- #include <Foundation/Foundation.h>
70
- #include <Accelerate/Accelerate.h>
70
+ #include <Foundation/Foundation.h>
71
+ #include <Accelerate/Accelerate.h>
71
72
72
- void f0(void) { };
73
- """
73
+ void f0(void) { };
74
+ """
74
75
}
75
76
76
- let parameters = BuildParameters (
77
- action: . install, configuration: " Debug " ,
78
- overrides: [
79
- " DSTROOT " : tmpDirPath. join ( " dst " ) . str
80
- ] )
77
+ func parameters( _ overrides: [ String : String ] = [ : ] ) -> BuildParameters {
78
+ return BuildParameters (
79
+ action: . install, configuration: " Debug " ,
80
+ overrides: [
81
+ " DSTROOT " : tmpDirPath. join ( " dst " ) . str
82
+ ] . merging ( overrides, uniquingKeysWith: { _, new in new } )
83
+ )
84
+ }
81
85
82
- try await tester. checkBuild ( parameters: parameters, runDestination: . macOS, persistent: true ) { results in
86
+ // Non-modular clang complains about undeclared dependency
87
+ try await tester. checkBuild ( parameters: parameters ( ) , runDestination: . macOS, persistent: true ) { results in
83
88
results. checkError ( . contains( " Undeclared dependencies: \n Accelerate " ) )
84
89
}
90
+
91
+ // Declaring dependency resolves problem
92
+ try await tester. checkBuild ( parameters: parameters ( [ " DEPENDENCIES " : " Foundation Accelerate " ] ) , runDestination: . macOS, persistent: true ) { results in
93
+ results. checkNoErrors ( )
94
+ }
95
+
96
+ // Linker complains about undeclared dependency
97
+ try await tester. checkBuild ( parameters: parameters ( [ " OTHER_LDFLAGS " : " -framework CoreData " , " DEPENDENCIES " : " Foundation Accelerate " ] ) , runDestination: . macOS, persistent: true ) { results in
98
+ results. checkError ( . contains( " Undeclared dependencies: \n CoreData " ) )
99
+ }
85
100
}
86
101
}
87
102
}
0 commit comments