@@ -2232,17 +2232,61 @@ class BuildPlanTestCase: BuildSystemProviderTestCase {
22322232 )
22332233 XCTAssertNoDiagnostics ( observability. diagnostics)
22342234
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 (
22372237 graph: graph,
22382238 fileSystem: fs,
22392239 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
22402257 )
22412258
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)
22462290 }
22472291
22482292 func testREPLArguments( ) async throws {
0 commit comments