Skip to content

Commit

Permalink
Fix explicitFileType for extensionKit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtj0928 committed Jul 17, 2022
1 parent 0371a6c commit bf71a5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public class PBXProjGenerator {

var explicitFileType: String?
var lastKnownFileType: String?
let fileType = Xcode.fileType(path: Path(target.filename))
if target.platform == .macOS || target.platform == .watchOS || target.type == .framework {
let fileType = Xcode.fileType(path: Path(target.filename), productType: target.type)
if target.platform == .macOS || target.platform == .watchOS || target.type == .framework || target.type == .extensionKitExtension {
explicitFileType = fileType
} else {
lastKnownFileType = fileType
Expand Down
6 changes: 4 additions & 2 deletions Sources/XcodeGenKit/XCProjExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ extension Dictionary {

extension Xcode {

public static func fileType(path: Path) -> String? {
public static func fileType(path: Path, productType: PBXProductType? = nil) -> String? {
guard let fileExtension = path.extension else { return nil }
switch fileExtension {
switch (fileExtension, productType) {
// cases that aren't handled (yet) in XcodeProj.
case ("appex", .extensionKitExtension):
return "wrapper.extensionkit-extension"
default:
// fallback to XcodeProj defaults
return Xcode.filetype(extension: fileExtension)
Expand Down

0 comments on commit bf71a5d

Please sign in to comment.