From 0190d2e33a34db50d1eb2fbc8896211560825bdc Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Wed, 9 Jul 2025 00:21:28 -0300 Subject: [PATCH] feat: AndroidShowDeprecations preference flag (#1822) --- lib/prepare.js | 3 ++- templates/project/build.gradle | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/prepare.js b/lib/prepare.js index 4a8bbd052..4a294c8af 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -113,7 +113,8 @@ function getUserGradleConfig (configXml) { { xmlKey: 'GradlePluginKotlinEnabled', gradleKey: 'IS_GRADLE_PLUGIN_KOTLIN_ENABLED', type: Boolean }, { xmlKey: 'AndroidJavaSourceCompatibility', gradleKey: 'JAVA_SOURCE_COMPATIBILITY', type: Number }, { xmlKey: 'AndroidJavaTargetCompatibility', gradleKey: 'JAVA_TARGET_COMPATIBILITY', type: Number }, - { xmlKey: 'AndroidKotlinJVMTarget', gradleKey: 'KOTLIN_JVM_TARGET', type: String } + { xmlKey: 'AndroidKotlinJVMTarget', gradleKey: 'KOTLIN_JVM_TARGET', type: String }, + { xmlKey: 'AndroidShowDeprecations', gradleKey: 'JAVA_SHOW_DEPRECATIONS', type: Boolean } ]; return configXmlToGradleMapping.reduce((config, mapping) => { diff --git a/templates/project/build.gradle b/templates/project/build.gradle index 1e4eec731..fdf2bbb33 100644 --- a/templates/project/build.gradle +++ b/templates/project/build.gradle @@ -40,6 +40,18 @@ allprojects { } repositories repos + + subprojects { + afterEvaluate { + tasks.withType(JavaCompile).tap { + configureEach { + if (cordovaConfig.JAVA_SHOW_DEPRECATIONS == true) { + options.compilerArgs += "-Xlint:deprecation" + } + } + } + } + } } task clean(type: Delete) {