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