Bug 1405396 - Pre: Set file.encoding=utf-8 for GeckoView packaging. r=maliu
We already had a work-around in place for Gradle invocations, but
apparently that wasn't enough for the Maven deployer, which must
launch its own JVM, which doesn't have the correct file encoding on
Linux.
MozReview-Commit-ID: 4z1IEZBmLaz
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -311,20 +311,30 @@ class MachCommands(MachCommandBase):
# filter strings.xml, which is really UTF-8; the ellipsis character is
# replaced with ??? in some encodings (including ASCII). It's not yet
# possible to filter with encodings in Gradle
# (https://github.com/gradle/gradle/pull/520) and it's challenging to
# do our filtering with Gradle's Ant support. Moreover, all of the
# Android tools expect UTF-8: see
# http://tools.android.com/knownissues/encoding. See
# http://stackoverflow.com/a/21267635 for discussion of this approach.
+ #
+ # It's not even enough to set the encoding just for Gradle; it
+ # needs to be for JVMs spawned by Gradle as well. This
+ # happens during the maven deployment generating the GeckoView
+ # documents; this works around "error: unmappable character
+ # for encoding ASCII" in exoplayer2. See
+ # https://discuss.gradle.org/t/unmappable-character-for-encoding-ascii-when-building-a-utf-8-project/10692/11
+ # and especially https://stackoverflow.com/a/21755671.
+
return self.run_process([self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
append_env={
'GRADLE_OPTS': '-Dfile.encoding=utf-8',
'JAVA_HOME': java_home,
+ 'JAVA_TOOL_OPTIONS': '-Dfile.encoding=utf-8',
},
pass_thru=True, # Allow user to run gradle interactively.
ensure_exit_code=False, # Don't throw on non-zero exit code.
cwd=mozpath.join(self.topsrcdir))
@Command('gradle-install', category='devenv',
conditions=[REMOVED])
def gradle_install(self):