mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Code review comments
This commit is contained in:
+2
-2
@@ -203,10 +203,10 @@ Settings are merged in the following order: groups, base, configs.
|
||||
- `TEST_TARGET_NAME`: for ui tests that target an application
|
||||
- `TEST_HOST`: for unit tests that target an application
|
||||
- [ ] **dependencies**: **[[Dependency](#dependency)]** - Dependencies for the target
|
||||
- [ ] **info**: **[Plist](#plist)** - If defined, this will generate and write an `Info.plist` to the specified path and use it by setting the `INFOPLIST_FILE` build setting for every configuration, unless `INFOPLIST_FILE` is already defined in **settings** for this configuration. The following properties are generated automatically, the rest will have to be provided.
|
||||
- [ ] **info**: **[Plist](#plist)** - If defined, this will generate and write an `Info.plist` to the specified path and use it by setting the `INFOPLIST_FILE` build setting for every configuration, unless `INFOPLIST_FILE` is already defined in **settings** for this configuration. The following properties are generated automatically if appropriate, the rest will have to be provided.
|
||||
- `CFBundleIdentifier`
|
||||
- `CFBundleInfoDictionaryVersion`
|
||||
- `CFBundleExecutable`
|
||||
- `CFBundleExecutable` **Not generated for targets of type bundle**
|
||||
- `CFBundleName`
|
||||
- `CFBundleDevelopmentRegion`
|
||||
- `CFBundleShortVersionString`
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FileWriter {
|
||||
for target in project.targets {
|
||||
// write Info.plist
|
||||
if let plist = target.info {
|
||||
let properties = infoPlistGenerator.generateProperties(target: target).merged(plist.properties)
|
||||
let properties = infoPlistGenerator.generateProperties(for: target).merged(plist.properties)
|
||||
try writePlist(properties, path: plist.path)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ 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
|
||||
*/
|
||||
private func generateDefaultInfoPlist(target: Target) -> [String: Any] {
|
||||
private func generateDefaultInfoPlist(for target: Target) -> [String: Any] {
|
||||
var dictionary: [String: Any] = [:]
|
||||
dictionary["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
||||
dictionary["CFBundleInfoDictionaryVersion"] = "6.0"
|
||||
@@ -26,8 +26,8 @@ public class InfoPlistGenerator {
|
||||
return dictionary
|
||||
}
|
||||
|
||||
public func generateProperties(target: Target) -> [String: Any] {
|
||||
var targetInfoPlist = generateDefaultInfoPlist(target: target)
|
||||
public func generateProperties(for target: Target) -> [String: Any] {
|
||||
var targetInfoPlist = generateDefaultInfoPlist(for: target)
|
||||
switch target.type {
|
||||
case .uiTestBundle,
|
||||
.unitTestBundle:
|
||||
|
||||
@@ -971,16 +971,17 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
let infoPlistFile = tempPath + plist.path
|
||||
let data: Data = try infoPlistFile.read()
|
||||
let infoPlist = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String: Any]
|
||||
var expectedInfoPlist: [String: Any] = [:]
|
||||
expectedInfoPlist["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
||||
expectedInfoPlist["CFBundleInfoDictionaryVersion"] = "6.0"
|
||||
expectedInfoPlist["CFBundleExecutable"] = "$(EXECUTABLE_NAME)"
|
||||
expectedInfoPlist["CFBundleName"] = "$(PRODUCT_NAME)"
|
||||
expectedInfoPlist["CFBundleDevelopmentRegion"] = "$(DEVELOPMENT_LANGUAGE)"
|
||||
expectedInfoPlist["CFBundleShortVersionString"] = "1.0"
|
||||
expectedInfoPlist["CFBundleVersion"] = "1"
|
||||
expectedInfoPlist["CFBundlePackageType"] = "APPL"
|
||||
expectedInfoPlist["UISupportedInterfaceOrientations"] = ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]
|
||||
let expectedInfoPlist: [String: Any] = [
|
||||
"CFBundleIdentifier": "$(PRODUCT_BUNDLE_IDENTIFIER)",
|
||||
"CFBundleInfoDictionaryVersion": "6.0",
|
||||
"CFBundleName": "$(PRODUCT_NAME)",
|
||||
"CFBundleExecutable": "$(EXECUTABLE_NAME)",
|
||||
"CFBundleDevelopmentRegion": "$(DEVELOPMENT_LANGUAGE)",
|
||||
"CFBundleShortVersionString": "1.0",
|
||||
"CFBundleVersion": "1",
|
||||
"CFBundlePackageType": "APPL",
|
||||
"UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]
|
||||
]
|
||||
|
||||
try expect(NSDictionary(dictionary: expectedInfoPlist).isEqual(to: infoPlist)).beTrue()
|
||||
}
|
||||
@@ -1020,14 +1021,15 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
let infoPlistFile = tempPath + plist.path
|
||||
let data: Data = try infoPlistFile.read()
|
||||
let infoPlist = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String: Any]
|
||||
var expectedInfoPlist: [String: Any] = [:]
|
||||
expectedInfoPlist["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)"
|
||||
expectedInfoPlist["CFBundleInfoDictionaryVersion"] = "6.0"
|
||||
expectedInfoPlist["CFBundleName"] = "$(PRODUCT_NAME)"
|
||||
expectedInfoPlist["CFBundleDevelopmentRegion"] = "$(DEVELOPMENT_LANGUAGE)"
|
||||
expectedInfoPlist["CFBundleShortVersionString"] = "1.0"
|
||||
expectedInfoPlist["CFBundleVersion"] = "1"
|
||||
expectedInfoPlist["CFBundlePackageType"] = "BNDL"
|
||||
let expectedInfoPlist: [String: Any] = [
|
||||
"CFBundleIdentifier": "$(PRODUCT_BUNDLE_IDENTIFIER)",
|
||||
"CFBundleInfoDictionaryVersion": "6.0",
|
||||
"CFBundleName": "$(PRODUCT_NAME)",
|
||||
"CFBundleDevelopmentRegion": "$(DEVELOPMENT_LANGUAGE)",
|
||||
"CFBundleShortVersionString": "1.0",
|
||||
"CFBundleVersion": "1",
|
||||
"CFBundlePackageType": "BNDL"
|
||||
]
|
||||
|
||||
try expect(NSDictionary(dictionary: expectedInfoPlist).isEqual(to: infoPlist)).beTrue()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user