From 46c90133bd82dbcd10d1941abfe906d5d7713401 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Mon, 17 Jun 2019 11:26:50 -0400 Subject: [PATCH] Allow switching off the -Werror javac option This option causes Intellij build to fail if the 'Delegate IDE build/run actions to gradle' box is checked. We do not know of anyway to change the Intellij behavior. This change allows an IDE user to prevent -Werror to be passed to javac by adding a Gradle VM option: -Dno_werror=true --- java_common.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java_common.gradle b/java_common.gradle index 78e9a2628..988e608cc 100644 --- a/java_common.gradle +++ b/java_common.gradle @@ -15,6 +15,12 @@ dependencies { } tasks.withType(JavaCompile).configureEach { + // The -Werror flag causes Intellij to fail on deprecated api use. + // Allow IDE user to turn off this flag by specifying a Gradle VM + // option from inside the IDE. + if (System.getProperty('no_werror') != 'true') { + options.compilerArgs << "-Werror" + } options.compilerArgs << "-Werror" options.errorprone.disableWarningsInGeneratedCode = true options.errorprone.errorproneArgumentProviders.add([