Skip to content

Commit

Permalink
Remove + in projection filenames, and rename ABI.h (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Sep 15, 2024
1 parent 0bab341 commit e16ca3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Generator/Sources/SwiftWinRT/Writing/ABIModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import WindowsMetadata
internal func writeABIModule(_ module: SwiftProjection.Module, directoryPath: String, generateCMakeLists: Bool) throws {
let includeDirectoryPath = "\(directoryPath)\\include"

try writeABIFile(module: module, toPath: "\(includeDirectoryPath)\\ABI.h")
try writeABIFile(module: module, toPath: "\(includeDirectoryPath)\\\(module.name).h")
// FIXME: Support transitive references?
for referencedModule in module.references {
guard !referencedModule.isEmpty else { continue }
Expand Down
10 changes: 6 additions & 4 deletions Generator/Sources/SwiftWinRT/writeProjectionFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ fileprivate func writeAssemblyModuleFiles(
}

if (typeDefinition as? ClassDefinition)?.isStatic != true,
!typeDefinition.isValueType || SupportModules.WinRT.getBuiltInTypeKind(typeDefinition) != .definitionAndProjection {
let typeName = try module.projection.toTypeName(typeDefinition)
cmakeSources.append("\(compactNamespace)/Projections/\(typeName)+Projection.swift")
!typeDefinition.isValueType || SupportModules.WinRT.getBuiltInTypeKind(typeDefinition) != .definitionAndProjection {
// Avoid toProjectionTypeName because structs/enums have no -Projection suffix,
// which would result in two files with the same name in the project, which SPM does not support.
let fileName = try module.projection.toTypeName(typeDefinition) + "Projection.swift"
cmakeSources.append("\(compactNamespace)/Projections/\(fileName)")
try writeABIProjectionConformanceFile(typeDefinition, module: module,
toPath: "\(assemblyNamespaceDirectoryPath)\\Projections\\\(typeName)+Projection.swift")
toPath: "\(assemblyNamespaceDirectoryPath)\\Projections\\\(fileName)")
}
}

Expand Down

0 comments on commit e16ca3a

Please sign in to comment.