Closed samuelsainz closed 1 year ago
@samuelsainz thank you for the detailed report! Can you clarify whether this is only a cosmetic issue (folder looks wrong) or does this also result in incorrect build products as a result?
@igor-makarov hey Igor, I'm sorry for the late reply.
We could say it is only a cosmetic issue, since for that specific resource Localization will work anyway. Here I have created a sample project to test that the localization works: https://github.com/samuelsainz/xcake-localized-resources
But in our project we still had an issue with this. Let's consider the next example:
The app target has the next resources added to it in the original project:
If I use xcake, I will get the next:
So we get the error Multiple commands produce Location.strings file
.
The workaround was easy—just renaming the storyboard or the strings file fix the issue. Not a blocker for us but more than happy to contribute if you think it is worths to solve it
@samuelsainz I've looked at the sample project you provided, and tried to replicate the scenario you described, the .storyboard
and .strings
having the same filename.
I've added the files to Xcode and this is the group structure I've gotten:
The build succeeded.
I recalled that the final folder structure was supposed to be flat, so I was suspicious. I've opened the build product to inspect the results. To my surprise, the folders looked like so:
There was only one ElaborateName.strings
file per language. I've inspected its contents, and it contained only the storyboard localization, and not the other strings.
in other words, Xcode was somehow allowing an incorrect build to happen. I've experimented with deleting various .lproj
folders within the built product, and had managed to get it to copy either file. My hunch is that the "Compile Storyboard" build task doesn't have the .strings
output files declared on it.
I will be opening a feedback to Apple with this.
TL;DR: Having same-named .storyboard
and .strings
files is not possible due to the final app bundle structure. Xcake's bug has (ironically) protected you from it, while plain Xcode has a bug in it.
@igor-makarov I see, we will rename the duplicated resources then. Thanks a lot for digging into it Igor!
If you open a feedback to Apple for that please share the link so we can follow up :)
@samuelsainz there isn't a way to share a link in Apple Feedback, but the ID is FB11718625.
Closing this issue.
Description
I have noticed that for Localized resources as .storyboards, .xib or .plist, the references are not being generated correctly. I looked into the closed issues to see if this has happened to someone before but I didn't find anything.
Expected:
Result with Xcake:
The folder structure is the next one:
Resources -- Base.lproj ---- MainInterface.storyboard -- es.lproj ---- MainInterface.strings -- de.lproj ---- MainInterface.strings ....
Which is the folder structure that the Xcode generates when you Localize a storyboard from the interface.
Why is this happening?
The representation of the expected result in the xcodeproj is a PBXVariantGroup. These variant groups are created in Xcake with this method.
When Xcake finds a file that has a parent folder
*.lproj
it will try to add it to a variant group with the same name of that file. The issue happen when comparing MainInterface.storyboard and MainInterface.strings, since they are different it creates two separated PBXVariantGroup instead of being included in the same one—which also should have the name MainInterface.storyboard.Expected:
Result:
Another thing that is happening is that the
.strings
files are being included in PBXBuildFile and PBXResourcesBuildPhase. That doesn't happen when you localize a resource using Xcode.PR Guidelines
I'm exploring alternatives to make a fix and send a PR, do you have any suggestion on how to solve this?