Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
308d9816
Commit
308d9816
authored
Oct 13, 2020
by
Georg Koppen
Committed by
Matthew Finkel
Nov 24, 2020
Browse files
Bug 40083: Make locale ordering in BuildConfig deterministic
parent
46227efe
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/build.gradle
View file @
308d9816
...
...
@@ -608,16 +608,22 @@ task buildTranslationArray {
// This isn't running as a task, instead the array is build when the gradle file is parsed.
// https://github.com/mozilla-mobile/fenix/issues/14175
def
foundLocales
=
new
StringBuilder
()
def
languageCodes
=
[]
foundLocales
.
append
(
"new String[]{"
)
fileTree
(
"src/main/res"
).
visit
{
FileVisitDetails
details
->
if
(
details
.
file
.
path
.
endsWith
(
"${File.separator}strings.xml"
)){
def
languageCode
=
details
.
file
.
parent
.
tokenize
(
File
.
separator
).
last
().
replaceAll
(
'values-'
,
''
).
replaceAll
(
'-r'
,
'-'
)
languageCode
=
(
languageCode
==
"values"
)
?
"en-US"
:
languageCode
foundLocales
.
append
(
"\""
).
append
(
languageCode
).
append
(
"\""
).
append
(
","
)
languageCodes
.
add
(
languageCode
)
}
}
// The order of files in a `FileTree` is not stable, even on a single
// computer. Thus we need to sort the `languageCode`s. See: fenix#40083.
languageCodes
.
sort
()
languageCodes
.
each
{
foundLocales
.
append
(
"\""
).
append
(
it
).
append
(
"\""
).
append
(
","
)
}
foundLocales
.
append
(
"}"
)
def
foundLocalesString
=
foundLocales
.
toString
().
replaceAll
(
',}'
,
'}'
)
android
.
defaultConfig
.
buildConfigField
"String[]"
,
"SUPPORTED_LOCALE_ARRAY"
,
foundLocalesString
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment