mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Merge pull request #443 from feischl97/fix-issue-440
Don't overwrite INFOPLIST_FILE setting with info path
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#### Changed
|
||||
- Changed spelling of build phases to **preBuildPhase** and **postBuildPhase**. [402](https://github.com/yonaskolb/XcodeGen/pull/402) @brentleyjones
|
||||
- **BREAKING** Moved generation to a specific subcommand `xcodegen generate`. If not specifying any arguments `xcodegen` will still work [#437](https://github.com/yonaskolb/XcodeGen/pull/437) @yonaskolb
|
||||
- If `INFOPLIST_FILE` has been set on a target, then an `info` path won't ovewrite it [#443](https://github.com/yonaskolb/XcodeGen/pull/443) @feischl97
|
||||
|
||||
## 2.0.0
|
||||
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ 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.
|
||||
- [ ] **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.
|
||||
- `CFBundleIdentifier`
|
||||
- `CFBundleInfoDictionaryVersion`
|
||||
- `CFBundleExecutable`
|
||||
|
||||
@@ -792,11 +792,11 @@ public class PBXProjGenerator {
|
||||
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 {
|
||||
// Set INFOPLIST_FILE if not defined in settings
|
||||
if !project.targetHasBuildSetting("INFOPLIST_FILE", target: target, config: config) {
|
||||
if let info = target.info {
|
||||
buildSettings["INFOPLIST_FILE"] = info.path
|
||||
} else if searchForPlist {
|
||||
plistPath = getInfoPlist(target.sources)
|
||||
searchForPlist = false
|
||||
}
|
||||
|
||||
@@ -882,6 +882,24 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
|
||||
try expect(NSDictionary(dictionary: expectedInfoPlist).isEqual(to: infoPlist)).beTrue()
|
||||
}
|
||||
|
||||
$0.it("info doesn't override info.plist setting") {
|
||||
let predefinedPlistPath = "Predefined.plist"
|
||||
// generate plist
|
||||
let plist = Plist(path: "Info.plist", attributes: ["UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]])
|
||||
let tempPath = Path.temporary + "info"
|
||||
// create project with a predefined plist
|
||||
let project = Project(basePath: tempPath, name: "", targets: [Target(name: "", type: .application, platform: .iOS, settings: Settings(buildSettings: ["INFOPLIST_FILE": predefinedPlistPath]), info: plist)])
|
||||
let pbxProject = try project.generatePbxProj()
|
||||
let writer = FileWriter(project: project)
|
||||
try writer.writePlists()
|
||||
|
||||
guard let targetConfig = pbxProject.nativeTargets.first?.buildConfigurationList?.buildConfigurations.first else {
|
||||
throw failure("Couldn't find Target config")
|
||||
}
|
||||
// generated plist should not be in buildsettings
|
||||
try expect(targetConfig.buildSettings["INFOPLIST_FILE"] as? String) == predefinedPlistPath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user