Make default java_toolchain compile protos as java 7.
Fixes
Without this change, there is no way to use Bazel to build a release Android build (--noincremental_dexing) with java 8 and protos.
RELNOTES: Java protos are compiled to Java 7 bytecode.
@@ -155,6 +155,16 @@ alias(
java_toolchain(
name = "toolchain",
bootclasspath = [":bootclasspath"],
+ compatible_javacopts = {
+ # Restrict protos to Java 7 so that they are compatible with Android.
+ "proto": [
+ "-source",
+ "7",
+ "-target",
+ "7",
+ "-XDallowBetterNullChecks=false",
+ ],
+ },
encoding = "UTF-8",
extclasspath = [":extclasspath"],
forcibly_disable_header_compilation = 0,
