Fix multiple code paths #267
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #264
Proposed Changes
I have adjusted the logic of
incrementalCodeUpdatemethod to properly handle extracting strings from source files specified via multiple entries inupdate.code.codePathsoption.In the past, the logic was to walk all
codePathsdirectories. For each directory create a temporary.stringsfile. Merge all entries from the temporary.stringsfile into output. Invoking this logic for multiplecodePathsinadditive=falsemode would repeatedly overwrite the outputLocalized.stringsfile with only the entries extracted from currently processed directory and would remove everything else.The new logic uses only one temporary
.stringsfile into which all entries from allcodePathsare extracted by usingextractLocStrings -a(the append mode) and only after that are all strings from the temporary.stringsfile merged into the outputLocalizable.strings.Changes
extractLocStringsspecify the-aoption to append extracted strings into temporary.stringsfile instead of replacing them..stringsfile for all strings extracted duringcode.updateTesting
I have a testing project with the following
.bartycrouch.tomlMultiple entries via
update.code.codePaths, andupdate.code.additive=falseEach subdirectory contains one
NSLocalizedStringentry.Invoking published release against this project results in only one entry detected:
Invoking version with the new logic results in: