diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1adcb17..b964998a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
#### Added
- Added `weak` linking setting for dependencies [#411](https://github.com/yonaskolb/XcodeGen/pull/411) @alvarhansen
+- Added `info` to targets for generating an `Info.plist` [#415](https://github.com/yonaskolb/XcodeGen/pull/415) @yonaskolb
+- Added `entitlements` to targets for generating an `.entitlement` file [#415](https://github.com/yonaskolb/XcodeGen/pull/415) @yonaskolb
#### Changed
- Performance improvements for large projects [#388](https://github.com/yonaskolb/XcodeGen/pull/388) [#417](https://github.com/yonaskolb/XcodeGen/pull/417) [#416](https://github.com/yonaskolb/XcodeGen/pull/416) @yonaskolb @kastiglione
diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md
index 5117b78e..fcb565a9 100644
--- a/Docs/ProjectSpec.md
+++ b/Docs/ProjectSpec.md
@@ -171,6 +171,16 @@ Settings are merged in the following order: groups, base, configs.
- `FRAMEWORK_SEARCH_PATHS`: If carthage dependencies are used, the platform build path will be added to this setting
- `OTHER_LDFLAGS`: See `requiresObjCLinking` below
- [ ] **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. The following properties are generated automatically, the rest will have to be provided.
+ - `CFBundleIdentifier`
+ - `CFBundleInfoDictionaryVersion`
+ - `CFBundleExecutable`
+ - `CFBundleName`
+ - `CFBundleDevelopmentRegion`
+ - `CFBundleShortVersionString`
+ - `CFBundleVersion`
+ - `CFBundlePackageType`
+- [ ] **entitlements**: **[Plist](#plist)** - If defined this will generate and write a `.entitlements` file, and use it by setting `CODE_SIGN_ENTITLEMENTS` build setting for every configuration. All properties must be provided
- [ ] **templates**: **[String]** - A list of target templates that will be merged in order
- [ ] **transitivelyLinkDependencies**: **Bool** - If this is not specified the value from the project set in [Options](#options)`.transitivelyLinkDependencies` will be used.
- [ ] **directlyEmbedCarthageDependencies**: **Bool** - If this is `true` Carthage dependencies will be embedded using an `Embed Frameworks` build phase instead of the `copy-frameworks` script. Defaults to `true` for all targets except iOS/tvOS/watchOS Applications.
@@ -371,6 +381,25 @@ targets:
Debug: App/debug.xcconfig
Release: App/release.xcconfig
```
+### Plist
+Plists are created on disk on every generation of the project. They can be used as a way to define `Info.plist` or `.entitlement` files. Some `Info.plist` properties are generated automatically.
+
+- [x] **path**: **String** - This is the path where the plist will be written to
+- [x] **properties**: **[String: Any]** - This is a map of all the plist keys and values
+
+```yml
+targets:
+ App:
+ info:
+ path: App/Info.plist
+ properties:
+ UISupportedInterfaceOrientations: [UIInterfaceOrientationPortrait]
+ UILaunchStoryboardName: LaunchScreen
+ entitlements:
+ path: App/App.entitlements
+ properties:
+ com.apple.security.application-groups: group.com.app
+```
### Build Script
diff --git a/Sources/ProjectSpec/Plist.swift b/Sources/ProjectSpec/Plist.swift
new file mode 100644
index 00000000..90904c4f
--- /dev/null
+++ b/Sources/ProjectSpec/Plist.swift
@@ -0,0 +1,26 @@
+import Foundation
+import JSONUtilities
+
+public struct Plist: Equatable {
+
+ public let path: String
+ public let properties: [String: Any]
+
+ public init(path: String, attributes: [String: Any] = [:]) {
+ self.path = path
+ self.properties = attributes
+ }
+
+ public static func == (lhs: Plist, rhs: Plist) -> Bool {
+ return lhs.path == rhs.path &&
+ NSDictionary(dictionary: lhs.properties).isEqual(to: rhs.properties)
+ }
+}
+
+extension Plist: JSONObjectConvertible {
+
+ public init(jsonDictionary: JSONDictionary) throws {
+ path = try jsonDictionary.json(atKeyPath: "path")
+ properties = jsonDictionary.json(atKeyPath: "properties") ?? [:]
+ }
+}
diff --git a/Sources/ProjectSpec/Target.swift b/Sources/ProjectSpec/Target.swift
index f4118c3c..8b38ee52 100644
--- a/Sources/ProjectSpec/Target.swift
+++ b/Sources/ProjectSpec/Target.swift
@@ -28,6 +28,8 @@ public struct Target: ProjectTarget {
public var settings: Settings
public var sources: [TargetSource]
public var dependencies: [Dependency]
+ public var info: Plist?
+ public var entitlements: Plist?
public var transitivelyLinkDependencies: Bool?
public var directlyEmbedCarthageDependencies: Bool?
public var requiresObjCLinking: Bool?
@@ -63,6 +65,8 @@ public struct Target: ProjectTarget {
configFiles: [String: String] = [:],
sources: [TargetSource] = [],
dependencies: [Dependency] = [],
+ info: Plist? = nil,
+ entitlements: Plist? = nil,
transitivelyLinkDependencies: Bool? = nil,
directlyEmbedCarthageDependencies: Bool? = nil,
requiresObjCLinking: Bool? = nil,
@@ -82,6 +86,8 @@ public struct Target: ProjectTarget {
self.configFiles = configFiles
self.sources = sources
self.dependencies = dependencies
+ self.info = info
+ self.entitlements = entitlements
self.transitivelyLinkDependencies = transitivelyLinkDependencies
self.directlyEmbedCarthageDependencies = directlyEmbedCarthageDependencies
self.requiresObjCLinking = requiresObjCLinking
@@ -209,6 +215,8 @@ extension Target: Equatable {
lhs.settings == rhs.settings &&
lhs.configFiles == rhs.configFiles &&
lhs.sources == rhs.sources &&
+ lhs.info == rhs.info &&
+ lhs.entitlements == rhs.entitlements &&
lhs.dependencies == rhs.dependencies &&
lhs.prebuildScripts == rhs.prebuildScripts &&
lhs.postbuildScripts == rhs.postbuildScripts &&
@@ -278,6 +286,14 @@ extension Target: NamedJSONDictionaryConvertible {
} else {
dependencies = try jsonDictionary.json(atKeyPath: "dependencies", invalidItemBehaviour: .fail)
}
+
+ if jsonDictionary["info"] != nil {
+ info = try jsonDictionary.json(atKeyPath: "info") as Plist
+ }
+ if jsonDictionary["entitlements"] != nil {
+ entitlements = try jsonDictionary.json(atKeyPath: "entitlements") as Plist
+ }
+
transitivelyLinkDependencies = jsonDictionary.json(atKeyPath: "transitivelyLinkDependencies")
directlyEmbedCarthageDependencies = jsonDictionary.json(atKeyPath: "directlyEmbedCarthageDependencies")
requiresObjCLinking = jsonDictionary.json(atKeyPath: "requiresObjCLinking")
diff --git a/Sources/XcodeGen/main.swift b/Sources/XcodeGen/main.swift
index 9d732054..f14670c6 100644
--- a/Sources/XcodeGen/main.swift
+++ b/Sources/XcodeGen/main.swift
@@ -47,19 +47,11 @@ func generate(spec: String, project: String, isQuiet: Bool, justVersion: Bool) {
let xcodeProject = try projectGenerator.generateXcodeProject()
logger.info("⚙️ Writing project...")
+ let projectWriter = ProjectWriter(project: project)
+ try projectWriter.writeXcodeProject(xcodeProject)
+ try projectWriter.writePlists()
- let projectFile = projectPath + "\(project.name).xcodeproj"
- let tempPath = Path.temporary + "XcodeGen_\(Int(NSTimeIntervalSince1970))"
- try? tempPath.delete()
- if projectFile.exists {
- try projectFile.copy(tempPath)
- }
- try xcodeProject.write(path: tempPath, override: true)
- try? projectFile.delete()
- try tempPath.copy(projectFile)
- try? tempPath.delete()
-
- logger.success("💾 Saved project to \(projectFile.string)")
+ logger.success("💾 Saved project to \(project.projectPath.string)")
} catch let error as SpecValidationError {
fatalError(error.description)
} catch {
diff --git a/Sources/XcodeGenKit/InfoPlistGenerator.swift b/Sources/XcodeGenKit/InfoPlistGenerator.swift
new file mode 100644
index 00000000..0c4536cc
--- /dev/null
+++ b/Sources/XcodeGenKit/InfoPlistGenerator.swift
@@ -0,0 +1,42 @@
+import Foundation
+import ProjectSpec
+import PathKit
+
+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:
+ targetInfoPlist["CFBundlePackageType"] = "XPC"
+ default: break
+ }
+ return targetInfoPlist
+ }
+}
diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift
index 2539a22c..0a5291cc 100644
--- a/Sources/XcodeGenKit/PBXProjGenerator.swift
+++ b/Sources/XcodeGenKit/PBXProjGenerator.swift
@@ -747,8 +747,15 @@ public class PBXProjGenerator {
let configs: [XCBuildConfiguration] = project.configs.map { config in
var buildSettings = project.getTargetBuildSettings(target: target, config: config)
- // automatically set INFOPLIST_FILE path
- if !project.targetHasBuildSetting("INFOPLIST_FILE", target: target, config: config) {
+ // Set CODE_SIGN_ENTITLEMENTS
+ if let entitlements = target.entitlements {
+ buildSettings["CODE_SIGN_ENTITLEMENTS"] = entitlements.path
+ }
+
+ // Set INFOPLIST_FILE
+ if let info = target.info {
+ buildSettings["INFOPLIST_FILE"] = info.path
+ } else if !project.targetHasBuildSetting("INFOPLIST_FILE", target: target, config: config) {
if searchForPlist {
plistPath = getInfoPlist(target.sources)
searchForPlist = false
diff --git a/Sources/XcodeGenKit/ProjectWriter.swift b/Sources/XcodeGenKit/ProjectWriter.swift
new file mode 100644
index 00000000..9029f42e
--- /dev/null
+++ b/Sources/XcodeGenKit/ProjectWriter.swift
@@ -0,0 +1,56 @@
+import Foundation
+import ProjectSpec
+import xcodeproj
+import PathKit
+
+public class ProjectWriter {
+
+ let project: Project
+
+ public init(project: Project) {
+ self.project = project
+ }
+
+ public func writeXcodeProject(_ xcodeProject: XcodeProj) throws {
+ let projectPath = project.projectPath
+ let tempPath = Path.temporary + "XcodeGen_\(Int(NSTimeIntervalSince1970))"
+ try? tempPath.delete()
+ if projectPath.exists {
+ try projectPath.copy(tempPath)
+ }
+ try xcodeProject.write(path: tempPath, override: true)
+ try? projectPath.delete()
+ try tempPath.copy(projectPath)
+ try? tempPath.delete()
+ }
+
+ public func writePlists() throws {
+
+ let infoPlistGenerator = InfoPlistGenerator()
+ for target in project.targets {
+ // write Info.plist
+ if let plist = target.info {
+ let properties = infoPlistGenerator.generateProperties(target: target).merged(plist.properties)
+ try writePlist(properties, path: plist.path)
+ }
+
+ // write entitlements
+ if let plist = target.entitlements {
+ try writePlist(plist.properties, path: plist.path)
+ }
+ }
+ }
+
+ private func writePlist(_ plist: [String: Any], path: String) throws {
+ let path = project.basePath + path
+ if path.exists, let data: Data = try? path.read(),
+ let existingPlist = (try? PropertyListSerialization.propertyList(from: data, format: nil)) as? [String: Any], NSDictionary(dictionary: plist).isEqual(to: existingPlist) {
+ // file is the same
+ return
+ }
+ let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
+ try? path.delete()
+ try path.parent().mkpath()
+ try path.write(data)
+ }
+}
diff --git a/Tests/Fixtures/TestProject/App_iOS/App.entitlements b/Tests/Fixtures/TestProject/App_iOS/App.entitlements
new file mode 100644
index 00000000..37d691ef
--- /dev/null
+++ b/Tests/Fixtures/TestProject/App_iOS/App.entitlements
@@ -0,0 +1,8 @@
+
+
+
+
+ com.apple.security.application-groups
+ group.com.app
+
+
diff --git a/Tests/Fixtures/TestProject/App_macOS/Info.plist b/Tests/Fixtures/TestProject/App_macOS/Info.plist
index e40caef4..cab4fbf4 100644
--- a/Tests/Fixtures/TestProject/App_macOS/Info.plist
+++ b/Tests/Fixtures/TestProject/App_macOS/Info.plist
@@ -20,6 +20,8 @@
1.0
CFBundleVersion
1
+ CustomSetting
+ $CUSTOM_SETTING
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
NSMainStoryboardFile
diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj
index f5691c5d..b7b028ac 100644
--- a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj
+++ b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj
@@ -483,6 +483,7 @@
FR_DBD29CA78CDBBEF69B2C39C6D23BBDA1 /* Empty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Empty.h; sourceTree = ""; };
FR_DC1C8DE46218F90A3F4FD5F8DE4F0ABB /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = ""; };
FR_E3314150DA4CEFF65D69CF7DB678E845 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ FR_E7BC65B06A0819B53634C5CD51946D98 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; };
FR_EBD99C110BD7AE780C87A31CF2E4E7DB /* App_iOS_Tests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = App_iOS_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FR_ED407ECED0DF010B1E787D238EA91A5D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
FR_EFD283107EDF836BF0D9F4EB3F9A0016 /* Framework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -722,6 +723,7 @@
G_8F5765334752A7E52B1E63ACAC466729 /* App */ = {
isa = PBXGroup;
children = (
+ FR_E7BC65B06A0819B53634C5CD51946D98 /* App.entitlements */,
FR_B993F75B001AB1C272CE83CACC06F0E5 /* AppDelegate.swift */,
FR_A0867B127ACF3ED382EB2FD5133D3EA8 /* Assets.xcassets */,
FR_05405007CB77B2E003B19B89401C12AB /* Info.plist */,
@@ -2258,6 +2260,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -2374,6 +2377,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3920,6 +3924,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4248,6 +4253,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4293,6 +4299,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4384,6 +4391,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_ENTITLEMENTS = App_iOS/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
diff --git a/Tests/Fixtures/TestProject/project.yml b/Tests/Fixtures/TestProject/project.yml
index 2afae046..f8a8a26a 100644
--- a/Tests/Fixtures/TestProject/project.yml
+++ b/Tests/Fixtures/TestProject/project.yml
@@ -26,6 +26,14 @@ targets:
App_macOS:
type: application
platform: macOS
+ info:
+ path: App_macOS/Info.plist
+ properties:
+ LSMinimumSystemVersion: $(MACOSX_DEPLOYMENT_TARGET)
+ NSMainStoryboardFile: Main
+ NSPrincipalClass: NSApplication
+ CFBundleIconFile: ""
+ CustomSetting: $CUSTOM_SETTING
attributes:
ProvisioningStyle: Automatic
sources:
@@ -39,6 +47,10 @@ targets:
App_iOS:
type: application
platform: iOS
+ entitlements:
+ path: App_iOS/App.entitlements
+ properties:
+ com.apple.security.application-groups: group.com.app
attributes:
ProvisioningStyle: Automatic
sources:
diff --git a/Tests/XcodeGenKitTests/ProjectFixtureTests.swift b/Tests/XcodeGenKitTests/ProjectFixtureTests.swift
index 6a0fae4f..6a40b2be 100644
--- a/Tests/XcodeGenKitTests/ProjectFixtureTests.swift
+++ b/Tests/XcodeGenKitTests/ProjectFixtureTests.swift
@@ -62,7 +62,9 @@ fileprivate func generateXcodeProject(specPath: Path, file: String = #file, line
let project = try Project(path: specPath)
let generator = ProjectGenerator(project: project)
let xcodeProject = try generator.generateXcodeProject()
- try xcodeProject.write(path: project.projectPath, override: true)
+ let writer = ProjectWriter(project: project)
+ try writer.writePlists()
+ try writer.writeXcodeProject(xcodeProject)
return xcodeProject
}
diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift
index 7c77635b..46bc730a 100644
--- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift
+++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift
@@ -830,6 +830,37 @@ class ProjectGeneratorTests: XCTestCase {
try expect(buildFileSettings.compactMap({ $0?["ATTRIBUTES"] }).count) == 1
try expect(buildFileSettings.compactMap({ $0?["ATTRIBUTES"] as? [String] }).first) == ["Weak"]
}
+
+ $0.it("generates info.plist") {
+ let plist = Plist(path: "Info.plist", attributes: ["UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]])
+ let tempPath = Path.temporary + "info"
+ let project = Project(basePath: tempPath, name: "", targets: [Target(name: "", type: .application, platform: .iOS, info: plist)])
+ let pbxProject = try project.generatePbxProj()
+ let writer = ProjectWriter(project: project)
+ try writer.writePlists()
+
+ guard let targetConfig = pbxProject.nativeTargets.first?.buildConfigurationList?.buildConfigurations.first else {
+ throw failure("Couldn't find Target config")
+ }
+
+ try expect(targetConfig.buildSettings["INFOPLIST_FILE"] as? String) == plist.path
+
+ 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"]
+
+ try expect(NSDictionary.init(dictionary: expectedInfoPlist).isEqual(to: infoPlist)).beTrue()
+ }
}
}
diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift
index 6c2de296..e6c731f4 100644
--- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift
+++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift
@@ -155,6 +155,38 @@ class SpecLoadingTests: XCTestCase {
try expect(target.dependencies[2]) == Dependency(type: .framework, reference: "path", weakLink: true)
}
+ $0.it("parses info plist") {
+ var targetDictionary = validTarget
+ targetDictionary["info"] = [
+ "path": "Info.plist",
+ "properties": [
+ "CFBundleName": "MyAppName",
+ "UIBackgroundModes": ["fetch"]
+ ]
+ ]
+
+ let target = try Target(name: "", jsonDictionary: targetDictionary)
+ try expect(target.info) == Plist(path: "Info.plist", attributes: [
+ "CFBundleName": "MyAppName",
+ "UIBackgroundModes": ["fetch"]
+ ])
+ }
+
+ $0.it("parses entitlement plist") {
+ var targetDictionary = validTarget
+ targetDictionary["entitlements"] = [
+ "path": "app.entitlements",
+ "properties": [
+ "com.apple.security.application-groups": "com.group",
+ ]
+ ]
+
+ let target = try Target(name: "", jsonDictionary: targetDictionary)
+ try expect(target.entitlements) == Plist(path: "app.entitlements", attributes: [
+ "com.apple.security.application-groups": "com.group",
+ ])
+ }
+
$0.it("parses cross platform targets") {
let targetDictionary: [String: Any] = [
"platform": ["iOS", "tvOS"],