@@ -2240,17 +2240,61 @@ class BuildPlanTestCase: BuildSystemProviderTestCase {
2240
2240
)
2241
2241
XCTAssertNoDiagnostics ( observability. diagnostics)
2242
2242
2243
- // WMO should always be on with Embedded
2244
- let plan = try await mockBuildPlan (
2243
+ // -Xfrontend -mergeable symbols should be passed with Embedded
2244
+ let result = try await BuildPlanResult ( plan : mockBuildPlan (
2245
2245
graph: graph,
2246
2246
fileSystem: fs,
2247
2247
observabilityScope: observability. topScope
2248
+ ) )
2249
+ result. checkTargetsCount ( 1 )
2250
+
2251
+ // Compile Swift Target
2252
+ let aCompileArguments = try result. moduleBuildDescription ( for: " A " ) . swift ( ) . compileArguments ( )
2253
+ let aCompileArgumentsPattern : [ StringPattern ] = [ " -whole-module-optimization " ]
2254
+ let aCompileArgumentsNegativePattern : [ StringPattern ] = [ " -wmo " ]
2255
+ XCTAssertMatch ( aCompileArguments, aCompileArgumentsPattern)
2256
+ XCTAssertNoMatch ( aCompileArguments, aCompileArgumentsNegativePattern)
2257
+ }
2258
+
2259
+ // Workaround for: https://github.com/swiftlang/swift-package-manager/issues/8648
2260
+ func test_mergeableSymbols_enabledInEmbedded( ) async throws {
2261
+ let Pkg : AbsolutePath = " /Pkg "
2262
+ let fs : FileSystem = InMemoryFileSystem (
2263
+ emptyFiles:
2264
+ Pkg . appending ( components: " Sources " , " A " , " A.swift " ) . pathString
2248
2265
)
2249
2266
2250
- let a = try BuildPlanResult ( plan: plan)
2251
- . moduleBuildDescription ( for: " A " ) . swift ( ) . emitCommandLine ( )
2252
- XCTAssertMatch ( a, [ " -whole-module-optimization " ] )
2253
- XCTAssertNoMatch ( a, [ " -wmo " ] )
2267
+ let observability = ObservabilitySystem . makeForTesting ( )
2268
+ let graph = try loadModulesGraph (
2269
+ fileSystem: fs,
2270
+ manifests: [
2271
+ Manifest . createRootManifest (
2272
+ displayName: " Pkg " ,
2273
+ path: . init( validating: Pkg . pathString) ,
2274
+ targets: [
2275
+ TargetDescription (
2276
+ name: " A " ,
2277
+ settings: [ . init( tool: . swift, kind: . enableExperimentalFeature( " Embedded " ) ) ]
2278
+ ) ,
2279
+ ]
2280
+ ) ,
2281
+ ] ,
2282
+ observabilityScope: observability. topScope
2283
+ )
2284
+ XCTAssertNoDiagnostics ( observability. diagnostics)
2285
+
2286
+ // -Xfrontend -mergeable symbols should be passed with Embedded
2287
+ let result = try await BuildPlanResult ( plan: mockBuildPlan (
2288
+ graph: graph,
2289
+ fileSystem: fs,
2290
+ observabilityScope: observability. topScope
2291
+ ) )
2292
+ result. checkTargetsCount ( 1 )
2293
+
2294
+ // Compile Swift Target
2295
+ let aCompileArguments = try result. moduleBuildDescription ( for: " A " ) . swift ( ) . compileArguments ( )
2296
+ let aCompileArgumentsPattern : [ StringPattern ] = [ " -Xfrontend " , " -mergeable-symbols " ]
2297
+ XCTAssertMatch ( aCompileArguments, aCompileArgumentsPattern)
2254
2298
}
2255
2299
2256
2300
func testREPLArguments( ) async throws {
0 commit comments