Closed bonkey closed 5 years ago
I'm noticing the same issue with one of my project and as mentioned 2.7.0 works.
Looks like the issue is related to the getGroup
method in the SourceGenerator
class
private func getGroup(path: Path, name: String? = nil, mergingChildren children: [PBXFileElement], createIntermediateGroups: Bool, isBaseGroup: Bool) -> PBXGroup {
let groupReference: PBXGroup
if let cachedGroup = groupsByPath[path] {
var cachedGroupChildren = cachedGroup.children
for child in children {
if !cachedGroupChildren.contains(where: { $0.path == child.path && $0.sourceTree == child.sourceTree }) {
cachedGroupChildren.append(child)
}
}
...
the empty.json
file is not correctly added to the group since it's skipped during the check for the cached value. For example for this setup the children array has 3 values:
since the Localizable.strings
is already being cached before the empty.json
child, the json file is skipped.
It probably makes sense to also include the check for the filename along with the existing conditions, e.g.
if !cachedGroupChildren.contains(where: { $0.name == child.name && $0.path == child.path && $0.sourceTree == child.sourceTree }) {
cachedGroupChildren.append(child)
}
It looks like regression introduced in XcodeGen 2.8.0, in 2.7.0 it doesn't happen. The result is similar to #70.
When all three conditions are fulfilled:
.lproj
folders (it doesn't matter what kind of:.json
,.strings
,.stringsdict
)createIntermediateGroups: true
inoptions
Then some of the localized resources get wrong paths and as the result go to "Recovered References"
Resulted
.xcodeproj
contains incorrectpath
:Sample project: xcodegen-localized.zip
When you remove
App/Resources/fonts
or comment outoptions
– the project is generated correctly.