Increase max heap size for java compilation tasks.

Change-Id: Ieb08b30f66c2f5462bcc5fd74f6db3891716fe45
diff --git a/build.gradle b/build.gradle
index b6b1772..d9fd85d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -471,6 +471,8 @@
         // Javac often runs out of stack space when compiling the tests.
         // Increase the stack size for the javac process.
         options.forkOptions.jvmArgs << "-Xss4m"
+        // Test compilation is sometimes hitting the default limit at 1g, increase it.
+        options.forkOptions.jvmArgs << "-Xmx2g"
         // Set the bootclass path so compilation is consistent with 1.8 target compatibility.
         options.forkOptions.jvmArgs << "-Xbootclasspath/a:third_party/openjdk/openjdk-rt-1.8/rt.jar"
     }