mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-10 14:51:04 +03:00
f5423f1ce3
Includes app extension as XPC type.
44 lines
1.5 KiB
Swift
44 lines
1.5 KiB
Swift
import Foundation
|
|
import PathKit
|
|
import ProjectSpec
|
|
|
|
public class InfoPlistGenerator {
|
|
|
|
/**
|
|
Default info plist attributes taken from:
|
|
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Base/Base_DefinitionsInfoPlist.xctemplate/TemplateInfo.plist
|
|
*/
|
|
var defaultInfoPlist: [String: Any] = {
|
|
var dictionary: [String: Any] = [:]
|
|
dictionary["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
|
dictionary["CFBundleInfoDictionaryVersion"] = "6.0"
|
|
dictionary["CFBundleExecutable"] = "$(EXECUTABLE_NAME)"
|
|
dictionary["CFBundleName"] = "$(PRODUCT_NAME)"
|
|
dictionary["CFBundleDevelopmentRegion"] = "$(DEVELOPMENT_LANGUAGE)"
|
|
dictionary["CFBundleShortVersionString"] = "1.0"
|
|
dictionary["CFBundleVersion"] = "1"
|
|
return dictionary
|
|
}()
|
|
|
|
public func generateProperties(target: Target) -> [String: Any] {
|
|
var targetInfoPlist = defaultInfoPlist
|
|
switch target.type {
|
|
case .uiTestBundle,
|
|
.unitTestBundle:
|
|
targetInfoPlist["CFBundlePackageType"] = "BNDL"
|
|
case .application,
|
|
.watch2App:
|
|
targetInfoPlist["CFBundlePackageType"] = "APPL"
|
|
case .framework:
|
|
targetInfoPlist["CFBundlePackageType"] = "FMWK"
|
|
case .bundle:
|
|
targetInfoPlist["CFBundlePackageType"] = "BNDL"
|
|
case .xpcService,
|
|
.appExtension:
|
|
targetInfoPlist["CFBundlePackageType"] = "XPC!"
|
|
default: break
|
|
}
|
|
return targetInfoPlist
|
|
}
|
|
}
|