Bug 1405396 - Pre: Set file.encoding=utf-8 for GeckoView packaging. r=maliu draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 18 Oct 2017 19:04:10 -0700
changeset 692167 951bb4c75ecba0d83cb86e728e1164dda99a6a08
parent 692166 dcf5c06f97dea682e29c46b8e7f7cd9f3ee58888
child 692168 75cd2dfb51e0e1b510f5e618c2dc881cf5f22bf2
push id87422
push usernalexander@mozilla.com
push dateThu, 02 Nov 2017 17:14:40 +0000
reviewersmaliu
bugs1405396
milestone58.0a1
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
mobile/android/mach_commands.py
--- 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):