From d978d0df4bfddd3620b9b4ea67c6d8e7f6bfac67 Mon Sep 17 00:00:00 2001 From: Pedro Novais <1478752+jpnovais@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:37:13 +0100 Subject: [PATCH] java/kotlin build: allow warning locally with explicit optin (#243) --- build.gradle | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 18ec1cda..4b708aa6 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,10 @@ plugins { task compileAll +// to allow to have unused vars/imports,etc for faster debugging/prototyping +// instead of deleting and re-adding code all the time +def allowCompilationWarnings = System.getenv('LINEA_DEV_ALLOW_WARNINGS') != null + allprojects { repositories { mavenCentral() } @@ -22,7 +26,7 @@ allprojects { tasks.withType(KotlinCompile).configureEach { compileAll.dependsOn it compilerOptions { - allWarningsAsErrors = true + allWarningsAsErrors = !allowCompilationWarnings } } @@ -38,8 +42,12 @@ allprojects { '-Xlint:finally', '-Xlint:static', '-Xlint:deprecation', - '-Werror' ]) + if (!allowCompilationWarnings) { + options.compilerArgs.addAll([ + '-Werror' + ]) + } if (!project.path.contains("testing-tools")) { // testing tools have 100+ errors because of this