-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure all downloaded translations and metadata are committed #18199
Conversation
9eb1900
to
2e3dbf0
Compare
fastlane/Fastfile
Outdated
git_commit( | ||
path: File.join(parent_dir_for_lprojs, '*.lproj', 'Localizable.strings'), | ||
message: 'Update app translations – `Localizable.strings`', | ||
allow_nothing_to_commit: true | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If GitHub doesn't expand the lines on top of this diff, it might not be clear why this commit is here.
This commit is here to track the changes made by the ios_download_strings_files_from_glotpress
. I haven't dug the history of how the action changed, but I'm guessing either that or its predecessor used to commit for us and we, rightly, removed it.
fastlane/Fastfile
Outdated
@@ -477,13 +477,25 @@ platform :ios do | |||
download_dir: parent_dir_for_lprojs | |||
) | |||
|
|||
# Then redispatch the appropriate subset of translations back to the `InfoPlist.strings` and `Sites.strings` files in corresponding `*.lproj` dirs | |||
parent_dir_for_intents_target_lprojs = File.join('WordPress', 'WordPressIntents') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My editor told me about this unused variable 😄
Notice that the WordPressIntents
app extension which the variable referred to is part of the MANUALLY_MAINTAINED_STRINGS_FILES
Hash
which we pass to current iteration of the extractor action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already fixed by my "cleanup Fastfile" PR (which is build on top of my "split Fastfile" PR)… so committing this change here will likely lead to conflicts in both PR 😓
fastlane/Fastfile
Outdated
|
||
git_commit( | ||
path: modified_files, | ||
message: 'Update app translations – Other `.strings`', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to use the same "root" for this commit as the one above and to differentiate them using "Localizable.strings
" vs. "Other .strings
".
There might be a nifty way to do it all in one commit, but I actually think it might be useful to do it separately. Apart from being the result of two different actions, it might also be useful to compare how a strings changed from GlotPress in the first commit with how it was extracted in the second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #18200, there are no changes to the extracted .strings
. I verified this works locally by editing a prefixed string in Localizable.strings
and running the action.
The reason for it is that those were the only files committed. You can see it worked well in the main release branch: 5fa5005 . Also notice how that commits doesn't have any Localizable.strings
files, which further shows the necessity for the other git_commit
call above.
fastlane/Fastfile
Outdated
@@ -515,7 +527,7 @@ platform :ios do | |||
FileUtils.cp(release_notes_source, File.join(metadata_directory, 'en-US', 'release_notes.txt')) | |||
|
|||
git_commit( | |||
path: Dir.glob('**/*.txt', base: metadata_directory), | |||
path: File.join(metadata_directory, '**', '*.txt'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dir.glob('**/*.txt', base: metadata_directory)
didn't work. From what I understand and saw locally, there are two reasons.
First, even if we use base:
, the paths returned by glob
are still relative. From the docs:
The optional base keyword argument specifies the base directory for interpreting relative pathnames instead of the current working directory. As the results are not prefixed with the base directory name in this case, you will need to prepend the base directory name if you want real paths.
Second, Dir.glob
returns the files that match the given pattern, but that excludes deleted files. If a file is not there anymore, it can't match the given pattern. This would have made the commit incomplete.
We could argue whether our code should delete the existing translations when it doesn't find new ones. Even if we concluded that behavior is not desirable, we'd still need to account for it locally until we update it in the release toolkit. Otherwise, our local copies would remain dirty after downloading the release notes metadata if no new ones are available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mokagio One thing I just thought about with using git_commit
with fastlane/metadata/**/*.txt
is: is there a risk that this might also commit especially the review_information
file — which contains secret information, especially credentials that Apple reviewers should use to test the app? 🤔
I think not, given this file is .gitignore
'd in the first place, so I'm rather confident this is all good. But just wanted to flag this anyway as something to double-check next time you'll run deliver
and all.
See also p91TBi-4Le-p2#comment-4004 — which is not the same thing (the file did not get commited, but that did not prevent to being updated and changed in our local Macs during a past deliver download) but tangential.
Fastfile
Generated by 🚫 dangerJS |
Thanks for the PR. I'd have preferred that you merge #18140 an #18192 first though, or build this PR on top of #18192, because as it is we can't merge this PR without breaking those other two (and also at least one of these changes were already fixed by those) I'll try to rebase the PR and transcribe the changes yours made in the main Fastfile to be applied in the corresponding |
And update other "`.strings` update" commit message to differentiate the two steps
The previous version used `Dir.glob('**/*.txt', base: metadata_directory)`, but that didn't work for two reasons. First, even if we use `base:`, the paths returned by `glob` are still relative. From the docs: > The optional base keyword argument specifies the base directory for > interpreting relative pathnames instead of the current working > directory. As the results are not prefixed with the base directory name > in this case, you will need to prepend the base directory name if you > want real paths. See https://ruby-doc.org/core-2.7.4/Dir.html#method-c-glob . Second, `Dir.glob` returns the files that match the given pattern, but that excludes _deleted_ files. If a file is not there anymore, it can't match the given pattern. This would have made the commit incomplete. We could argue whether our code should delete the existing translations when it doesn't find new ones. Even if we concluded that behavior is not desirable, we'd still need to account for it locally until we update it in the release toolkit. Otherwise, our local copies would remain dirty after downloading the release notes metadata if no new ones are available.
2e3dbf0
to
9c557da
Compare
@mokagio Hope you don't mind, I took the liberty to rebase your branch and force-push it on top of I basically manually recreated your changes in new commits (instead of doing a Since this is all part of a telescoping train of PRs, I suggest the following action and merge order:
|
You can test the changes in WordPress from this Pull Request by:
.ipa file can also be downloaded directly here.If you need access to App Center, please ask a maintainer to add you. |
You can test the changes in Jetpack from this Pull Request by:
.ipa file can also be downloaded directly here.If you need access to App Center, please ask a maintainer to add you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving after reworking the PR myself to make it be built on top of #18192 (i.e. post-fastlane-split), so it's a bit cheating (kinda approving my own changes here…)
@mokagio I'll let you handle the telescoping-merging of the 3 PRs as I described in #18199 (comment) if all look good to you.
@AliSoftware your suggestion in regards to the order in which to merge the PRs so that they eventually all land in |
I run the
new_beta_release
lane today and, while all the translations were downloaded correctly, the were not committed.This PR has just enough code to address the committing issues. I did not track the result running the updated lane, i.e. the translated files, because I thought I'd ship a new beta on purpose for that, so we can see the diff in the usual "merge beta n" context. You can still see the commits either by creating a new branch from this one and running
download_localized_strings_and_metadata
, or by looking at this demo PR.